Bug 35440 - [4.1/4.2/4.3/4.4 regression] ICE resulting in completely broken diagnostic
Summary: [4.1/4.2/4.3/4.4 regression] ICE resulting in completely broken diagnostic
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.4.0
: P4 normal
Target Milestone: 4.1.3
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2008-03-03 21:18 UTC by Volker Reichelt
Modified: 2008-04-04 13:14 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-03-15 01:36:18


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2008-03-03 21:18:08 UTC
The following invalid code snippet triggers an ICE since GCC 4.1.0:

================================
struct A {};

void foo()
{
  (struct A){}();
}
================================

The compiler crashes trying to emit an error message, which results in a
completely broken diagnostic (e.g. file name and "internal compiler error"
message are missing):

'{
In function 'foo':
tree check: expected class 'expression', have 'exceptional' (constructor) in pp_c_initializer_list, at c-pretty-print.c:1182
Please submit a full bug report, [etc.]

Before GCC 4.1.0 we got the error message:
bug.c: In function 'foo':
bug.c:5: error: called object '{}' is not a function
Comment 1 andreasmeier80 2008-03-21 16:07:35 UTC
Patch at http://gcc.gnu.org/ml/gcc-patches/2008-03/msg01158.html
Comment 2 Jakub Jelinek 2008-04-04 13:08:13 UTC
Subject: Bug 35440

Author: jakub
Date: Fri Apr  4 13:07:27 2008
New Revision: 133897

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133897
Log:
	PR c/35440
	* c-pretty-print.c (pp_c_initializer_list): Handle CONSTRUCTOR
	for all types.

	* gcc.dg/pr35440.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr35440.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-pretty-print.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Jakub Jelinek 2008-04-04 13:13:42 UTC
Subject: Bug 35440

Author: jakub
Date: Fri Apr  4 13:12:58 2008
New Revision: 133899

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133899
Log:
	PR c/35440
	* c-pretty-print.c (pp_c_initializer_list): Handle CONSTRUCTOR
	for all types.

	* gcc.dg/pr35440.c: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/pr35440.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/c-pretty-print.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog

Comment 4 Jakub Jelinek 2008-04-04 13:14:56 UTC
Fixed.