User account creation filtered due to spam.

Bug 7129 - [3.2 regression] ICE with min/max assignment operators (<?= and >?=)
Summary: [3.2 regression] ICE with min/max assignment operators (<?= and >?=)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.1
: P3 normal
Target Milestone: ---
Assignee: Mark Mitchell
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2002-06-25 18:06 UTC by jldavis+gcc
Modified: 2003-07-25 17:33 UTC (History)
4 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jldavis+gcc 2002-06-25 18:06:01 UTC
  Using the min/max-with-assignment operators (<?= and >?=; a GNU
  extension to C++) where one or both of the arguments are of
  aggregate type (struct/class), causes an internal error
  (Segmentation fault).  It doesn't matter if the relevant relational
  operator (< or >) has been defined for the types; an attempt to
  declare <?= or >?= itself for such types causes the error to occur
  on that line instead.  If primitive types are used (pointers count
  for this) for both types, the code compiles successfully if
  comparison is defined on both types, or gives the correct error if
  it isn't (e.g. char* and double).
  
  This doesn't occur with just <? and >?; interestingly, the
  assignment forms don't seem to actually be documented in the manual,
  but do work on primitive types.

Release:
3.1

Environment:
System: Linux pippin.cs.oberlin.edu 2.4.17 #15 Fri Feb 1 14:02:22 EST 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.1/configure --prefix=/usr/public --program-suffix=3

How-To-Repeat:
  Fortunately, this requires no includes or preprocessing.  Example:
// code starts here
struct s_t { };
void foo(void) { 
  s_t s; int i;
  s<?=i;
}
// output starts here
bugtest.cc: In function `void foo()':
bugtest.cc:4: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
// end.

  Also try trivial modifications: switching the args on line 4, using
  "s" for both of them, using "i" for both of them, removing the '=',
  etc.; this is mainly how I got the details in the Description.
Comment 1 jldavis+gcc 2002-06-25 18:06:01 UTC
Fix:
Fixed in GCC 3.3, GCC 3.4 with:

http://gcc.gnu.org/ml/gcc-patches/2003-02/msg00194.html
Comment 2 Kriang Lerdsuwanakij 2002-07-11 07:34:20 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
Comment 3 Wolfgang Bangerth 2003-01-22 21:07:23 UTC
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/7129
Date: Wed, 22 Jan 2003 21:07:23 -0600 (CST)

 This used to just give an error in 2.95, but ICEs ever since, so it's a 
 regression.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth             email:            bangerth@ticam.utexas.edu
                               www: http://www.ticam.utexas.edu/~bangerth/
 
 
Comment 4 Mark Mitchell 2003-01-28 02:10:34 UTC
Responsible-Changed-From-To: unassigned->mmitchel
Responsible-Changed-Why: Working on a fix.
Comment 5 Mark Mitchell 2003-02-04 07:23:14 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7129
Date: 4 Feb 2003 07:23:14 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2003-02-04 07:23:14
 
 Modified files:
 	gcc/cp         : ChangeLog call.c operators.def 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/ext: max.C 
 
 Log message:
 	PR c++/7129
 	* call.c (z_candidate): Add args.
 	(convert_class_to_reference): Set it.
 	(implicit_conversion): Tidy.
 	(add_candidate): Add args parameter.
 	(add_function_candidate): Adjust call to add_candidate.
 	(add_conv_candidate): Likewise.
 	(build_builtin_candidate): Likewise.
 	(build_user_type_conversion_1): Eliminate wasteful tree_cons
 	usage.
 	(build_new_function_call): Likewise.
 	(build_object_call): Likewise.
 	(add_candidates): New function.
 	(build_new_op): Use it.
 	(covert_like_real): Adjust call to build_over_call.
 	(build_over_call): Remove args parameter.
 	* operators.def: Add <?= and >?=.
 	
 	PR c++/7129
 	* testsuite/g++.dg/ext/max.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3190&r2=1.3191
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.354&r2=1.355
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/operators.def.diff?cvsroot=gcc&r1=1.12&r2=1.13
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2392&r2=1.2393
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/max.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 6 Mark Mitchell 2003-02-04 07:23:14 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7129
Date: 4 Feb 2003 07:23:14 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2003-02-04 07:23:14
 
 Modified files:
 	gcc/cp         : ChangeLog call.c operators.def 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/ext: max.C 
 
 Log message:
 	PR c++/7129
 	* call.c (z_candidate): Add args.
 	(convert_class_to_reference): Set it.
 	(implicit_conversion): Tidy.
 	(add_candidate): Add args parameter.
 	(add_function_candidate): Adjust call to add_candidate.
 	(add_conv_candidate): Likewise.
 	(build_builtin_candidate): Likewise.
 	(build_user_type_conversion_1): Eliminate wasteful tree_cons
 	usage.
 	(build_new_function_call): Likewise.
 	(build_object_call): Likewise.
 	(add_candidates): New function.
 	(build_new_op): Use it.
 	(covert_like_real): Adjust call to build_over_call.
 	(build_over_call): Remove args parameter.
 	* operators.def: Add <?= and >?=.
 	
 	PR c++/7129
 	* testsuite/g++.dg/ext/max.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3190&r2=1.3191
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.354&r2=1.355
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/operators.def.diff?cvsroot=gcc&r1=1.12&r2=1.13
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2392&r2=1.2393
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/max.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 9 Eric Botcazou 2003-02-08 23:03:36 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed. See http://gcc.gnu.org/ml/gcc-patches/2003-02/msg00194.html