[LLVMbugs] [Bug 11627] New: llvm-link links functions with same name but with different parameters set

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Dec 20 11:40:26 PST 2011


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

             Bug #: 11627
           Summary: llvm-link links functions with same name but with
                    different parameters set
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: llvm-link
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: stpworld at narod.ru
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 7779
  --> http://llvm.org/bugs/attachment.cgi?id=7779
Draft patch

llvm-link links functions with same name but with different parameters set.

consider two files:

; 1.ll:
declare i32 @bug_a(%struct.bug_type*)
declare i32 @bug_b(%struct.bug_type*)
define i32 @bug_c(%struct.bug_type* %var) nounwind uwtable {
entry:
  %res = call i32 @bug_b(%struct.bug_type* %var)
  ret i32 0
}

; 2.ll:
%bar1 = type { i16 }

%bar2 = type { i32 }

define i32 @bug_a(%bar1* %fp) nounwind uwtable {
entry:
  %d_stream = getelementptr inbounds %bar1* %fp, i64 0, i32 0
  ret i32 0
}
define i32 @bug_b(%bar2* %a) nounwind uwtable {
entry:
  ret i32 0
}

"llvm-link -S 1.ll 2.ll" will produces the next:

%bar1 = type { i16 }
%bar2 = type { i32 }

define i32 @bug_c(%bar1* %var) nounwind uwtable {
entry:
  %res = call i32 bitcast (i32 (%bar2*)* @bug_b to i32 (%bar1*)*)(%bar1* %var)
  ret i32 0
}

define i32 @bug_a(%bar1* %fp) nounwind uwtable {
entry:
  %d_stream = getelementptr inbounds %bar1* %fp, i64 0, i32 0
  ret i32 0
}

define i32 @bug_b(%bar2* %a) nounwind uwtable {
entry:
  ret i32 0
}

bar_c is wrong here.

I attached the patch that fixes this problem, but I still have two failed
tests. By now I'm thinking how to fix all of them...

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