fix crash with ptr2int(poison)
ADD
tests/alive-tv/memory/ptr2int-poison.ident.ll
+define void @fn() {
+ %i7 = ptrtoint i8* poison to i8
+ ret void
+}

MODIFY
tools/transform.cpp
tools/transform.cpp
@@ -988,6 +988,9 @@ static void calculateAndInitConstants(Transform &t) {
num_nonlocals = num_nonlocals_src + num_globals - num_globals_src;
observes_addresses |= has_int2ptr || has_ptr2int;
+ // condition can happen with ptr2int(poison)
+ if (has_ptr2int && num_nonlocals == 0)
+ ++num_nonlocals;
if (!does_int_mem_access && !does_ptr_mem_access && has_fncall)
does_int_mem_access = true;

fix #788: crash with ptr2int(poison)