This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: Fix PR c++/22452


This restores the behavior of decl_linkage to what it was before the
decl restructuring patch went in, by not checking DECL_COMDAT on
CONST_DECL (since CONST_DECL's can't be DECL_COMDAT).

If they were ever set to DECL_COMDAT, we'd get a tree check somewhere
else anyway.

Gaby seems to believe the behavior of decl_linkage is wrong in some way
in regard to CONST_DECL.

I have no real opinion on whether it is or not, i'll leave it to the C++
people to battle it own in a bloody cage match.  I'm simply posting a
patch to fix the regression i caused by making it behave how it used to.

Bootstrapped and regtested i686-pc-linux-gnu.

Okay for mainline?
--Dan
2005-07-14  Daniel Berlin  <dberlin@dberlin.org>

	Fix PR c++/22452
	* tree.c (decl_linkage): Don't check DECL_COMDAT on CONST_DECL.

Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/tree.c,v
retrieving revision 1.439
diff -u -p -r1.439 tree.c
--- tree.c	8 Jul 2005 23:37:04 -0000	1.439
+++ tree.c	14 Jul 2005 22:20:24 -0000
@@ -2129,7 +2129,8 @@ decl_linkage (tree decl)
      template instantiations have internal linkage (in the object
      file), but the symbols should still be treated as having external
      linkage from the point of view of the language.  */
-  if (TREE_CODE (decl) != TYPE_DECL && DECL_LANG_SPECIFIC (decl) && DECL_COMDAT (decl))
+  if ((TREE_CODE (decl) != TYPE_DECL && TREE_CODE (decl) != CONST_DECL)
+      && DECL_LANG_SPECIFIC (decl) && DECL_COMDAT (decl))
     return lk_external;
 
   /* Things in local scope do not have linkage, if they don't have

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]