[Bug target/60336] empty struct value is passed differently in C and C++
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Feb 26 20:47:00 GMT 2014
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, not on stack.
This passes it in register:
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 00773d8..6975ff1 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -6613,6 +6613,8 @@ classify_argument (enum machine_mode mode, const_tree
type,
return 0;
}
}
+ if (mode == QImode && words == 1 && classes[0] == X86_64_NO_CLASS)
+ classes[0] = X86_64_INTEGERSI_CLASS;
return words;
}
More information about the Gcc-bugs
mailing list