struct S { union {} a; } __attribute__((aligned)); void check (struct S arg) { } ICEs on x86-64 at any optimization level. Works fine in C.
Even though this is only seen with the C++ front-end, I would almost think this is a middle-end problem.
It actually looks like a x86-64 target bug. FUNCTION_ARG returns (parallel:BLK [])
Subject: Bug 20795 CVSROOT: /cvs/gcc Module name: gcc Changes by: jakub@gcc.gnu.org 2005-04-09 17:09:49 Modified files: gcc : ChangeLog gcc/testsuite : ChangeLog gcc/config/i386: i386.c Added files: gcc/testsuite/g++.dg/abi: param2.C Log message: PR target/20795 * config/i386/i386.c (construct_container): Pass empty aligned struct, union or class in memory. * g++.dg/abi/param2.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8214&r2=2.8215 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5309&r2=1.5310 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&r1=1.805&r2=1.806 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/abi/param2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 20795 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: jakub@gcc.gnu.org 2005-04-09 17:15:34 Modified files: gcc : ChangeLog gcc/testsuite : ChangeLog gcc/config/i386: i386.c Added files: gcc/testsuite/g++.dg/abi: param2.C Log message: PR target/20795 * config/i386/i386.c (construct_container): Pass empty aligned struct, union or class in memory. * g++.dg/abi/param2.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.148&r2=2.7592.2.149 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.119&r2=1.5084.2.120 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.795.6.3&r2=1.795.6.4 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/abi/param2.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
Fixed.