[PATCH] Fix PR12281: not emiting function which is static and marked as inline

Andrew Pinski pinskia@physics.uc.edu
Mon Sep 22 04:43:00 GMT 2003


In the Darwin's back-end, it sets TREE_SYMBOL_REFERENCED instead of 
calling
mark_referenced which is needed for because of call-graph-unit needs to 
be notified
that the function is used.

The testcase which fails with no unit-at-a-time (derived from 
cppcharset.c):

static void f(void);
void g(void (*x) (void)){x();}
static inline void f(void){}
void h(){g(f);}
int main(){h();return 0;}

Thanks,
Andrew Pinski


ChangeLog:

	* config/darwin.c (machopic_validate_stub_or_non_lazy_ptr): Call 
mark_referenced
	instead of setting TREE_SYMBOL_REFERENCED.

Patch:

Index: darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.43
diff -u -p -r1.43 darwin.c
--- darwin.c	21 Sep 2003 00:27:37 -0000	1.43
+++ darwin.c	22 Sep 2003 04:28:30 -0000
@@ -398,12 +399,12 @@ machopic_validate_stub_or_non_lazy_ptr (
  	     original symbol as being referenced.  */
            TREE_USED (temp) = 1;
  	  if (TREE_CODE (TREE_VALUE (temp)) == IDENTIFIER_NODE)
-	    TREE_SYMBOL_REFERENCED (TREE_VALUE (temp)) = 1;
+	    mark_referenced (TREE_VALUE (temp));
  	  real_name = IDENTIFIER_POINTER (TREE_VALUE (temp));
  	  real_name = darwin_strip_name_encoding (real_name);
  	  id2 = maybe_get_identifier (real_name);
  	  if (id2)
-	    TREE_SYMBOL_REFERENCED (id2) = 1;
+	    mark_referenced (id2);
  	}
  }



More information about the Gcc-patches mailing list