[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 jason at gcc dot gnu.org --- (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

[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 hjl.tools at gmail dot com changed: What|Removed |Added CC||hjl.tools at gmail

[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 ubizjak at gmail dot com --- (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

[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 jason at gcc dot gnu.org --- (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

[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 jason at gcc dot gnu.org --- Created attachment 32228 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=32228action=edit HJ's test in dejagnu form Here's HJ's testcase in a form that can be dropped into

[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 ubizjak at gmail dot com --- (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

[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 pinskia at gcc dot gnu.org --- (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++

[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 hjl.tools at gmail dot com changed: What|Removed |Added Summary|va_start corrupts 6-th |empty struct value is

[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 ubizjak at gmail dot com --- (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

[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 ubizjak at gmail dot com --- (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 pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #7 from Andrew Pinski pinskia at gcc dot gnu.org --- (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

[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 hjl.tools at gmail dot com --- 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 @@

[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 vagran.ast at gmail dot com --- (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

[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 pinskia at gcc dot gnu.org --- (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.

[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 hjl.tools at gmail dot com --- 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

[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 glisse at gcc dot gnu.org --- 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,

[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 hjl.tools at gmail dot com --- 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 hjl.tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 --- Comment #14 from H.J. Lu hjl.tools at gmail dot com --- (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,