Bug 28266 - [4.1 regression] ICE on invalid default variable
Summary: [4.1 regression] ICE on invalid default variable
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P4 normal
Target Milestone: 4.2.0
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
: 30295 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-07-05 12:19 UTC by Volker Reichelt
Modified: 2008-07-04 15:39 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.2.0
Known to fail: 4.0.4 4.1.3
Last reconfirmed: 2006-09-03 06:33:35


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-07-05 12:19:21 UTC
The following invalid code snippet triggers an ICE since GCC 4.0.0:

====================
struct A
{
  int i;
  A(int = X);
};

void foo()
{
  A().i;
}
====================

bug.cc:4: error: 'X' was not declared in this scope
bug.cc: In function 'void foo()':
bug.cc:9: internal compiler error: in gimple_add_tmp_var, at gimplify.c:720
Please submit a full bug report, [etc.]
Comment 1 Andrew Pinski 2006-09-03 06:33:35 UTC
Confirmed.
Comment 2 patchapp@dberlin.org 2006-09-10 07:55:30 UTC
Subject: Bug number PR c++/28266

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-09/msg00367.html
Comment 3 Jason Merrill 2007-01-29 16:27:39 UTC
Subject: Bug 28266

Author: jason
Date: Mon Jan 29 16:27:21 2007
New Revision: 121288

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121288
Log:
        PR c++/28266
        * gimplify.c (gimplify_target_expr): Make sure that the TARGET_EXPR is
        expanded only once even if an error occurs.

Added:
    trunk/gcc/testsuite/g++.dg/parse/defarg12.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Volker Reichelt 2007-02-01 20:11:22 UTC
Fixed on mainline.
Comment 5 Volker Reichelt 2007-02-01 20:12:24 UTC
*** Bug 30295 has been marked as a duplicate of this bug. ***
Comment 6 Jason Merrill 2007-02-02 18:01:51 UTC
Subject: Bug 28266

Author: jason
Date: Fri Feb  2 18:01:22 2007
New Revision: 121514

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121514
Log:
        PR c++/28266
        * gimplify.c (gimplify_target_expr): Make sure that the TARGET_EXPR is
        expanded only once even if an error occurs.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/parse/defarg12.C
      - copied unchanged from r121288, trunk/gcc/testsuite/g++.dg/parse/defarg12.C
Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/gimplify.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog

Comment 7 Gabriel Dos Reis 2007-02-03 17:54:26 UTC
Won't fix in GCC-4.0.x.  Adjusting milestone.
Comment 8 Paolo Carlini 2007-07-08 14:34:41 UTC
Not a 4.2 regression anymore.
Comment 9 Joseph S. Myers 2008-07-04 15:39:26 UTC
Closing 4.1 branch.