[LLVMdev] Address of labels = 1 with llvm-g++

Edward Lee eslee3 at uiuc.edu
Sat Apr 19 00:56:11 PDT 2008


I'm trying to put the address of a label in a register by passing in
&&label to an inline asm call, but noticed this reduced case also has
problems in llvm-g++:

int main() {
label:
  return (int)&&label;
}

The assembly code generated by g++ -S:
movl  $.L2, %eax ; where L2 is the label just inside main

Assembly code from llvm-g++ -S:
movl $1, %eax

ll code with llvm-g++ -emit-llvm:
ret i32 1

Ed



More information about the llvm-dev mailing list