public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14507] New: [3.1/3.2/3.2.2/3.2.3/3.3.2/3.3.3 Regression From 2.95.2/2.95.3] Wacky Template ICE
@ 2004-03-09 19:25 stl at caltech dot edu
2004-03-09 19:41 ` [Bug c++/14507] [3.3 Regression] " pinskia at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: stl at caltech dot edu @ 2004-03-09 19:25 UTC (permalink / raw)
To: gcc-bugs
This bug was found by John Saalweachter, saalweaj@purdue.edu ; I reduced the
test case and agreed to submit a PR. I have no clue whether the test case is
valid or not.
The following test case ICEs when compiled with g++ -c:
template <typename A, typename B = int, typename C = int, typename D = int>
struct c : virtual c<A, B> { };
template <typename A, typename B, typename C>
struct c<A, B, C, int> : c<A, B> {
c() : c() { }
};
I observe the ICE with:
i686-pc-linux-gnu 3.3.2
sparc-sun-solaris2.7 3.2.3
i686-pc-linux-gnu 3.2.2
i386-redhat-linux 3.2.2
i686-pc-linux-gnu 3.1
i686-pc-linux-gnu 3.2
John Saalweachter observes the ICE with:
i686-pc-linux-gnu 3.3.3
i386-slackware-linux 3.2
i486-slackware-linux 3.2.3
All of these ICEs occur with no other output. For example, my i686-pc-linux-
gnu 3.3.2 emits:
g++: Internal error: Segmentation fault (program cc1plus)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
I observe a clean compile (no ICE, no complaining) with:
i686-pc-linux-gnu 2.95.3
John Saalweachter also observes a clean compile with:
sparc-sun-solaris2.8 2.95.2
Here are three less reduced test cases that also ICE (on my i686-pc-linux-gnu
3.3.2; I don't know about other systems for these test cases):
[FIRST]
struct s { };
s foo;
template <typename T, s &i0 = foo, s &i1 = foo, s &i2 = foo>
class c : virtual public c<T, i0> { };
template <typename T, s &i0, s &i1>
class c<T, i0, i1, foo> : public c<T, i0> {
public:
c (const T &i) : c<T> (i) { }
};
[SECOND]
struct s { };
template <typename T, typename i0 = s, typename i1 = s, typename i2 = s>
class c : virtual public c<T, i0> { };
template <typename T, typename i0, typename i1>
class c<T, i0, i1, s> : public c<T, i0> {
public:
c (const T &i) : c<T> (i) { }
};
[THIRD]
struct s { };
template <typename A, typename B = s, typename C = s, typename D = s>
struct c : virtual c<A, B> { };
template <typename A, typename B, typename C>
struct c<A, B, C, s> : c<A, B> {
c(const A &i) : c<A> (i) { }
};
--
Summary: [3.1/3.2/3.2.2/3.2.3/3.3.2/3.3.3 Regression From
2.95.2/2.95.3] Wacky Template ICE
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: stl at caltech dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14507
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/14507] [3.3 Regression] Wacky Template ICE
2004-03-09 19:25 [Bug c++/14507] New: [3.1/3.2/3.2.2/3.2.3/3.3.2/3.3.3 Regression From 2.95.2/2.95.3] Wacky Template ICE stl at caltech dot edu
@ 2004-03-09 19:41 ` pinskia at gcc dot gnu dot org
2004-03-09 20:36 ` bangerth at dealii dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-09 19:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-09 19:41 -------
Confirmed, a regression from 2.95.3, note 3.4.0 and the mainline is already fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |ice-on-valid-code
Known to fail| |3.0.4 3.3.1 3.2.3
Known to work| |3.4.0 3.5.0 2.95.3
Last reconfirmed|0000-00-00 00:00:00 |2004-03-09 19:41:54
date| |
Summary|[3.1/3.2/3.2.2/3.2.3/3.3.2/3|[3.3 Regression] Wacky
|.3.3 Regression From |Template ICE
|2.95.2/2.95.3] Wacky |
|Template ICE |
Target Milestone|--- |3.3.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14507
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/14507] [3.3 Regression] Wacky Template ICE
2004-03-09 19:25 [Bug c++/14507] New: [3.1/3.2/3.2.2/3.2.3/3.3.2/3.3.3 Regression From 2.95.2/2.95.3] Wacky Template ICE stl at caltech dot edu
2004-03-09 19:41 ` [Bug c++/14507] [3.3 Regression] " pinskia at gcc dot gnu dot org
@ 2004-03-09 20:36 ` bangerth at dealii dot org
2004-04-01 19:40 ` bangerth at dealii dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2004-03-09 20:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-03-09 20:36 -------
Wow, yes, this _is_ wacky. However, it should be legal.
Not surprisingly, the cause of death of previous compilers is due to
memory starvation after expanding like a dying star on my machine. What
happens is that apparently it tries to expand the inheritance tree without
seeing that there is a partial specialization around. For, if I change the
example to this:
-----------------
template <typename A, typename B = int, typename C = int, typename D = int>
struct c;
template <typename A, typename B, typename C>
struct c<A, B, C, int> : c<A, B> {
c() : c() { }
};
template <typename A, typename B, typename C, typename D>
struct c : virtual c<A, B> { };
----------------
then it compiles fine. However, in both cases the code may not be legal
since the class hierarchy is actually infinite. The only difference between
seeing the partial specialization and not seeing it is that in one case
it tries to do all the inheritance with virtual base classes, and in the
other case with non-virtual ones.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |memory-hog
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14507
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/14507] [3.3 Regression] Wacky Template ICE
2004-03-09 19:25 [Bug c++/14507] New: [3.1/3.2/3.2.2/3.2.3/3.3.2/3.3.3 Regression From 2.95.2/2.95.3] Wacky Template ICE stl at caltech dot edu
2004-03-09 19:41 ` [Bug c++/14507] [3.3 Regression] " pinskia at gcc dot gnu dot org
2004-03-09 20:36 ` bangerth at dealii dot org
@ 2004-04-01 19:40 ` bangerth at dealii dot org
2004-06-11 22:22 ` pinskia at gcc dot gnu dot org
2004-08-10 19:07 ` reichelt at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2004-04-01 19:40 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-04-01 19:40 -------
My point with the infinite class hierarchy is actually not very good.
After all, we are just declaring a bunch of templates, not instantiating
any of them. The actual class hierarchy can only be determined once we
try to instantiate something, since we may have added further specialization
later on (after the code shown, which already blows up by itself), which
may terminate the inheritance hierarchy at some finite point.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14507
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/14507] [3.3 Regression] Wacky Template ICE
2004-03-09 19:25 [Bug c++/14507] New: [3.1/3.2/3.2.2/3.2.3/3.3.2/3.3.3 Regression From 2.95.2/2.95.3] Wacky Template ICE stl at caltech dot edu
` (2 preceding siblings ...)
2004-04-01 19:40 ` bangerth at dealii dot org
@ 2004-06-11 22:22 ` pinskia at gcc dot gnu dot org
2004-08-10 19:07 ` reichelt at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-11 22:22 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.3.4 |3.3.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14507
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/14507] [3.3 Regression] Wacky Template ICE
2004-03-09 19:25 [Bug c++/14507] New: [3.1/3.2/3.2.2/3.2.3/3.3.2/3.3.3 Regression From 2.95.2/2.95.3] Wacky Template ICE stl at caltech dot edu
` (3 preceding siblings ...)
2004-06-11 22:22 ` pinskia at gcc dot gnu dot org
@ 2004-08-10 19:07 ` reichelt at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-08-10 19:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2004-08-10 19:07 -------
Here's a shorter testcase:
====================================================
template<typename T> struct A : virtual A<T> {};
template<typename T> struct A<T*> : A<T>
{
A() : A() {}
};
====================================================
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |reichelt at gcc dot gnu dot
| |org
Keywords| |monitored
Known to fail|3.0.4 3.3.1 3.2.3 |3.0.4 3.2.3 3.3.1 3.3.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14507
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-08-10 19:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-09 19:25 [Bug c++/14507] New: [3.1/3.2/3.2.2/3.2.3/3.3.2/3.3.3 Regression From 2.95.2/2.95.3] Wacky Template ICE stl at caltech dot edu
2004-03-09 19:41 ` [Bug c++/14507] [3.3 Regression] " pinskia at gcc dot gnu dot org
2004-03-09 20:36 ` bangerth at dealii dot org
2004-04-01 19:40 ` bangerth at dealii dot org
2004-06-11 22:22 ` pinskia at gcc dot gnu dot org
2004-08-10 19:07 ` reichelt at gcc dot gnu dot org
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).