[Bug c/10719] invalid code generated (x86, "int $5") with __builtin_va_arg(va, char);

mkermani at latticesemi dot com gcc-bugzilla@gcc.gnu.org
Wed Oct 15 19:33:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10719



------- Additional Comments From mkermani at latticesemi dot com  2003-10-15 19:33 -------
Subject: This is in regards to Bug 10719 and 12627

The issue is what should happen when the code,
 
   short x = va_arg(ap, short)
   
is executed. On NT and Solaris and any other compiler
this code works fine.  On GCC 3.3.1 it seg-faults.

Now the code needs to be conditionally compiled for GCC 
because it is not dealt with like all other compilers.
You can point to an ANSI or ISO documents which may
say this is undefined behavior, but if your are swimming 
up stream you are not doing it the right way.  It appears 
to me GCC should deal with this in the right way like 
all other compilers do. To say the behavior is undefined
it does not mean GCC should deal with it the worst possible 
way.  It could also mean hey we deal with it.  Why not 
choose the second.

Masoud.

--
Masoud Fadai Kermani, 
masoud.kermani@latticesemi.com
The man who views the world at 50 the same as he did at 20 has 
wasted 30 years of his life. (Muhammad Ali)



More information about the Gcc-bugs mailing list