User account creation filtered due to spam.

Bug 48265 - [4.6/4.7 Regression] [C++0x] ICE: SIGSEGV (recursion in value_dependent_expression_p) when variable is used uninitialised
Summary: [4.6/4.7 Regression] [C++0x] ICE: SIGSEGV (recursion in value_dependent_expre...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.6.1
Assignee: Jason Merrill
URL:
Keywords: ice-on-valid-code
: 46870 46871 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-03-24 00:05 UTC by Zdenek Sojka
Modified: 2011-05-02 16:07 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.5.3
Known to fail: 4.6.0, 4.7.0
Last reconfirmed: 2011-03-29 21:14:12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2011-03-24 00:05:54 UTC
Looks similiar to PR46870, but this code is valid:

------- testcase.C -------
template < int > struct S
{
  S () { int i = i; i; };
};
--------------------------

Compiler output:
$ gcc -std=gnu++0x testcase.C
Program received signal SIGSEGV, Segmentation fault.
0x000000000054e883 in value_dependent_expression_p (expression=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:18065
18065     if (DECL_P (expression) && type_dependent_expression_p (expression))
(gdb) bt
#0  0x000000000054e883 in value_dependent_expression_p (expression=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:18065
#1  0x000000000054ea7e in value_dependent_expression_p (expression=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:18233
#2  0x000000000054ea7e in value_dependent_expression_p (expression=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:18233
#3  0x000000000054ea7e in value_dependent_expression_p (expression=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:18233
#4  0x000000000054ea7e in value_dependent_expression_p (expression=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:18233
#5  0x000000000054ea7e in value_dependent_expression_p (expression=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:18233
#6  0x000000000054ea7e in value_dependent_expression_p (expression=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:18233
#7  0x000000000054ea7e in value_dependent_expression_p (expression=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:18233
#8  0x000000000054ea7e in value_dependent_expression_p (expression=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:18233
#9  0x000000000054ea7e in value_dependent_expression_p (expression=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:18233
...
Comment 1 Jason Merrill 2011-03-29 21:14:12 UTC
Got it.
Comment 2 Jason Merrill 2011-03-30 02:16:27 UTC
Author: jason
Date: Wed Mar 30 02:16:22 2011
New Revision: 171714

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171714
Log:
	PR c++/48265
	* pt.c (value_dependent_expression_p) [VAR_DECL]: Make sure
	the variable is constant before looking at its initializer.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/regress/value-dep1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Jason Merrill 2011-03-30 02:16:44 UTC
Author: jason
Date: Wed Mar 30 02:16:37 2011
New Revision: 171715

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171715
Log:
	PR c++/48265
	* pt.c (value_dependent_expression_p) [VAR_DECL]: Make sure
	the variable is constant before looking at its initializer.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/regress/value-dep1.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/pt.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 4 Jason Merrill 2011-03-30 02:35:48 UTC
*** Bug 46870 has been marked as a duplicate of this bug. ***
Comment 5 Jason Merrill 2011-03-30 02:36:43 UTC
Fixed for 4.6.1.
Comment 6 Paolo Carlini 2011-05-02 16:07:56 UTC
*** Bug 46871 has been marked as a duplicate of this bug. ***