* [C++ PATCH] Avoid decl_attributes on error_mark_node (PR c++/34100)
@ 2007-11-15 15:07 Jakub Jelinek
2007-11-16 4:37 ` Mark Mitchell
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2007-11-15 15:07 UTC (permalink / raw)
To: Jason Merrill, Mark Mitchell; +Cc: gcc-patches
Hi!
On this testcase decl_attributes is called with a TYPE_DECL with
error_mark_node type, which most of the attribute handlers aren't prepared
to handle. decl_attributes for attributes which require type will use
TREE_TYPE (decl) and all the handle_*_attribute routines expect that if
they require a type they will see a type rather than something else.
I have tried to return error_mark_node from tsubst_decl for TYPE_DECLs
where type == error_mark_node (which it already does for e.g. VAR_DECL
with type == error_mark_node), but that caused a bunch of testsuite
regressions, so I think it is better to leave that as is and catch the
problem either in apply_late_template_attributes, or in that function's
callers.
Regtested on x86_64-linux, ok for trunk?
2007-11-15 Jakub Jelinek <jakub@redhat.com>
PR c++/34100
* pt.c (apply_late_template_attributes): Do nothing if decl's type is
error_mark_node.
* g++.dg/template/crash73.C: New test.
--- gcc/cp/pt.c.jj 2007-11-15 09:29:48.000000000 +0100
+++ gcc/cp/pt.c 2007-11-15 09:40:54.000000000 +0100
@@ -6622,7 +6622,11 @@ apply_late_template_attributes (tree *de
}
if (DECL_P (*decl_p))
- p = &DECL_ATTRIBUTES (*decl_p);
+ {
+ if (TREE_TYPE (*decl_p) == error_mark_node)
+ return;
+ p = &DECL_ATTRIBUTES (*decl_p);
+ }
else
p = &TYPE_ATTRIBUTES (*decl_p);
--- gcc/testsuite/g++.dg/template/crash73.C.jj 2007-11-15 11:22:11.000000000 +0100
+++ gcc/testsuite/g++.dg/template/crash73.C 2007-11-15 11:22:02.000000000 +0100
@@ -0,0 +1,9 @@
+// PR c++/34100
+// { dg-do compile }
+
+template<typename T> struct A
+{
+ typedef typename T::X Y __attribute__((vector_size(8))); // { dg-error "is not a class, struct" }
+};
+
+A<int> a;
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [C++ PATCH] Avoid decl_attributes on error_mark_node (PR c++/34100)
2007-11-15 15:07 [C++ PATCH] Avoid decl_attributes on error_mark_node (PR c++/34100) Jakub Jelinek
@ 2007-11-16 4:37 ` Mark Mitchell
0 siblings, 0 replies; 2+ messages in thread
From: Mark Mitchell @ 2007-11-16 4:37 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Jason Merrill, gcc-patches
Jakub Jelinek wrote:
> 2007-11-15 Jakub Jelinek <jakub@redhat.com>
>
> PR c++/34100
> * pt.c (apply_late_template_attributes): Do nothing if decl's type is
> error_mark_node.
>
> * g++.dg/template/crash73.C: New test.
OK.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-15 23:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-15 15:07 [C++ PATCH] Avoid decl_attributes on error_mark_node (PR c++/34100) Jakub Jelinek
2007-11-16 4:37 ` Mark Mitchell
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).