public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33094] New: ICE on valid C++ virtual template static member in namespace
@ 2007-08-17 3:27 ian at airs dot com
2007-08-17 9:29 ` [Bug c++/33094] [4.2/4.3 Regression] ICE on valid C++ virtual template static member in anonymous namespace pinskia at gcc dot gnu dot org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: ian at airs dot com @ 2007-08-17 3:27 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]
This C++ code gets an ICE with gcc 4.2 and with mainline. I believe this is
valid C++ code.
namespace
{
template <typename T>
class A
{
virtual T f1() { return c; }
static const T c = 0;
};
A<int> v;
}
foo.cc: In instantiation of const int <unnamed>::A<int>::c:
foo.cc:7: instantiated from T<unnamed>::A<T>::f1() [with T = int]
foo.cc:11: instantiated from here
foo.cc:8: internal compiler error: in make_rtl_for_nonlocal_decl, at
cp/decl.c:4967
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
--
Summary: ICE on valid C++ virtual template static member in
namespace
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ian at airs dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33094
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/33094] [4.2/4.3 Regression] ICE on valid C++ virtual template static member in anonymous namespace
2007-08-17 3:27 [Bug c++/33094] New: ICE on valid C++ virtual template static member in namespace ian at airs dot com
@ 2007-08-17 9:29 ` pinskia at gcc dot gnu dot org
2007-08-17 14:31 ` ian at airs dot com
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-17 9:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2007-08-17 09:29 -------
/* An in-class declaration of a static data member should be
external; it is only a declaration, and not a definition. */
if (init == NULL_TREE)
gcc_assert (DECL_EXTERNAL (decl));
Confirmed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |ice-on-valid-code
Last reconfirmed|0000-00-00 00:00:00 |2007-08-17 09:29:10
date| |
Summary|ICE on valid C++ virtual |[4.2/4.3 Regression] ICE on
|template static member in |valid C++ virtual template
|namespace |static member in anonymous
| |namespace
Target Milestone|--- |4.2.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33094
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/33094] [4.2/4.3 Regression] ICE on valid C++ virtual template static member in anonymous namespace
2007-08-17 3:27 [Bug c++/33094] New: ICE on valid C++ virtual template static member in namespace ian at airs dot com
2007-08-17 9:29 ` [Bug c++/33094] [4.2/4.3 Regression] ICE on valid C++ virtual template static member in anonymous namespace pinskia at gcc dot gnu dot org
@ 2007-08-17 14:31 ` ian at airs dot com
2007-08-17 17:17 ` pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ian at airs dot com @ 2007-08-17 14:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from ian at airs dot com 2007-08-17 14:31 -------
This patch fixes the problem and passes the g++ testsuite.
Index: cp/decl.c
===================================================================
--- cp/decl.c (revision 127491)
+++ cp/decl.c (working copy)
@@ -4963,7 +4963,7 @@ make_rtl_for_nonlocal_decl (tree decl, t
gcc_assert (TREE_STATIC (decl));
/* An in-class declaration of a static data member should be
external; it is only a declaration, and not a definition. */
- if (init == NULL_TREE)
+ if (init == NULL_TREE && DECL_INITIAL (decl) == NULL_TREE)
gcc_assert (DECL_EXTERNAL (decl));
}
--
ian at airs dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.2.2 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33094
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/33094] [4.2/4.3 Regression] ICE on valid C++ virtual template static member in anonymous namespace
2007-08-17 3:27 [Bug c++/33094] New: ICE on valid C++ virtual template static member in namespace ian at airs dot com
2007-08-17 9:29 ` [Bug c++/33094] [4.2/4.3 Regression] ICE on valid C++ virtual template static member in anonymous namespace pinskia at gcc dot gnu dot org
2007-08-17 14:31 ` ian at airs dot com
@ 2007-08-17 17:17 ` pinskia at gcc dot gnu dot org
2007-09-05 1:00 ` mmitchel at gcc dot gnu dot org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-17 17:17 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Target Milestone|--- |4.2.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33094
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/33094] [4.2/4.3 Regression] ICE on valid C++ virtual template static member in anonymous namespace
2007-08-17 3:27 [Bug c++/33094] New: ICE on valid C++ virtual template static member in namespace ian at airs dot com
` (2 preceding siblings ...)
2007-08-17 17:17 ` pinskia at gcc dot gnu dot org
@ 2007-09-05 1:00 ` mmitchel at gcc dot gnu dot org
2007-09-05 6:04 ` ian at airs dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-09-05 1:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from mmitchel at gcc dot gnu dot org 2007-09-05 01:00 -------
Ian, I know that we talked about this on the mailing list at one point. Did
this get resolved? Does changing the assert to check DECL_EXTERNAL_LINKAGE_P
instead of DECL_EXTERNAL help?
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33094
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/33094] [4.2/4.3 Regression] ICE on valid C++ virtual template static member in anonymous namespace
2007-08-17 3:27 [Bug c++/33094] New: ICE on valid C++ virtual template static member in namespace ian at airs dot com
` (3 preceding siblings ...)
2007-09-05 1:00 ` mmitchel at gcc dot gnu dot org
@ 2007-09-05 6:04 ` ian at airs dot com
2007-09-07 0:29 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ian at airs dot com @ 2007-09-05 6:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from ian at airs dot com 2007-09-05 06:03 -------
I haven't looked further at this since this message:
http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01166.html
Testing DECL_EXTERNAL_LINKAGE_P does not make any difference: the compiler
still crashes. The decl in question is
<var_decl 0xb7d3b0b8 c
type <integer_type 0xb7d378dc int readonly type_6 SI
size <integer_cst 0xb7c55620 constant invariant 32>
unit size <integer_cst 0xb7c5540c constant invariant 4>
align 32 symtab 0 alias set -1 canonical type 0xb7d378dc precision 32
min <integer_cst 0xb7c555cc -2147483648> max <integer_cst 0xb7c555e8
2147483647>>
readonly used private static tree_1 tree_2 tree_3 nonlocal decl_3 decl_5
decl_6 SI file /home/iant/foo1.cc line 8 size <integer_cst 0xb7c55620 32> unit
size <integer_cst 0xb7c5540c 4>
align 32 context <record_type 0xb7d37ca8 A> initial <integer_cst 0xb7c55bd0
0>
template-info 0xb7d3c444 chain <type_decl 0xb7d37d80 A>>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33094
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/33094] [4.2/4.3 Regression] ICE on valid C++ virtual template static member in anonymous namespace
2007-08-17 3:27 [Bug c++/33094] New: ICE on valid C++ virtual template static member in namespace ian at airs dot com
` (4 preceding siblings ...)
2007-09-05 6:04 ` ian at airs dot com
@ 2007-09-07 0:29 ` pinskia at gcc dot gnu dot org
2007-09-23 18:22 ` jason at gcc dot gnu dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-09-07 0:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2007-09-07 00:28 -------
*** Bug 33322 has been marked as a duplicate of this bug. ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tim at klingt dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33094
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/33094] [4.2/4.3 Regression] ICE on valid C++ virtual template static member in anonymous namespace
2007-08-17 3:27 [Bug c++/33094] New: ICE on valid C++ virtual template static member in namespace ian at airs dot com
` (5 preceding siblings ...)
2007-09-07 0:29 ` pinskia at gcc dot gnu dot org
@ 2007-09-23 18:22 ` jason at gcc dot gnu dot org
2007-09-30 2:42 ` jason at gcc dot gnu dot org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-09-23 18:22 UTC (permalink / raw)
To: gcc-bugs
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jason at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2007-08-17 09:29:10 |2007-09-23 18:22:01
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33094
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/33094] [4.2/4.3 Regression] ICE on valid C++ virtual template static member in anonymous namespace
2007-08-17 3:27 [Bug c++/33094] New: ICE on valid C++ virtual template static member in namespace ian at airs dot com
` (6 preceding siblings ...)
2007-09-23 18:22 ` jason at gcc dot gnu dot org
@ 2007-09-30 2:42 ` jason at gcc dot gnu dot org
2007-10-09 19:30 ` [Bug c++/33094] [4.2 " mmitchel at gcc dot gnu dot org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-09-30 2:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jason at gcc dot gnu dot org 2007-09-30 02:41 -------
Subject: Bug 33094
Author: jason
Date: Sun Sep 30 02:41:39 2007
New Revision: 128890
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128890
Log:
PR c++/33094
* decl.c (make_rtl_for_nonlocal_decl): It's ok for a member
constant to not have DECL_EXTERNAL if it's file-local.
Added:
trunk/gcc/testsuite/g++.dg/ext/visibility/anon6.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/decl.c
trunk/gcc/cp/decl2.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33094
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/33094] [4.2 Regression] ICE on valid C++ virtual template static member in anonymous namespace
2007-08-17 3:27 [Bug c++/33094] New: ICE on valid C++ virtual template static member in namespace ian at airs dot com
` (7 preceding siblings ...)
2007-09-30 2:42 ` jason at gcc dot gnu dot org
@ 2007-10-09 19:30 ` mmitchel at gcc dot gnu dot org
2007-10-09 20:52 ` jason at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-10-09 19:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from mmitchel at gcc dot gnu dot org 2007-10-09 19:20 -------
Change target milestone to 4.2.3, as 4.2.2 has been released.
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.2.2 |4.2.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33094
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/33094] [4.2 Regression] ICE on valid C++ virtual template static member in anonymous namespace
2007-08-17 3:27 [Bug c++/33094] New: ICE on valid C++ virtual template static member in namespace ian at airs dot com
` (8 preceding siblings ...)
2007-10-09 19:30 ` [Bug c++/33094] [4.2 " mmitchel at gcc dot gnu dot org
@ 2007-10-09 20:52 ` jason at gcc dot gnu dot org
2007-10-09 21:11 ` jason at gcc dot gnu dot org
2007-10-22 18:13 ` jason at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-10-09 20:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jason at gcc dot gnu dot org 2007-10-09 20:52 -------
Subject: Bug 33094
Author: jason
Date: Tue Oct 9 20:52:24 2007
New Revision: 129180
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129180
Log:
PR c++/32470
* name-lookup.c (push_namespace_with_attrs): Fold back into...
(push_namespace): Here.
(handle_namespace_attrs): New fn for the attr code.
(leave_scope): Don't pop_visibility.
* name-lookup.h (struct cp_binding_level): Remove has_visibility.
* parser.c (cp_parser_namespace_definition): Call
handle_namespace_attrs and pop_visibility as appropriate.
PR c++/33094
* decl.c (make_rtl_for_nonlocal_decl): It's ok for a member
constant to not have DECL_EXTERNAL if it's file-local.
Added:
branches/gcc-4_2-branch/gcc/testsuite/g++.dg/ext/visibility/anon6.C
- copied unchanged from r128890,
trunk/gcc/testsuite/g++.dg/ext/visibility/anon6.C
branches/gcc-4_2-branch/gcc/testsuite/g++.dg/ext/visibility/namespace2.C
- copied unchanged from r129003,
trunk/gcc/testsuite/g++.dg/ext/visibility/namespace2.C
Modified:
branches/gcc-4_2-branch/gcc/cp/ChangeLog
branches/gcc-4_2-branch/gcc/cp/decl.c
branches/gcc-4_2-branch/gcc/cp/name-lookup.c
branches/gcc-4_2-branch/gcc/cp/name-lookup.h
branches/gcc-4_2-branch/gcc/cp/parser.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33094
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/33094] [4.2 Regression] ICE on valid C++ virtual template static member in anonymous namespace
2007-08-17 3:27 [Bug c++/33094] New: ICE on valid C++ virtual template static member in namespace ian at airs dot com
` (9 preceding siblings ...)
2007-10-09 20:52 ` jason at gcc dot gnu dot org
@ 2007-10-09 21:11 ` jason at gcc dot gnu dot org
2007-10-22 18:13 ` jason at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-10-09 21:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jason at gcc dot gnu dot org 2007-10-09 21:11 -------
Fixed for 4.2.3.
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33094
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/33094] [4.2 Regression] ICE on valid C++ virtual template static member in anonymous namespace
2007-08-17 3:27 [Bug c++/33094] New: ICE on valid C++ virtual template static member in namespace ian at airs dot com
` (10 preceding siblings ...)
2007-10-09 21:11 ` jason at gcc dot gnu dot org
@ 2007-10-22 18:13 ` jason at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-10-22 18:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from jason at gcc dot gnu dot org 2007-10-22 18:12 -------
Subject: Bug 33094
Author: jason
Date: Mon Oct 22 18:12:36 2007
New Revision: 129554
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129554
Log:
PR c++/32470
* name-lookup.c (push_namespace_with_attrs): Fold back into...
(push_namespace): Here.
(handle_namespace_attrs): New fn for the attr code.
(leave_scope): Don't pop_visibility.
* name-lookup.h (struct cp_binding_level): Remove has_visibility.
* parser.c (cp_parser_namespace_definition): Call
handle_namespace_attrs and pop_visibility as appropriate.
PR c++/33094
* decl.c (make_rtl_for_nonlocal_decl): It's ok for a member
constant to not have DECL_EXTERNAL if it's file-local.
* decl2.c (get_guard): Copy visibility from the guarded variable.
PR c++/29365
* pt.c (outermost_tinst_level): New function.
* lex.c (in_main_input_context): New function.
* decl2.c (constrain_class_visibility): Use it to avoid warning
about uses of the anonymous namespace in the main input file.
Modified:
branches/redhat/gcc-4_1-branch/gcc/cp/ChangeLog
branches/redhat/gcc-4_1-branch/gcc/cp/cp-tree.h
branches/redhat/gcc-4_1-branch/gcc/cp/decl.c
branches/redhat/gcc-4_1-branch/gcc/cp/decl2.c
branches/redhat/gcc-4_1-branch/gcc/cp/lex.c
branches/redhat/gcc-4_1-branch/gcc/cp/name-lookup.c
branches/redhat/gcc-4_1-branch/gcc/cp/name-lookup.h
branches/redhat/gcc-4_1-branch/gcc/cp/parser.c
branches/redhat/gcc-4_1-branch/gcc/cp/pt.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33094
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2007-10-22 18:13 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-17 3:27 [Bug c++/33094] New: ICE on valid C++ virtual template static member in namespace ian at airs dot com
2007-08-17 9:29 ` [Bug c++/33094] [4.2/4.3 Regression] ICE on valid C++ virtual template static member in anonymous namespace pinskia at gcc dot gnu dot org
2007-08-17 14:31 ` ian at airs dot com
2007-08-17 17:17 ` pinskia at gcc dot gnu dot org
2007-09-05 1:00 ` mmitchel at gcc dot gnu dot org
2007-09-05 6:04 ` ian at airs dot com
2007-09-07 0:29 ` pinskia at gcc dot gnu dot org
2007-09-23 18:22 ` jason at gcc dot gnu dot org
2007-09-30 2:42 ` jason at gcc dot gnu dot org
2007-10-09 19:30 ` [Bug c++/33094] [4.2 " mmitchel at gcc dot gnu dot org
2007-10-09 20:52 ` jason at gcc dot gnu dot org
2007-10-09 21:11 ` jason at gcc dot gnu dot org
2007-10-22 18:13 ` jason 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).