This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/19746] printf() optimisation ignores longcall attribute
- From: "amodra at bigpond dot net dot au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Feb 2005 11:28:46 -0000
- Subject: [Bug target/19746] printf() optimisation ignores longcall attribute
- References: <20050202011011.19746.jason@catapult.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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