Bug 53599 - [4.7/4.8 Regression] gcc-4.7.1_rc20120606 segfaults compiling boost.karma
Summary: [4.7/4.8 Regression] gcc-4.7.1_rc20120606 segfaults compiling boost.karma
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.7.1
: P1 normal
Target Milestone: 4.7.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 53620 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-06-06 21:43 UTC by Philipp
Modified: 2012-06-20 07:21 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.7.0
Known to fail: 4.7.1, 4.8.0
Last reconfirmed: 2012-06-07 00:00:00


Attachments
Preprocessed source (331.48 KB, application/octet-stream)
2012-06-06 21:45 UTC, Philipp
Details
Reduced testcase (380 bytes, text/plain)
2012-06-07 09:14 UTC, Philipp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp 2012-06-06 21:43:00 UTC
The attached preprocessed source makes the first release candidate of gcc-4.7 segfault, gcc-4.7.0 was fine. No additional compilation options are required. I have just spotted this and not begun to try to reduce the testcase.
Comment 1 Philipp 2012-06-06 21:45:30 UTC
Created attachment 27574 [details]
Preprocessed source
Comment 2 Jakub Jelinek 2012-06-07 08:05:42 UTC
Caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188117
i.e. a very recent regression on 4.7 branch and trunk.
Comment 3 Philipp 2012-06-07 09:14:56 UTC
Created attachment 27575 [details]
Reduced testcase
Comment 4 Jakub Jelinek 2012-06-07 09:36:26 UTC
Even shorter (but invalid):
template <bool T>
struct C
{
};

template <typename T>
struct E
{
  static bool const value = true;
};

template <typename T>
int
foo ()
{
  struct F;
  struct G
  {
    static int *(F::*bar ()) (T)
    {
    }
  };
  enum
  {
    I = sizeof (C <((E <T>::value))> (G::bar ()))
  };
  return 1;
}

int z = foo <int> ();
Comment 5 Jason Merrill 2012-06-07 15:49:38 UTC
I think for 4.7.1 let's just revert that patch.
Comment 6 Jakub Jelinek 2012-06-08 06:43:51 UTC
Yeah, I agree with that.
Comment 7 Jakub Jelinek 2012-06-11 09:14:46 UTC
*** Bug 53620 has been marked as a duplicate of this bug. ***
Comment 8 Richard Biener 2012-06-12 12:47:31 UTC
Can someone please revert it on the branch at least?  Thx.
Comment 9 Jason Merrill 2012-06-12 15:01:29 UTC
Author: jason
Date: Tue Jun 12 15:01:17 2012
New Revision: 188460

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188460
Log:
	PR c++/53599
	Revert:
	PR c++/53137
	* pt.c (instantiate_class_template_1): Set LAMBDA_EXPR_THIS_CAPTURE.
	(instantiate_decl): Don't push_to_top_level for local class methods.
	(instantiate_class_template_1): Or for local classes.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/template/local7.C
Removed:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template5.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/pt.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
Comment 10 Jason Merrill 2012-06-12 18:32:10 UTC
Author: jason
Date: Tue Jun 12 18:32:04 2012
New Revision: 188473

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188473
Log:
	PR c++/53599
	* name-lookup.c (pushtag_1): Add a DECL_EXPR for a local class.
	* semantics.c (finish_cond): Build a COMPOUND_EXPR.
	* pt.c (tsubst_expr) [COMPOUND_EXPR]: Handle.
	[DECL_EXPR]: Don't call cp_finish_decl for an implicit typedef.
	Don't return the decl.

Added:
    trunk/gcc/testsuite/g++.dg/template/local7.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/name-lookup.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog
Comment 11 Richard Biener 2012-06-13 12:04:13 UTC
Fixed.
Comment 12 Jason Merrill 2012-06-20 07:21:46 UTC
Author: jason
Date: Wed Jun 20 07:21:40 2012
New Revision: 188809

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188809
Log:
	PR c++/53599
	* pt.c (lookup_template_class_1): Use ts_global.

Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/pt.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog