https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120839
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #10)
> In fact the AMD64 ABI says "If the class is MEMORY ,pass trhe argument on
> the stack at an address respecting the arguments alignemnt (which might be
> more than its natural alignment). So
>
> diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> index acedc73b825..b43d50b6bc3 100644
> --- a/gcc/config/i386/i386.cc
> +++ b/gcc/config/i386/i386.cc
> @@ -3803,9 +3803,6 @@ ix86_function_arg_boundary (machine_mode mode,
> const_tree type)
> unsigned int align;
> if (type)
> {
> - /* Since the main variant type is used for call, we convert it to
> - the main variant type. */
> - type = TYPE_MAIN_VARIANT (type);
> align = TYPE_ALIGN (type);
> if (TYPE_EMPTY_P (type))
> return PARM_BOUNDARY;
More defensive
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index acedc73b825..c9f58b1eace 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -3803,10 +3803,10 @@ ix86_function_arg_boundary (machine_mode mode,
const_tree type)
unsigned int align;
if (type)
{
+ align = TYPE_ALIGN (type);
/* Since the main variant type is used for call, we convert it to
the main variant type. */
type = TYPE_MAIN_VARIANT (type);
- align = TYPE_ALIGN (type);
if (TYPE_EMPTY_P (type))
return PARM_BOUNDARY;
}
causes
+FAIL: gcc.dg/torture/pr35771-1.c -O0 execution test
+FAIL: gcc.dg/torture/pr35771-1.c -O1 execution test
+FAIL: gcc.dg/torture/pr35771-2.c -O0 execution test
+FAIL: gcc.dg/torture/pr35771-2.c -O1 execution test
+FAIL: gcc.dg/torture/pr35771-3.c -O0 execution test
+FAIL: gcc.dg/torture/pr35771-3.c -O1 execution test
+FAIL: gcc.target/i386/pr35767-3.c execution test
I did not check struct-compat against an alt GCC.