alive2 icon indicating copy to clipboard operation
alive2 copied to clipboard

GEP does not produce the required 32-bit index truncation result

Open Forever119 opened this issue 2 weeks ago • 0 comments

With 64-bit pointers and 32-bit pointer indices, alive-exec reports that a GEP with offset 4294967296 differs from its base pointer.

Program

target datalayout = "e-p:64:64:64:32"
define i32 @main() {
  %p = inttoptr i64 1234 to ptr
  %q = getelementptr i8, ptr %p, i64 4294967296
  %c = icmp eq ptr %p, %q
  %r = zext i1 %c to i32
  ret i32 %r
}

Output

%p = #b10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001001101001000000000
%q = #b10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000001001101001000000000
%c = #b0
%r = #x00000000
Returned #x00000000 / non-poison=true

Forever119 avatar Nov 19 '26 14:11 Forever119