Using the -O flag, the longcall attribute is ignored by the compiler when
replacing printf() with puts(), even if a prototype for puts() exists with a
long call.  The test case below illustrates this.  

======
int printf(const char *format, ...) __attribute__ ((__longcall__)); 
int puts(const char *s) __attribute__ ((__longcall__));

int main(int argc, char* argv[])
{
   printf("Should be a long call\n"); 
   return 0;
}

======

At the moment I'm using -fno-builtin-printf as a workaround.

-- 
           Summary: printf() optimisation ignores longcall attribute
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jason at catapult dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: powerpc-eabi


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

Reply via email to