[LLVMbugs] [Bug 6608] New: Address of label regression

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Mar 13 09:22:41 PST 2010


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

           Summary: Address of label regression
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: csdavec at swan.ac.uk
                CC: llvmbugs at cs.uiuc.edu


Compiling GSFormat.m from GNUstep, which formerly worked with clang, I now get
assembler errors.  The problem appears to be the use of the address-of-label
extension.  With a reduced test case, I get:

$ cat jmptolabel.c 
int main(int argc, char**argv)
{
    const void *const jump_table[] = { &&lbl1, &&lbl2} ;
    goto *jump_table[0];
lbl1:
    return 1;
lbl2:
    return 0;
}
$ clang -c jmptolabel.c 
/tmp/cc-4ZYGXk.s: Assembler messages:
/tmp/cc-4ZYGXk.s:22: Error: symbol `.LBA4_main_' is already defined
clang: error: assembler command failed with exit code 1 (use -v to see
invocation)

Looking at the generated bitcode, there is one obvious problem:

@main.jump_table = internal constant [2 x i8*] [i8* blockaddress(@main,
<badref>), i8* blockaddress(@main, <badref>)], align 4 ; <[2 x i8*]*> [#uses=1]

Obviously, the <badref> things are wrong.  Looking further down, the error is
more subtle.  The labels for the two jumps look like this:

; <label>:5                                       ; preds = %9
  store i32 1, i32* %1
  br label %7

; <label>:6                                       ; preds = %9
  store i32 0, i32* %1
  br label %7

It seems that LLVM generates the symbol for the jump target by concatenating
the function name and the label name, but in this case the label name is empty
and so all of the symbols are the same.  Adding real names makes it work.  

It would be good if this could be fixed for the release, because it's causing
code that formerly compiled with clang to fail.

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