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 c/12336] New: -funit-at-a-time vs builtin functions vs extern inline


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: -funit-at-a-time vs builtin functions vs extern inline
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dannysmith at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-mingw
  GCC host triplet: i686-pc-mingw
GCC target triplet: i686-pc-mingw

I've hit what appears to be bug with -funit-at-a-time and
builtin functions that are also declared as extern inline
in headers 

=========================================================
/* inline.h */
extern double tan (double);
extern double sin (double);
extern  __inline__ float tanf (float a) { return tan (a);}
static  __inline__ float sinf (float a) { return sin (a);}

=========================================================

/* bar1.c */
#include "inline.h"
void bar1 (void)
{
}

=========================================================

/* bar2.c */
#include "inline.h"
void bar2 (void)
{
}

=========================================================

Compiling bar1.c and bar2.c with -funit-at-a-time


D:\develop\bugs\inline>gcc -funit-at-a-time -c -O1 -obar.o  bar1.c bar2.c 
In file included from bar2.c:1,
                 from bar1.c:5:
inline.h:4: error: redefinition of 'tanf'
inline.h:4: error: 'tanf' previously defined here
inline.h:4: error: redefinition of 'tanf'
inline.h:4: error: 'tanf' previously defined here

gcc -v
Reading specs from D:/MINGW/BIN/../lib/gcc/mingw32/3.4/specs
Configured with: '../gcc/configure' '--with-gcc '--with-gnu-ld '--with-gnu-as '-
-host=mingw32 '--build=mingw32 '--target=mingw32 '--prefix=/mingw '--enable-
threads '--disable-nls '--enable-languages=c,c++,ada,f77,objc '--disable-win32-
registry '--disable-shared '--enable-sjlj-exceptions '--disable-libstdcxx-pch
Thread model: win32
gcc version 3.4 20030916 (experimental)


AFAICT, the extern inline conflict only appears for
builtin functions.

If -O2 switch is given to enable inlining, there is no
problem

If the "extern __inline__" is changed to "static __inline__" (which 
should be done anyway for C99 compliance), then
there is no problem.

Danny


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