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]

Re: PR c/43288 (ICE with __attribute__ ((common)))


> On Wed, 2010-03-17 at 16:35 +0100, Jan Hubicka wrote:
> 
> > Hmm, I rebuilt for this tripplet, but still no luck:
> > 
> > jh@gcc14:~/trunk/build-hppa2/gcc$ cat a.C
> > class t { virtual ~t(); };
> > namespace  __cxxabiv1 {
> > class __fundamental_type_info : public t {};
> > }
> > 
> > jh@gcc14:~/trunk/build-hppa2/gcc$ ./cc1plus a.C -quiet
> > jh@gcc14:~/trunk/build-hppa2/gcc$
> > 
> > There seems to be no changes today that would fix this.  If the testcase seems
> > fine, could you try to get a backtrace for me?  I think we might only need to
> > avoid make_decl_rtl from being called too early.
> > 
> > Honza
> 

Hi,
looking at the corelation about notice_global_symbol and make_decl_rtl,
I don't think I can easilly avoid the scenario.  In longer term we probably
should make this kind of mangling late in cgraph code but until then it seems
best to simply make make_decl_rtl behave (semi) sanily here as it used to.

Does the attached patch fix the bootstrap problem? (it does fix the testcase)

Honza

Index: varasm.c
===================================================================
--- varasm.c	(revision 157518)
+++ varasm.c	(working copy)
@@ -1435,16 +1435,19 @@ make_decl_rtl (tree decl)
 
   /* Specifying a section attribute on a variable forces it into a
      non-.bss section, and thus it cannot be common.  */
-  gcc_assert (!(TREE_CODE (decl) == VAR_DECL
-	      && DECL_SECTION_NAME (decl) != NULL_TREE
-	      && DECL_INITIAL (decl) == NULL_TREE
-	      && DECL_COMMON (decl))
-	      || !DECL_COMMON (decl));
+  /* FIXME: In general this code should not be necessary because
+     visibility pass is doing the same work.  But notice_global_symbol
+     is called early and it needs to make DECL_RTL to get the name.
+     we take care of recomputing the DECL_RTL after visibility is changed.  */
+  if (TREE_CODE (decl) == VAR_DECL
+      && DECL_SECTION_NAME (decl) != NULL_TREE
+      && DECL_INITIAL (decl) == NULL_TREE
+      && DECL_COMMON (decl))
+    DECL_COMMON (decl) = 0;
 
   /* Variables can't be both common and weak.  */
-  gcc_assert (TREE_CODE (decl) != VAR_DECL
-	      || !DECL_WEAK (decl)
-	      || !DECL_COMMON (decl));
+  if (TREE_CODE (decl) == VAR_DECL && DECL_WEAK (decl))
+    DECL_COMMON (decl) = 0;
 
   if (use_object_blocks_p () && use_blocks_for_decl_p (decl))
     x = create_block_symbol (name, get_block_for_decl (decl), -1);


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