[llvm-bugs] [Bug 50234] New: [PPC] Value of local variable corrupted with `__builtin_setjmp`

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 5 18:38:42 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50234

            Bug ID: 50234
           Summary: [PPC] Value of local variable corrupted with
                    `__builtin_setjmp`
           Product: new-bugs
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: xtkoba at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 24831
  --> https://bugs.llvm.org/attachment.cgi?id=24831&action=edit
Repro

The attached C program (named ppc_bsjlj.c) behaves incorrectly when compiled
with optimization level -O1 or higher for PPC targets.

For 32-bit PPC

$ clang --target=powerpc-unknown-linux-gnu -O3 -c ppc_bsjlj.c

results in the output

value = 268566576
value = 268566596

where the two lines should be identical.

Similarly, for ppc64le

$ clang --target=powerpc64le-unknown-linux-gnu -O3 -c ppc_bsjlj.c

results in

value = 268566608
value = 268566648

Note that in the program the value of the local variable `n` is not changed
between `__builtin_setjmp` and the corresponding `__builtin_longjmp`. Indeed it
is const-qualified.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210506/ecd45ac9/attachment.html>


More information about the llvm-bugs mailing list