prosyslab-classroom / cs348-information-security

61 stars 10 forks source link

[Question][Hw5] memory in Analysis.check_instr #181

Closed nubi12336 closed 3 years ago

nubi12336 commented 3 years ago

In example1.c, there is if (x<0) and it is %div3 = sdiv i32 10, %call, !dbg !23 in example1.ll, if.then2. I printed out a table and I got a result %div3 = sdiv i32 10, %call, !dbg !23 -> %call -> Neg. Then, I thought, in Analysis.check_instr, as it matches with Llvm.Opcode.SDiv and v is Neg(as e is %call) Memory.Value.order zero v must be false. However, it prints out Potential Division-by-zero @ example1.c:main:9:14, %call = Top.

What is wrong?

nubi12336 commented 3 years ago

I printed out in Memory.pp Format.std_formatter memory Analysis.check_instr. Below is result. image I think second row is weird..

RiceBiscuits commented 3 years ago

I can't find the bug due to the lack of information. However, I guess analysis.run function ortransfer_*may have a problem. Please debug yourrun and transfer_*function carefully.

nubi12336 commented 3 years ago

How come it can happen that, in the resulting table there is %div3 = sdiv i32 10, %call, !dbg !23 -> %call -> Neg, but in the result div3, %call become top?(above picture) %div3 ~ is 10/x in if (x < 0) {z = 10 / x}.