[LLVMbugs] [Bug 5038] New: llvm-ld changes global varible with arguments of byval

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Sep 24 02:17:30 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=5038

           Summary: llvm-ld changes global varible with arguments of byval
           Product: new-bugs
           Version: 2.5
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: hbrenkun at yahoo.cn
                CC: llvmbugs at cs.uiuc.edu


I run my case:

+ rm optbug.llvm.x86.bc optbug.x86.bc optbug.x86.s optbug.x86.exe
optbug.llvm.x86.ll optbug.x86.ll
llvm-gcc4.2-2.5-x86-linux-RHEL4/bin/llvm-gcc -c -emit-llvm optbug.c -o
optbug.llvm.x86.bc
optbug.c: In function ‘mycompare’:
optbug.c:20: warning: incompatible implicit declaration of built-in function
‘printf’
llvm-dis -f optbug.llvm.x86.bc -o optbug.llvm.x86.ll
llvm-ld -ipsccp optbug.llvm.x86.bc -o optbug.x86.bc
llvm-dis -f optbug.x86.bc.bc -o optbug.x86.ll
llc -f optbug.x86.bc.bc -o optbug.x86.s
llvm-gcc4.2-2.5-x86-linux-RHEL4/bin/llvm-gcc optbug.x86.s -o optbug.x86.exe
+ ./optbug.x86.exe
in mycompare: line = 100, val1 = 99, val2 = 0
val1 != val2
/********my test case********/
//#include <stdio.h>
struct  MYstr {
  unsigned char uc ;
  int ui;
} mystr;

void mytest(struct  MYstr  u) {
    u.ui = 99;
    u.uc = 'a';
}

void mystructure() {
   mystr.ui = 0;
   mystr.uc = 'b';
   mytest(mystr);
   mycompare(100, mystr.ui, 0);
}

int mycompare( int line, int val1, int val2) {
    printf("in mycompare: line = %d, val1 = %d, val2 = %d\n", line, val1,
val2);
    if(val1 == val2) {
       printf("val1 == val2\n");
    } else {
       printf("val1 != val2\n");
    }
    return 1;
}

int main() {
      mystructure();
      return 0;
}


-- 
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