This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/51867] GCC generates inconsistent code for same sources calling builtin calls, like sqrtf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51867

--- Comment #1 from amker.cheng <amker.cheng at gmail dot com> 2012-01-16 10:15:59 UTC ---
The cause is in function expand_builtin, gcc checks following conditions:
----------------------------------------------
 /* When not optimizing, generate calls to library functions for a certain
    set of builtins.  */
 if (!optimize
     && !called_as_built_in (fndecl)
     && DECL_ASSEMBLER_NAME_SET_P (fndecl)
     && fcode != BUILT_IN_ALLOCA
     && fcode != BUILT_IN_ALLOCA_WITH_ALIGN
     && fcode != BUILT_IN_FREE)
   return expand_call (exp, target, ignore);

The control flow is:
1, DECL_ASSEMBLER_NAME_SET_P (fndecl) is false at the first time when compiling
a;
2, It is then set in following codes when expanding sqrtf call in function a;
3, When compiling function b, gcc checks DECL_ASSEMBLER_NAME_SET_P (fndecl)
    again and this time it's true;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]