Author: laijx
Date: 2011-09-20 01:58:27 -0400 (Tue, 20 Sep 2011)
New Revision: 3739

Modified:
   trunk/osprey-gcc-4.2.0/gcc/tree.c
Log:
Fix bug #827.
he error message should be reported at toplev.c, line 884:
    874   if (TREE_CODE (decl) == FUNCTION_DECL
    875       && DECL_INITIAL (decl) == 0
    876       && DECL_EXTERNAL (decl)
    877       && ! DECL_ARTIFICIAL (decl)
    878       && ! TREE_NO_WARNING (decl)
    879       && ! TREE_PUBLIC (decl)
    880       && (warn_unused_function
    881           || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME
(decl))))
    882     {
    883       if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
    884         pedwarn ("%q+F used but never defined", decl);
    885       else
    886         warning (0, "%q+F declared %<static%> but never
defined", decl);
    887       /* This symbol is effectively an "extern" declaration now.
*/
    888       TREE_PUBLIC (decl) = 1;
    889       assemble_external (decl);
    890     }


Because the TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) is
not set for the callee in this case, the compiler doesn't report any
error on this case. The patch is to set this flag when handle the
CALL_EXPR when the tree is translated into spin.

Code review by Gautam.



Modified: trunk/osprey-gcc-4.2.0/gcc/tree.c
===================================================================
--- trunk/osprey-gcc-4.2.0/gcc/tree.c   2011-09-20 04:30:04 UTC (rev 3738)
+++ trunk/osprey-gcc-4.2.0/gcc/tree.c   2011-09-20 05:58:27 UTC (rev 3739)
@@ -10917,6 +10917,15 @@
              /* bug 12598: Try to fold OBJ_TYPE_REF if it is present
                 under the CALL_EXPR. Code adapted from fold_stmt() . */
              tree callee = get_callee_fndecl (t);
+              if (callee && TREE_CODE(callee) == FUNCTION_DECL)
+              {
+                 /* we need to emit the function be calleed, no matter 
+                    if the call is removed later by gcc cfg cleanup, so 
+                    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)))
              {
                callee = TREE_OPERAND(t,0);


------------------------------------------------------------------------------
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