[LLVMbugs] [Bug 2462] New: Compilation failure with -O4, where -O3 succeeds

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Jun 15 09:06:48 PDT 2008


           Summary: Compilation failure with -O4, where -O3 succeeds
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sherlock at genome.stanford.edu
                CC: llvmbugs at cs.uiuc.edu

This is using the binary version of llvm-gcc 2.3, on MacOS 10.5.3, with XCode
3.0 installed:

Steps to reproduce (I made a reduction):

Compile source with:

llvm-gcc -O4 reduction.c -o reduction


ld: warning in /usr/tmp/cc8mQGAH.o, file is not of required architecture
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

However, changing the -O4 for -O3 makes it compile fine.  Also, using gcc,
instead of llvm-gcc works fine.

The reduction is:

int main(int argc, char *argv[]){

  return 0;


Other relevant info:

>llvm-gcc -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: ../llvm-gcc4.2-2.3.source/configure
--prefix=/Users/tonic/2.3/llvm-gcc/install --program-prefix=llvm-
--enable-llvm=/Users/tonic/2.3/llvm-2.3/ --enable-languages=c,c++,objc,obj-c++
--with-arch=nocona --with-tune=generic
--with-gxx-include-dir=/usr/include/c++/4.0.0 --build=i686-apple-darwin9
--host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5555) (LLVM build 2.3)

>uname -a
Darwin Gavza 9.3.0 Darwin Kernel Version 9.3.0: Fri May 23 00:49:16 PDT 2008;
root:xnu-1228.5.18~1/RELEASE_I386 i386

>gcc -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5465~16/src/configure --disable-checking
-enable-werror --prefix=/usr --mandir=/share/man
--with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib
--build=i686-apple-darwin9 --with-arch=apple --with-tune=generic
--host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5465)

One final bit of news, using llvm-gcc, instead of gcc to compile my
application, with -O3, made it more than twice as fast (runtime went to 25
minutes from 1 hour 9 minutes - it's a CPU intensive program for analysis of
biological data).  Caveat is that it was compiled with gcc 4.0.1, as Apple
hasn't yet released (at least publicly) XCode 3.1 with gcc 4.2, so I can't say
how much of that improvement was due to gcc version rather than llvm.  Was
interested to try -)4 to see if it further improved.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list