GCC checks this and set the flag in the later phase but we skip all those
phase.
2011/9/15 Gautam Chakrabarti <gautam.c...@yahoo.com>
> Hi Jian-Xin,
>
> Where does normal g++ execution set this flag? I.e., why is it not getting
> set for us?
>
> Thanks,
> Gautam
>
>
> *From:* Jian-Xin Lai <laij...@gmail.com>
>
> *To:* open64-devel <open64-devel@lists.sourceforge.net>
> *Sent:* Tuesday, September 13, 2011 12:49 AM
> *Subject:* Re: [Open64-devel] Code review for bug #827 [GCC FE]
>
> Hi,
> Could a gate keeper review this patch? Thank you very much.
>
> 2011/9/7 Jian-Xin Lai <laij...@gmail.com>
>
> 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
>
>
>
>
> --
> Regards,
> Lai Jian-Xin
>
>
> ------------------------------------------------------------------------------
> BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
> Learn about the latest advances in developing for the
> BlackBerry® mobile platform with sessions, labs & more.
> See new tools and technologies. Register for BlackBerry® DevCon today!
> http://p.sf.net/sfu/rim-devcon-copy1
> _______________________________________________
> Open64-devel mailing list
> Open64-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/open64-devel
>
>
>
--
Regards,
Lai Jian-Xin
------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops? How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel