public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/37087] New: Segfault on compiling template defined in wrong namespace.
@ 2008-08-11 22:24 gcc-bugzilla at gcc dot gnu dot org
2008-08-11 22:43 ` [Bug c++/37087] " paolo dot carlini at oracle dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2008-08-11 22:24 UTC (permalink / raw)
To: gcc-bugs
G++ reports a segmentation fault when compiling the code below.
Environment:
System: Linux temporal.corp.google.com 2.6.18.5-gg34workstation-mixed64-32 #1
SMP Thu May 8 01:31:23 UTC 2008 x86_64 GNU/Linux
Architecture: x86_64
host: i486-pc-linux-gnu
build: i486-pc-linux-gnu
target: i486-pc-linux-gnu
configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr
--disable-werror --with-tune=pentium4 --enable-checking=release i486-linux-gnu
How-To-Repeat:
Invoke g++ on the following (invalid) code with no other arguments.
There are no #includes; this is the entire source file.
======================
namespace a {
template <typename T> class Foo;
}
namespace b {
template <> class ::a::Foo<double> {};
}
======================
(The gccbug script claims it will remove "comments" delimited by angle
brackets.
Hopefully that isn't actually true because it will mess up the above code
sample as well as the following error log.)
Result:
testtemplate.cc:6: error: global qualification of class name is invalid before
'{' token
testtemplate.cc:6: error: specialization of 'template<class T> struct a::Foo'
in different namespace
testtemplate.cc:2: error: from definition of 'template<class T> struct
a::Foo'
g++: Internal error: Segmentation fault (program cc1plus)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions, see
<URL:file:///usr/share/doc/gcc-4.0/README.Bugs>.
------- Comment #1 from kenton at google dot com 2008-08-11 22:23 -------
Fix:
Unknown.
--
Summary: Segfault on compiling template defined in wrong
namespace.
Product: gcc
Version: 4.0.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kenton at google dot com
GCC build triplet: i486-pc-linux-gnu
GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37087
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/37087] Segfault on compiling template defined in wrong namespace.
2008-08-11 22:24 [Bug c++/37087] New: Segfault on compiling template defined in wrong namespace gcc-bugzilla at gcc dot gnu dot org
@ 2008-08-11 22:43 ` paolo dot carlini at oracle dot com
2008-08-12 19:40 ` paolo at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-11 22:43 UTC (permalink / raw)
To: gcc-bugs
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |paolo dot carlini at oracle
|dot org |dot com
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Keywords| |ice-on-invalid-code
Known to fail| |4.3.1 4.4.0
Last reconfirmed|0000-00-00 00:00:00 |2008-08-11 22:41:51
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37087
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/37087] Segfault on compiling template defined in wrong namespace.
2008-08-11 22:24 [Bug c++/37087] New: Segfault on compiling template defined in wrong namespace gcc-bugzilla at gcc dot gnu dot org
2008-08-11 22:43 ` [Bug c++/37087] " paolo dot carlini at oracle dot com
@ 2008-08-12 19:40 ` paolo at gcc dot gnu dot org
2008-08-12 19:47 ` paolo dot carlini at oracle dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: paolo at gcc dot gnu dot org @ 2008-08-12 19:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from paolo at gcc dot gnu dot org 2008-08-12 19:39 -------
Subject: Bug 37087
Author: paolo
Date: Tue Aug 12 19:38:02 2008
New Revision: 139034
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=139034
Log:
/cp
2008-08-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37087
* parser.c (cp_parser_class_head): Early return error_mark_node in
case of global qualification of class name or qualified name that
does not name a class.
/testsuite
2008-08-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37087
* g++.dg/template/crash80.C: New.
* g++.old-deja/g++.other/decl5.C: Adjust.
Added:
trunk/gcc/testsuite/g++.dg/template/crash80.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/parser.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.old-deja/g++.other/decl5.C
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37087
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/37087] Segfault on compiling template defined in wrong namespace.
2008-08-11 22:24 [Bug c++/37087] New: Segfault on compiling template defined in wrong namespace gcc-bugzilla at gcc dot gnu dot org
2008-08-11 22:43 ` [Bug c++/37087] " paolo dot carlini at oracle dot com
2008-08-12 19:40 ` paolo at gcc dot gnu dot org
@ 2008-08-12 19:47 ` paolo dot carlini at oracle dot com
2008-08-13 16:26 ` bangerth at dealii dot org
2008-08-13 16:30 ` paolo dot carlini at oracle dot com
4 siblings, 0 replies; 6+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-12 19:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from paolo dot carlini at oracle dot com 2008-08-12 19:45 -------
Fixed for 4.4.0.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|paolo dot carlini at oracle |unassigned at gcc dot gnu
|dot com |dot org
Status|ASSIGNED |NEW
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37087
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/37087] Segfault on compiling template defined in wrong namespace.
2008-08-11 22:24 [Bug c++/37087] New: Segfault on compiling template defined in wrong namespace gcc-bugzilla at gcc dot gnu dot org
` (2 preceding siblings ...)
2008-08-12 19:47 ` paolo dot carlini at oracle dot com
@ 2008-08-13 16:26 ` bangerth at dealii dot org
2008-08-13 16:30 ` paolo dot carlini at oracle dot com
4 siblings, 0 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2008-08-13 16:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from bangerth at dealii dot org 2008-08-13 16:24 -------
This also failed with 4.2.1, and the reporter's compiler was 4.0.
Paolo, do you want to apply your patch to 4.3.x as well? If not,
I vote for closing the PR: It's not a recent regression, it's an
ICE on invalid, and unless you apply the patch there is unlikely
going to be any further activity.
W.
--
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bangerth at dealii dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37087
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/37087] Segfault on compiling template defined in wrong namespace.
2008-08-11 22:24 [Bug c++/37087] New: Segfault on compiling template defined in wrong namespace gcc-bugzilla at gcc dot gnu dot org
` (3 preceding siblings ...)
2008-08-13 16:26 ` bangerth at dealii dot org
@ 2008-08-13 16:30 ` paolo dot carlini at oracle dot com
4 siblings, 0 replies; 6+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-13 16:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from paolo dot carlini at oracle dot com 2008-08-13 16:29 -------
Let's close it, as you say it's invalid code, not a regression.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37087
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-08-13 16:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-11 22:24 [Bug c++/37087] New: Segfault on compiling template defined in wrong namespace gcc-bugzilla at gcc dot gnu dot org
2008-08-11 22:43 ` [Bug c++/37087] " paolo dot carlini at oracle dot com
2008-08-12 19:40 ` paolo at gcc dot gnu dot org
2008-08-12 19:47 ` paolo dot carlini at oracle dot com
2008-08-13 16:26 ` bangerth at dealii dot org
2008-08-13 16:30 ` paolo dot carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).