Bug 46058 - [4.5/4.6 Regression] gcc crashes with lvalue error on the following Code
Summary: [4.5/4.6 Regression] gcc crashes with lvalue error on the following Code
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.1
: P2 normal
Target Milestone: 4.5.2
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2010-10-17 17:05 UTC by Niklas Schnelle
Modified: 2010-12-03 18:44 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-10-27 22:55:58


Attachments
Preprocessed c++ source that triggers the Bug (186 bytes, text/plain)
2010-10-17 17:05 UTC, Niklas Schnelle
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Niklas Schnelle 2010-10-17 17:05:25 UTC
Created attachment 22070 [details]
Preprocessed c++ source that triggers the Bug

This is the output of "gcc -v -save-temps -c -o commands.o commands.cpp"
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-linux-gnu/4.5.1/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../configure --prefix=/usr --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-gnu-unique-object --enable-lto --enable-plugin --disable-multilib --disable-libstdcxx-pch --with-system-zlib --with-ppl --with-cloog --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
Thread model: posix
gcc version 4.5.1 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-o' 'commands.o' '-mtune=generic' '-march=pentiumpro'
 /usr/lib/gcc/i686-pc-linux-gnu/4.5.1/cc1plus -E -quiet -v -D_GNU_SOURCE commands.cpp -mtune=generic -march=pentiumpro -fpch-preprocess -o commands.ii
ignoring nonexistent directory "/usr/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../../include/c++/4.5.1
 /usr/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../../include/c++/4.5.1/i686-pc-linux-gnu
 /usr/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../../include/c++/4.5.1/backward
 /usr/local/include
 /usr/lib/gcc/i686-pc-linux-gnu/4.5.1/include
 /usr/lib/gcc/i686-pc-linux-gnu/4.5.1/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-o' 'commands.o' '-mtune=generic' '-march=pentiumpro'
 /usr/lib/gcc/i686-pc-linux-gnu/4.5.1/cc1plus -fpreprocessed commands.ii -quiet -dumpbase commands.cpp -mtune=generic -march=pentiumpro -auxbase-strip commands.o -version -o commands.s
GNU C++ (GCC) version 4.5.1 (i686-pc-linux-gnu)
	compiled by GNU C version 4.5.1, GMP version 5.0.1, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=97 --param ggc-min-heapsize=126654
GNU C++ (GCC) version 4.5.1 (i686-pc-linux-gnu)
	compiled by GNU C version 4.5.1, GMP version 5.0.1, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=97 --param ggc-min-heapsize=126654
Compiler executable checksum: 09c286d6478a532084f45ddd675021da
commands.cpp:12:67: internal compiler error: in lvalue_p_1, at cp/tree.c:156
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Niklas Schnelle 2010-10-17 17:07:03 UTC
Forgot to mention, it works with gcc 4.3 and clang
Comment 2 Andrew Pinski 2010-10-27 22:55:58 UTC
<<< Unknown tree: scope_ref
  struct StringLiterals
  dec >>>


StringLiterals is not dependent so the scope_ref should have been resolved.

4.3.2 gave:
t.cc:12: error: ‘StringLiterals::dec’ cannot appear in a constant-expression
t.cc:12: error: template argument 3 is invalid


But I think that is incorrect as that is a static field.

Note 4.5.0 20100401 (experimental) [trunk revision 157933]  accepted the code though.
Comment 3 H.J. Lu 2010-11-12 15:43:48 UTC
It is caused by revision 161559:

http://gcc.gnu.org/ml/gcc-cvs/2010-06/msg01477.html
Comment 4 Jason Merrill 2010-12-03 16:56:42 UTC
Author: jason
Date: Fri Dec  3 16:56:37 2010
New Revision: 167435

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167435
Log:
	PR c++/46058
	* tree.c (lvalue_kind) [SCOPE_REF]: Handle non-dependent case.

Added:
    trunk/gcc/testsuite/g++.dg/template/scope4.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/tree.c
    trunk/gcc/testsuite/ChangeLog
Comment 5 Jason Merrill 2010-12-03 18:44:07 UTC
Author: jason
Date: Fri Dec  3 18:44:04 2010
New Revision: 167438

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167438
Log:
	PR c++/46058
	* tree.c (lvalue_kind) [SCOPE_REF]: Handle non-dependent case.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/template/scope4.C
Modified:
    branches/gcc-4_5-branch/gcc/cp/ChangeLog
    branches/gcc-4_5-branch/gcc/cp/tree.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
Comment 6 Jason Merrill 2010-12-03 18:44:31 UTC
Fixed.