[LLVMbugs] [Bug 8538] New: clang with -O3 optimization level redefines functions from the included headers

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Nov 3 02:18:26 PDT 2010


           Summary: clang with -O3 optimization level redefines functions
                    from the included headers
           Product: clang
           Version: 2.7
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: compile-fail
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: xinfinity_a at yahoo.com
                CC: llvmbugs at cs.uiuc.edu

Compile time errors "multiple definition of ... " for a number of functions
from the included headers (stdio.h, stdlib.h, math.h etc) , when compiling the
perlbench benchmark from SPEC CPU 2006 with clang -O3. In the LLVM IR [obtained
with -S -emit-llvm], the functions are already redefined in all the files *.ll
generated from the C source files in perlbench.

Steps to Reproduce:
1) Install SPEC CPU 2006
2) Use the attached config file (llvm.cfg) to build and run the benchmark: in
this file, clang is specified as the compiler in use and the optimization level
is O3
   runspec  --size test --tune base --noreportable --config llvm.cfg

Actual Results: 
The benchmark cannot be compiled, the errors are in make.err file
I have tried also passing the option -std=  with c98, c99, gnu99 and I got the
same errors.

Expected Results: 
The application should successfully build and run. I tested the same benchmark
with optimization level O0 and it compiled and run correctly.

Build Date & Platform:
I have tested the released version 2.7.

I have installed LLVM and clang from sources with --enable-optimized and
--enable-assertions options.

I have a PC with Intel(R) Xeon(R) CPU on 64 bits and I am using Ubuntu 10.04
LTS - the Lucid Lynx. 

Additional Builds and Platforms: 
The bug appears in version 2.8 as well as in the version from the svn
repository: 29 Oct 2010 10:47AM. 

Additional Information: 
I attach the generated *.ll files: the ones generated with clang -O0 (which run
correctly) and the ones generated with -O3 (which contain multiple
definitions). Also the make.err file generated by the SPEC suite, containing
the errors, and the config file llvm.cfg I have used. I have changed only the
optimization level to obtain these two different sets of files.

The original files are available in SPEC CPU 2006 and the benchmark causing
problems is perlbench.

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