alive2
alive2 copied to clipboard
A load outside an inrange subrange is accepted
A load at offset 2 from a pointer with inrange(0,1) returns 99 without an undefined-behavior diagnostic.
Program
@g = private constant [4 x i8] c"abcd"
define i32 @main() {
%q = getelementptr i8, ptr getelementptr inrange(0, 1) ([4 x i8], ptr @g, i64 0, i64 0), i64 2
%x = load i8, ptr %q
%r = zext i8 %x to i32
ret i32 %r
}
Output
Executing %#0
%__constexpr_0 = #b00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000
%q = #b00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001000000000
%x = #x63
%r = #x00000063
Returned #x00000063 / non-poison=true