Output of the gcc command:
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/u
sr/share/info --enable-shared --enable-threads=posix --enable-checking=release
-
-with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-
languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-ds
si --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--en
able-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/ja
va/eclipse-ecj.jar --with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20070502 (Red Hat 4.1.2-12)
 /usr/libexec/gcc/x86_64-redhat-linux/4.1.2/cc1 -E -quiet -v tt.c
-mtune=generic
 -O0 -fpch-preprocess -o tt.i
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../
../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include
 /usr/include
End of search list.
 /usr/libexec/gcc/x86_64-redhat-linux/4.1.2/cc1 -fpreprocessed tt.i -quiet
-dump
base tt.c -mtune=generic -auxbase tt -O0 -version -o tt.s
GNU C version 4.1.2 20070502 (Red Hat 4.1.2-12) (x86_64-redhat-linux)
        compiled by GNU C version 4.1.2 20070502 (Red Hat 4.1.2-12).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: cdc0c9646615f6ebf987f895cd040dc2
 as -V -Qy -o tt.o tt.s
GNU assembler version 2.17.50.0.16 (x86_64-redhat-linux) using BFD version
versi
on 2.17.50.0.16-1 20070511
 /usr/libexec/gcc/x86_64-redhat-linux/4.1.2/collect2 --eh-frame-hdr -m
elf_x86_6
4 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o tt
/usr/lib/gc
c/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o
/usr/lib/gcc/x86_64-redhat-
linux/4.1.2/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtb
egin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2
-L/usr/lib/gcc/x86_64-redhat-lin
ux/4.1.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64
-L/lib/../li
b64 -L/usr/lib/../lib64 tt.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc
--as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtend
.o /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crtn.o
tt.o: In function `first':
tt.c:(.text+0x22): undefined reference to `second'
collect2: ld returned 1 exit status

Preprocessed source file (tt.i):
# 1 "tt.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "tt.c"
void crash(){
  int* a = 0;
  a[0] = 0;
}

extern inline void second(){
  crash();
}

void first(){
  second();
}

int main(){

  first();

  return 0;
}

Notes:
    This compiles and links fine with -O (and any higher degree of
optimization) instead of -O0.  The problem is also present in GCC 4.1.1.


-- 
           Summary: Source file with extern inline function fails to link
                    with -O0
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kris dot van dot hees at oracle dot com


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

Reply via email to