delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/04/22/07:30:03

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: __builtin_va_list bug?
Date: 22 Apr 2003 11:14:58 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 20
Message-ID: <b8387i$lk9$1@nets3.rz.RWTH-Aachen.DE>
References: <0ab801c306bf$4dacb430$0600000a AT broadpark DOT no> <3EA26C19 DOT 81D82449 AT acm DOT org> <0c2401c30751$05203c90$0600000a AT broadpark DOT no>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 1051010098 22153 137.226.32.75 (22 Apr 2003 11:14:58 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 22 Apr 2003 11:14:58 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Gisle Vanem <giva AT bgnett DOT no> wrote:
[...]
> Yes, I know. I use "x = (char) va_arg(arg,int)" to stop gcc complaining.

That's the wrong way of looking at this.  It's not the complaint from
GCC you have to stop here.  It's the undefined behaviour that will be
caused by the illegal C you posted before.

> But my question is why the "int $5" is generated. I guess it's meant to
> generated some trap on some system. 

You're asking the wrong question, then.  Fix your broken code, and it
won't happen.  You don't have to know why this particular thing
happened, in this particular case.  The compiler would be allowed to
insert the binary time-of-day into the code in such cases, just for
the fun of it.  Or whatever else it finds in a random position in your
garbage can.
-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019