The following C++ testcase, compiled on ia64-hp-hpux11.23 with -mlp64, yields the following ICE (a regression in 4.0/4.1 relative to 3.4). This seems to be target-specific. t.cc: In member function 'virtual void*& c::f(float, u, ...)': t.cc:9: internal compiler error: in assign_parm_find_entry_rtl, at function.c:2329 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. union u { void* m[7]; }; struct c { c(); virtual void*& f(float, u, ...) { throw 0; } }; c::c() {}
This could either be a target bug or a middle-end bug. I am aiming for a target bug: /* We assume at most one partial arg, and it must be the first argument on the stack. */ gcc_assert (!all->extra_pretend_bytes && !all->pretend_args_size);
Created attachment 8362 [details] Further reduced testcase Further reduced testcase with nearly all C++isms removed. the remaining one -- not naming the union argument -- is crucial to manifesting the ICE
Subject: Bug 20375 CVSROOT: /cvs/gcc Module name: gcc Changes by: nathan@gcc.gnu.org 2005-03-10 15:04:39 Modified files: gcc : ChangeLog function.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/other: stdarg3.C Log message: PR c++/20375 * function.c (struct assign_parm_data_one): Remove last_named field. (assign_parm_find_data_types): Don't determine last_named. Reorder named_parm determination. (assign_parms): Only setup varargs on the last non-varadic parameter. testsuite: PR c++/20375 * g++.dg/other/stdarg3.C: New. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7768&r2=2.7769 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.c.diff?cvsroot=gcc&r1=1.605&r2=1.606 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5137&r2=1.5138 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/stdarg3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 20375 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: nathan@gcc.gnu.org 2005-03-10 15:11:25 Modified files: gcc : ChangeLog function.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/other: stdarg3.C Log message: PR c++/20375 * function.c (struct assign_parm_data_one): Remove last_named field. (assign_parm_find_data_types): Don't determine last_named. Reorder named_parm determination. (assign_parms): Only setup varargs on the last non-varadic parameter. testsuite: PR c++/20375 * g++.dg/other/stdarg3.C: New. 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.36&r2=2.7592.2.37 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.604&r2=1.604.8.1 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.32&r2=1.5084.2.33 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/stdarg3.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
2005-03-10 Nathan Sidwell <nathan@codesourcery.com> PR c++/20375 * function.c (struct assign_parm_data_one): Remove last_named field. (assign_parm_find_data_types): Don't determine last_named. Reorder named_parm determination. (assign_parms): Only setup varargs on the last non-varadic parameter.
Nathan, this patch is causing problems on Alpha. In particular, we now run assign_parms_setup_varargs before processing the last named argument (union U in this test case). Which yields an abort in assign_parm_find_entry_rtl at line 2319, due to finding a partial-stack argument while pretend_args_size is already set.
Bum. I will look at it this week. Changing the target arch field to alpha
Removed target milestone; alpha is not a primary or secondary platform.
Subject: Bug 20375 CVSROOT: /cvs/gcc Module name: gcc Changes by: rth@gcc.gnu.org 2005-04-17 06:19:18 Modified files: gcc : ChangeLog gcc/config/alpha: alpha.c Log message: PR target/20375 * config/alpha/alpha.c (alpha_setup_incoming_varargs): Advance a copy of CUMULATIVE_ARGS past the last named argument. (alpha_va_start): Expect pretend_args_size only if strictly less than 6 named arguments. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8328&r2=2.8329 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/alpha/alpha.c.diff?cvsroot=gcc&r1=1.415&r2=1.416
patch: http://gcc.gnu.org/ml/gcc-patches/2005-04/msg01881.html
Fixed.