Hi,
Could a gate keeper review the patch for #827? Thank you very much.
The 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 }
But 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:
Index: /open64/open64-trunk/osprey-gcc-4.2.0/gcc/tree.c
===================================================================
--- /open64/open64-trunk/osprey-gcc-4.2.0/gcc/tree.c (revision 3731)
+++ /open64/open64-trunk/osprey-gcc-4.2.0/gcc/tree.c (working copy)
@@ -10916,6 +10916,16 @@
/* 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);
--
Regards,
Lai Jian-Xin
------------------------------------------------------------------------------
Using storage to extend the benefits of virtualization and iSCSI
Virtualization increases hardware utilization and delivers a new level of
agility. Learn what those decisions are and how to modernize your storage
and backup environments for virtualization.
http://www.accelacomm.com/jaw/sfnl/114/51434361/
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel