Bug 48082 - Problem compiling function that returns va_list on 64 bit system.
Summary: Problem compiling function that returns va_list on 64 bit system.
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 48079 48080 48081 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-03-12 00:31 UTC by VA
Modified: 2011-04-01 19:02 UTC (History)
0 users

See Also:
Host:
Target: x86_64-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
preprocessor file (2.95 KB, text/plain)
2011-03-12 00:33 UTC, VA
Details

Note You need to log in before you can comment on or make changes to this bug.
Description VA 2011-03-12 00:31:58 UTC
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)
Comment 1 VA 2011-03-12 00:33:10 UTC
Created attachment 23634 [details]
preprocessor file
Comment 2 Andrew Pinski 2011-03-12 01:03:42 UTC
I think this is a correct error.  The C standard allows va_list to be an array.
Comment 3 VA 2011-03-12 01:35:36 UTC
Ok, for the sake of my curiosity, could you explain why it is only an "issue" when compiling with the 64 bit libraries?
Comment 4 Andrew Pinski 2011-03-12 02:20:31 UTC
(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.
Comment 5 Richard Biener 2011-03-14 10:27:06 UTC
.
Comment 6 Andrew Pinski 2011-04-01 19:02:31 UTC
*** Bug 48081 has been marked as a duplicate of this bug. ***
Comment 7 Andrew Pinski 2011-04-01 19:02:43 UTC
*** Bug 48080 has been marked as a duplicate of this bug. ***
Comment 8 Andrew Pinski 2011-04-01 19:02:50 UTC
*** Bug 48079 has been marked as a duplicate of this bug. ***