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]

encode_section_info vs tentative definitions


Given something like

	int i;
	int f1() { return i; }
	int i = 0;
	int f2() { return i; }

f2 will not notice that encode_section_info may declare 'i' local.
Other possibilities occur with Darwin's machopic (which is where
I noticed this first), or with -funit-at-a-time.

Bootstrapped on alphaev67-linux.


r~


        * c-decl.c (duplicate_decls): Re-invoke make_decl_rtl if
        the old decl had instantiated DECL_RTL.

Index: gcc/c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.387
diff -c -p -d -r1.387 c-decl.c
*** gcc/c-decl.c	12 May 2003 03:25:35 -0000	1.387
--- gcc/c-decl.c	14 May 2003 03:43:12 -0000
*************** duplicate_decls (newdecl, olddecl, diffe
*** 1529,1534 ****
--- 1529,1543 ----
       Update OLDDECL to be the same.  */
    DECL_ATTRIBUTES (olddecl) = DECL_ATTRIBUTES (newdecl);
  
+   /* If OLDDECL had its DECL_RTL instantiated, re-invoke make_decl_rtl
+      so that encode_section_info has a chance to look at the new decl
+      flags and attributes.  */
+   if (DECL_RTL_SET_P (olddecl)
+       && (TREE_CODE (olddecl) == FUNCTION_DECL
+ 	  || (TREE_CODE (olddecl) == VAR_DECL
+ 	      && TREE_STATIC (olddecl))))
+     make_decl_rtl (olddecl, NULL);
+ 
    return 1;
  }
  


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