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 target/19746] printf() optimisation ignores longcall attribute


------- Additional Comments From amodra at bigpond dot net dot au  2005-02-07 11:28 -------
Note that if you declare __builtin_printf and __builtin_puts with
__attribute__((__longcall__)) as well as printf and puts, you will get the
behaviour you expect.

The following patch also works, but I'm unsure of all the ramifications.  As far
as I can see, it seems that the only thing this will change is the name of the
function declaration used in implicit builtin expansions.

	* c-common.c (builtin_function_2): Return normal decl rather than
	built-in decl if it is available.

--- c-common.c~	2005-02-07 21:17:05.660721258 +1030
+++ c-common.c	2005-02-07 21:48:16.568241150 +1030
@@ -3348,7 +3348,7 @@ builtin_function_2 (const char *builtin_
     decl = lang_hooks.builtin_function (name, type, function_code, cl,
 					NULL, attrs);
 
-  return (bdecl != 0 ? bdecl : decl);
+  return (decl != 0 ? decl : bdecl);
 }
 
 /* Nonzero if the type T promotes to int.  This is (nearly) the


-- 


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


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