[llvm-dev] [HELP] Segfault on printing out structure elements
陳韋任 via llvm-dev
llvm-dev at lists.llvm.org
Wed Aug 2 15:39:34 PDT 2017
Perhaps you can run verify [1] after your transformation to do sanity check.
[1] http://llvm.org/docs/doxygen/Verifier_8h_source.html
Regards,
chenwj
2017-08-01 23:22 GMT+08:00 Sunghyun Park via llvm-dev <llvm-dev at lists.llvm.org>:
> Hi, all.
> I'm a graduate student working on creating llvm pass that generates
> resilient version of code automatically.
> Basically, what it does is to duplicate instructions and compare them at the
> synchronization points, such as function call, branch. Plus, there is one
> more copy for recovery. So if two copies agree, program will proceed with
> original copy, or otherwise it will use the third copy as corrected one. It
> looks like below.
> e.g.
> $inst1 = add $1, $2
> $inst2 = add $3, $4
> $inst3 = add $5, $6
> $cmp = icmp $inst1, $inst2
> $corrected = sel $cmp, $inst1, $inst3
> printf $corrected //very simplified form
>
> Everything was going fine, but now I'm stuck at a weird bug that I cannot
> quite understand.
> If the instructions to be copied are accessing structure elements and they
> are printed out by printf or fprintf(like example above except it does not
> access structure), it occurs segfault at runtime even though they are legit
> memory access.
>
> * Here's more clarification for my situation.
> - It compiles successfully.
> - If I commented out 'printf' or 'fprintf' from the source code, the program
> works fine. So it seems like there's a problem on this part.
> - For other printf with corrected value, they works fine if they are not
> accessing structure element.
>
>
> Error msg and comparison between original code and transformed code by my
> pass are attached below. I tried to make it shown here but the size wasn't
> fit.
>
> Is there anyone who had same problem or have any idea/guess/hint for me?
> Thank you in advance!
>
>
> --
> Best, Sung
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
--
Wei-Ren Chen (陳韋任)
Homepage: https://people.cs.nctu.edu.tw/~chenwj
More information about the llvm-dev
mailing list