[LLVMbugs] [Bug 9749] New: optimization bug with pow()

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 18 13:02:40 PDT 2011


           Summary: optimization bug with pow()
           Product: new-bugs
           Version: 2.9
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: mariah.lenox at gmail.com
                CC: llvmbugs at cs.uiuc.edu

I am using llvm-2.9 with clang-2.9.  I get a segmentation fault when
I compile file bar.c (below) with -O1 or higher.

--- foo.c ---
extern double exp2(double);

int main(argc, argv, arge)
int argc;
char **argv, **arge;
    double a;
    a = exp2((double) 0); 

--- bar.c ---
#include <stdio.h>
#include <math.h>

double exp2(x)
double x;
    double ans;
    ans = pow(2.0, x);
    printf("exp2 %f = %f\n", x, ans);
    return ans;

--- Makefile ---
CC = /home/kate/llvm-2.9/x86_64-Linux-core2-gcc-4.6.0/bin/clang

        $(CC) -c -O2 -o foo.o foo.c
        $(CC) -c -O0 -o bar.o bar.c       
        $(CC) -o foo foo.o bar.o -lm

        $(CC) -c -O2 -o foo.o foo.c
        $(CC) -c -O1 -o bar.o bar.c       
        $(CC) -o foo foo.o bar.o -lm

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