Bug 30847 - [4.1/4.2/4.3 regression] ICE with invalid statement expression
Summary: [4.1/4.2/4.3 regression] ICE with invalid statement expression
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P2 normal
Target Milestone: 4.1.3
Assignee: Jakub Jelinek
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-invalid-code, monitored
Depends on:
Blocks: 30158
  Show dependency treegraph
 
Reported: 2007-02-18 22:37 UTC by Volker Reichelt
Modified: 2007-04-08 13:33 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-03-20 09:12:23


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2007-02-18 22:37:25 UTC
The follwoing code snippet triggers an ICE since GCC 4.0.0:

=====================================
void foo(int i)
{
  (i ? 1 : 2) = ({ int X; });
}
=====================================

bug.cc: In function 'void foo(int)':
bug.cc:3: internal compiler error: in build_target_expr_with_type, at cp/tree.c:382
Please submit a full bug report, [etc.]

The problem is similar to PR 30158, but alas not fixed with Andrew's patch.
It's even worse because it's not an error-recovery bug.
Comment 1 Wolfgang Bangerth 2007-03-09 04:16:46 UTC
Confirmed.
Comment 2 Jakub Jelinek 2007-04-03 10:08:14 UTC
Subject: Bug 30847

Author: jakub
Date: Tue Apr  3 10:08:00 2007
New Revision: 123456

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123456
Log:
	PR c++/30847
	* typeck.c (build_modify_expr): For COND_EXPR on LHS, if RHS has void
	type issue error and return early.

	* g++.dg/parse/cond3.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/parse/cond3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Jakub Jelinek 2007-04-03 10:25:43 UTC
Subject: Bug 30847

Author: jakub
Date: Tue Apr  3 10:25:31 2007
New Revision: 123461

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123461
Log:
	PR c++/30847
	* typeck.c (build_modify_expr): For COND_EXPR on LHS, if RHS has void
	type issue error and return early.

	* g++.dg/parse/cond3.C: New test.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/parse/cond3.C
Modified:
    branches/gcc-4_2-branch/gcc/cp/ChangeLog
    branches/gcc-4_2-branch/gcc/cp/typeck.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog

Comment 4 Jakub Jelinek 2007-04-03 10:28:46 UTC
Subject: Bug 30847

Author: jakub
Date: Tue Apr  3 10:28:35 2007
New Revision: 123462

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123462
Log:
	PR c++/30847
	* typeck.c (build_modify_expr): For COND_EXPR on LHS, if RHS has void
	type issue error and return early.

	* g++.dg/parse/cond3.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/parse/cond3.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/typeck.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 5 Jakub Jelinek 2007-04-03 12:34:12 UTC
Fixed.