c/4152: Incorrect code for va_arg(x,char) and va_arg(x,short) on SH

Schirmer, Hartmut SchirmerH@Innovative-Systems.de
Tue Aug 28 10:39:00 GMT 2001


> C standards (C89 and later which have va_arg) specify that 
> anything passed 
> through '...' is fully promoted.

Ok, thanks for that information.

> I wonder how you could compile your code, cause I looked it up and in 
> gcc-2.96, gcc-3.0.x and gcc-3.1 it is an error (issued in 
> gcc/builtins.c), 
> not a warning. Are you sure you use a clean code base?

I was just checking gcc 3.0.1 behaviour on this code
since we had trouble with this error before.

gcc -S gives me the .s file I reported
gcc -c failes

Is this ok? 

We usually do
	gcc -E src.c -o src.i
	gcc -S src.i -o src.s
	gcc -c src.s -o src.o
in our script files. The gcc result isn't checked so
we will continue with the incorrect .s file in this case.

> >I tried all combinations and only thoese with
> >sizeof(type) < sizeof(int) failed.
> >
> >I still think gcc is wrong here. It used to
> >work right and still could work right.
> 
> No, because allowing this leads to extremely 
> hard-to-track-down bugs if you 
> write code running on a lot of platforms.

Ok, I agree.

Thanks again,
Hartmut



More information about the Gcc-bugs mailing list