I am trying to compile the following simple code snippet: ''' /* test.c */ #include <stdio.h> #include <stdarg.h> va_list function(int i, va_list args){ return args; } int main(void){ return 0; } ''' I am running 64 bit Ubuntu. The code can be compiled successfully using. gcc -Wall test.c -o test -m32 However if I compile using the standard 64 bit mode gcc -Wall test.c -o test I get the following error: test.c:4: error: 'function' declared as function returning an array test.c: In function 'function': test.c:5: warning: return makes integer from pointer without a cast The above code does not serve much purpose other than to demonstrate where the compiler seems to be breaking. ----- gcc -v Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
Created attachment 23634 [details] preprocessor file
I think this is a correct error. The C standard allows va_list to be an array.
Ok, for the sake of my curiosity, could you explain why it is only an "issue" when compiling with the 64 bit libraries?
(In reply to comment #3) > Ok, for the sake of my curiosity, could you explain why it is only an "issue" > when compiling with the 64 bit libraries? Because va_list is target specific and x86_64 defines it as an array while 32bit does not.
.
*** Bug 48081 has been marked as a duplicate of this bug. ***
*** Bug 48080 has been marked as a duplicate of this bug. ***
*** Bug 48079 has been marked as a duplicate of this bug. ***