Bug 20375 - [4.0 Regression] C++ ICE in assign_parm_find_entry_rtl
Summary: [4.0 Regression] C++ ICE in assign_parm_find_entry_rtl
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Richard Henderson
URL:
Keywords: ice-on-valid-code, patch
Depends on:
Blocks:
 
Reported: 2005-03-08 01:50 UTC by Joseph S. Myers
Modified: 2005-04-17 06:40 UTC (History)
3 users (show)

See Also:
Host:
Target: alpha-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-04-15 22:57:58


Attachments
Further reduced testcase (79 bytes, text/plain)
2005-03-08 16:01 UTC, Nathan Sidwell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph S. Myers 2005-03-08 01:50:04 UTC
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() {}
Comment 1 Andrew Pinski 2005-03-08 01:54:32 UTC
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);
Comment 2 Nathan Sidwell 2005-03-08 16:01:29 UTC
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
Comment 3 GCC Commits 2005-03-10 15:04:57 UTC
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

Comment 4 GCC Commits 2005-03-10 15:11:39 UTC
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

Comment 5 Nathan Sidwell 2005-03-10 15:23:29 UTC
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.
Comment 6 Richard Henderson 2005-04-09 23:44:27 UTC
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.
Comment 7 Nathan Sidwell 2005-04-10 09:17:56 UTC
Bum. I will look at it this week. Changing the target arch field to alpha
Comment 8 Mark Mitchell 2005-04-17 04:51:17 UTC
Removed target milestone; alpha is not a primary or secondary platform.
Comment 9 GCC Commits 2005-04-17 06:19:24 UTC
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

Comment 10 Richard Henderson 2005-04-17 06:29:06 UTC
patch: http://gcc.gnu.org/ml/gcc-patches/2005-04/msg01881.html
Comment 11 Richard Henderson 2005-04-17 06:39:39 UTC
Fixed.