Bug 58188 - ICE in gimple_add_tmp_var, at gimplify.c:738
Summary: ICE in gimple_add_tmp_var, at gimplify.c:738
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.1
: P3 normal
Target Milestone: 4.9.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: NSDMI
  Show dependency treegraph
 
Reported: 2013-08-18 11:37 UTC by Konstantin Isakov
Modified: 2013-11-15 23:55 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-08-20 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Isakov 2013-08-18 11:37:50 UTC
The following code causes an ICE:

============ test.cc =============
struct B {};
struct A
{
  A( B );
};

struct Bar
{
  template< unsigned v >
  struct Foo
  {
    A z = B();
    unsigned value;
    Foo(): value( v ) {}
  };

  struct Baz
  {
    Foo< 8 > foo1;
    Foo< 1 > foo3;
  };
};

Bar::Baz baz;
===============================


$ g++-4.8 -c -std=c++11 test.cc 
test.cc: In constructor ‘Bar::Foo<v>::Foo() [with unsigned int v = 1u]’:
test.cc:14:21: internal compiler error: in gimple_add_tmp_var, at gimplify.c:738
     Foo(): value( v ) {}
                     ^
...

P.S. This might possibly be related to bug 58187.
Comment 1 Marek Polacek 2013-08-20 06:18:37 UTC
Hm, I can't seem to reproduce it.  Is this vanilla gcc?
Comment 2 Jakub Jelinek 2013-08-20 08:11:34 UTC
I can reproduce it, though with checking compilers the ICE is usually much earlier (pt.c or so).  ICEs from around r179155 or so when NSDMIs were implemented, so not sure we can consider it a regression.
Comment 3 Paolo Carlini 2013-11-15 23:40:35 UTC
This is also fixed in mainline. I'm adding the testcase and closing the bug.
Comment 4 paolo@gcc.gnu.org 2013-11-15 23:51:24 UTC
Author: paolo
Date: Fri Nov 15 23:51:23 2013
New Revision: 204881

URL: http://gcc.gnu.org/viewcvs?rev=204881&root=gcc&view=rev
Log:
2013-11-15  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58188
	* g++.dg/cpp0x/nsdmi-template8.C: New.

2013-11-15  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58725
	* g++.dg/cpp0x/nsdmi-template7.C: New.

2013-11-15  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58829
	* g++.dg/cpp0x/nsdmi-template6.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-template6.C
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-template7.C
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-template8.C
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 5 Paolo Carlini 2013-11-15 23:55:09 UTC
Done.