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]

[C++ PATCH] Fix bug 934


Hi,
I've installed this patch which fixes bug 934. guard variables should
have the same linkage as what they guard.

built & tested on i86-pc-linux-gnu, approved by Mark. [Mark,
this does the other two flags too.]

No test case, as that requires linking two object files which is
beyond our test harness.

Note this does NOT fix the longstanding bug about inline functions seeing
different statics in different translation units.

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2001-01-11  Nathan Sidwell  <nathan@codesourcery.com>

	* decl2.c (get_guard): Set linkage from guarded decl.

Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl2.c,v
retrieving revision 1.428
diff -c -3 -p -r1.428 decl2.c
*** decl2.c	2001/01/10 23:06:27	1.428
--- decl2.c	2001/01/11 13:32:46
*************** get_guard (decl)
*** 2856,2866 ****
  	guard_type = integer_type_node;
  
        guard = build_decl (VAR_DECL, sname, guard_type);
!       TREE_PUBLIC (guard) = 1;
        DECL_ARTIFICIAL (guard) = 1;
-       TREE_STATIC (guard) = 1;
        TREE_USED (guard) = 1;
-       DECL_COMMON (guard) = 1;
        pushdecl_top_level (guard);
        cp_finish_decl (guard, NULL_TREE, NULL_TREE, 0);
      }
--- 2856,2872 ----
  	guard_type = integer_type_node;
  
        guard = build_decl (VAR_DECL, sname, guard_type);
!       
!       /* The guard should have the same linkage as what it guards. */
!       TREE_PUBLIC (guard) = TREE_PUBLIC (decl);
!       TREE_STATIC (guard) = TREE_STATIC (decl);
!       DECL_COMMON (guard) = DECL_COMMON (decl);
!       DECL_ONE_ONLY (guard) = DECL_ONE_ONLY (decl);
!       if (TREE_PUBLIC (decl))
!         DECL_WEAK (guard) = DECL_WEAK (decl);
!       
        DECL_ARTIFICIAL (guard) = 1;
        TREE_USED (guard) = 1;
        pushdecl_top_level (guard);
        cp_finish_decl (guard, NULL_TREE, NULL_TREE, 0);
      }

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