[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-27 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #21 from Andrew Pinski --- (In reply to Marc Glisse from comment #12) > It is a bit alarming that gcc, clang and clang++ use one ABI and g++ uses a > different (inferior) one (the incompatibility with clang++ should affect > some stand

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-27 Thread ubizjak at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #20 from Uroš Bizjak --- (In reply to H.J. Lu from comment #4) > Can someone try this on non-x86 targets? gcc110 (ppc64) from the compile farm: [uros@gcc1-power7 ~]$ gcc -c fun.i [uros@gcc1-power7 ~]$ gcc -c x.ii [uros@gcc1-power7 ~

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-27 Thread jason at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #19 from Jason Merrill --- Created attachment 32228 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32228&action=edit HJ's test in dejagnu form Here's HJ's testcase in a form that can be dropped into g++.dg/abi.

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-27 Thread jason at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #18 from Jason Merrill --- (In reply to Uroš Bizjak from comment #17) > classify_argument has an early exit: > > /* Zero sized arrays or structures are NO_CLASS. We return 0 to >signalize memory class, so handle it as s

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-27 Thread ubizjak at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #17 from Uroš Bizjak --- (In reply to Jason Merrill from comment #15) > That only documents that sizeof is different for C and C++, the calling > convention should be the same. And it seems like classify_argument should > already be

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-27 Thread hjl.tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 H.J. Lu changed: What|Removed |Added CC||hjl.tools at gmail dot com --- Comment #16 from

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-27 Thread jason at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #15 from Jason Merrill --- (In reply to Andrew Pinski from comment #7) > No this testcase is not valid at all. See > http://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/Empty-Structures.html#Empty- > Structures where it is documented it is no

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-26 Thread hjl.tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #14 from H.J. Lu --- (In reply to H.J. Lu from comment #13) > Passing > > struct dummy { }; > > is still odd for g++. It is supposed to have a single member of type char, > which should be passed in register, not on stack. This pas

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-26 Thread hjl.tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #13 from H.J. Lu --- Passing struct dummy { }; is still odd for g++. It is supposed to have a single member of type char, which should be passed in register, not on stack.

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-26 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #12 from Marc Glisse --- It is a bit alarming that gcc, clang and clang++ use one ABI and g++ uses a different (inferior) one (the incompatibility with clang++ should affect some standard library functions, though they are often inline

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-26 Thread hjl.tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #11 from H.J. Lu --- This patch may be better: diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 00773d8..426146a 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -6842,7 +6842,7 @@ examine_argument

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-26 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #10 from Andrew Pinski --- (In reply to vagran from comment #9) > (In reply to Andrew Pinski from comment #7) > > (In reply to H.J. Lu from comment #4) > > > Is this test valid? BTW, clang works fine on x86. > > > > No this testcase i

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-26 Thread vagran.ast at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #9 from vagran --- (In reply to Andrew Pinski from comment #7) > (In reply to H.J. Lu from comment #4) > > Is this test valid? BTW, clang works fine on x86. > > No this testcase is not valid at all. See > http://gcc.gnu.org/onlinedoc

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-26 Thread hjl.tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #8 from H.J. Lu --- This works: diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 00773d8..16669b9 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -7193,6 +7193,7 @@ function_arg_advance_64 (CUMULA

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-26 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #7 from Andrew Pinski --- (In reply to H.J. Lu from comment #4) > Is this test valid? BTW, clang works fine on x86. No this testcase is not valid at all. See http://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/Empty-Structures.html#Empty-Str

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-26 Thread ubizjak at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #6 from Uroš Bizjak --- (In reply to H.J. Lu from comment #4) > Can someone try this on non-x86 targets? I get abort on alpha: $ gcc -c fun.i $ gcc -c x.ii $ g++ fun.o x.o $ ./a.out Aborted

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-26 Thread ubizjak at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #5 from Uroš Bizjak --- (In reply to Andrew Pinski from comment #3) > It is a target bug if it is passing on the stack. Note in C++, the size of > the struct is 1 while in C, the size is 0. Changing the testcase a bit: fun(d, 2,

[Bug target/60336] empty struct value is passed differently in C and C++

2014-02-26 Thread hjl.tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 H.J. Lu changed: What|Removed |Added Summary|va_start corrupts 6-th |empty struct value is |argume