Bug 26558 - [4.0/4.1/4.2 Regression] segfault on syntax error
Summary: [4.0/4.1/4.2 Regression] segfault on syntax error
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.3
: P3 normal
Target Milestone: 4.0.4
Assignee: Volker Reichelt
URL:
Keywords: ice-checking, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2006-03-04 15:51 UTC by Debian GCC Maintainers
Modified: 2006-04-19 22:12 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.2.0 4.0.0 4.1.0 3.4.0
Last reconfirmed: 2006-03-04 16:01:24


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Debian GCC Maintainers 2006-03-04 15:51:38 UTC
[forwarded from http://bugs.debian.org/349087]

g++ (GCC) 4.0.3 20060212 (prerelease) (Debian 4.0.2-9)

falk@gluck:~% cat main.cpp 
template <typename T> class C {
        template <int NO> int fun() { return NO;}
        template <int NO> int fun2() {
                return 0 << fun<NO>::; //bad code of course here :)
        }
};
falk@gluck:~% g++ -c main.cpp 
main.cpp: In member function 'int C<T>::fun2()':
main.cpp:4: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Does not occur on alpha-linux-gnu, or with 3.3.6.
Comment 1 Andrew Pinski 2006-03-04 15:55:04 UTC
Hmm, works with 4.1.0 20060208 on x86_64.
Comment 2 Andrew Pinski 2006-03-04 15:55:24 UTC
And "4.0.3 20051105" on x86_64.
Comment 3 Andrew Pinski 2006-03-04 15:56:12 UTC
But not with "4.2.0 20060304" on x86_64:
t.cc: In member function ‘int C<T>::fun2()’:
t.cc:4: internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in cp_parser_class_name, at cp/parser.c:12746
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


Must had been a change between there and today that caused it.
Comment 4 Andrew Pinski 2006-03-04 16:01:24 UTC
Actually it fails with checking since 3.4.0 so confirmed.
Comment 5 Volker Reichelt 2006-04-19 13:25:55 UTC
Testing a patch.
Comment 6 patchapp@dberlin.org 2006-04-19 21:35:18 UTC
Subject: Bug number PR c++/26558

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-04/msg00725.html
Comment 7 Volker Reichelt 2006-04-19 22:03:29 UTC
Subject: Bug 26558

Author: reichelt
Date: Wed Apr 19 22:03:24 2006
New Revision: 113096

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113096
Log:
	PR c++/26558
	* parser.c (cp_parser_class_name): Check for invalid typenames.
	Rearrange code.

	* g++.dg/parse/template19.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/parse/template19.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog

Comment 8 Volker Reichelt 2006-04-19 22:07:30 UTC
Subject: Bug 26558

Author: reichelt
Date: Wed Apr 19 22:07:25 2006
New Revision: 113097

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113097
Log:
	PR c++/26558
	* parser.c (cp_parser_class_name): Check for invalid typenames.
	Rearrange code.

	* g++.dg/parse/template19.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/parse/template19.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/parser.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 9 Volker Reichelt 2006-04-19 22:10:15 UTC
Subject: Bug 26558

Author: reichelt
Date: Wed Apr 19 22:10:10 2006
New Revision: 113098

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113098
Log:
	PR c++/26558
	* parser.c (cp_parser_class_name): Check for invalid typenames.
	Rearrange code.

	* g++.dg/parse/template19.C: New test.

Added:
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/parse/template19.C
Modified:
    branches/gcc-4_0-branch/gcc/cp/ChangeLog
    branches/gcc-4_0-branch/gcc/cp/parser.c
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog

Comment 10 Volker Reichelt 2006-04-19 22:12:10 UTC
Fixed on mainline, 4.1 branch, and 4.0 branch.