Author: laijx
Date: 2011-09-27 04:10:02 -0400 (Tue, 27 Sep 2011)
New Revision: 3747

Modified:
   trunk/osprey-gcc-4.2.0/gcc/tree.c
Log:
Fix bug #876.

This patch is related to bug 827 and rev 3739. For a simple case:
extern void undef();
static void foo() {
  undef();        // <-- A
}
static void bar() {
  int n;
  switch(n) {
    foo();        // <-- B
  }
}
int global() {
  bar();
}

The callsite B is dead code and eliminated by the GCC FE at O2. With the
patch to bug 827, function foo is still marked as referenced. Then
function foo() is emitted to the BE and generate the call to "undef".
There will be an error in the final linking phase: undefined reference
to `undef()'. In the previous patch rev 3739, when we generate the CALL node to 
a
function, both the name and decl of the function are marked as
referenced. That causes this regression. Since the logic to detect if a
static function is used but not defined only check the name of the
symbol, the new patch only set the name of the function referenced.

Code Review by Sun Chan.



Modified: trunk/osprey-gcc-4.2.0/gcc/tree.c
===================================================================
--- trunk/osprey-gcc-4.2.0/gcc/tree.c   2011-09-27 07:22:37 UTC (rev 3746)
+++ trunk/osprey-gcc-4.2.0/gcc/tree.c   2011-09-27 08:10:02 UTC (rev 3747)
@@ -10924,7 +10924,6 @@
                     the open64 backend wouldn't be surprised by missing
                     function definition. */
                  TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (callee)) = 1;
-                 mark_decl_referenced(callee);
               }
              if (!(callee && DECL_BUILT_IN(callee)))
              {


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to