[llvm-dev] Mem2reg: load before single store
James Y Knight via llvm-dev
llvm-dev at lists.llvm.org
Mon Sep 14 07:30:49 PDT 2020
On Mon, Sep 14, 2020 at 3:19 AM László Radnai via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> A problem arises, and I am not sure if it is really a problem or just
> weird C-compliant behavior.
>
> int a; // or, equally, int a=0;
>
> int main(){
> int b;
> if (b) // (*)
>
At this line, you invoke undefined behavior by reading the value of "b",
before it's been initialized. At this point, the compiler may do whatever
it likes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200914/dce46e8f/attachment.html>
More information about the llvm-dev
mailing list