[llvm-bugs] [Bug 50917] New: [Miscompilation] Inlining Causes Jump to Wrong Address, Maybe Because of setjmp()
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Jun 27 21:05:08 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50917
Bug ID: 50917
Summary: [Miscompilation] Inlining Causes Jump to Wrong
Address, Maybe Because of setjmp()
Product: clang
Version: 12.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C
Assignee: unassignedclangbugs at nondot.org
Reporter: gavin.d.howard at gmail.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Clang is inlining a function, and when returning from the function, it is
jumping to the wrong location.
The code in question is at
https://git.yzena.com/gavin/bc/src/commit/c2d2977f2c6c9fe3cd8dc9b07fc8913008c81895/src/vm.c#L780-L842
.
As near as I can tell, when the call to `bc_vm_readLine()` returns `false`, the
code then does not jump to the end of the loop. Instead, it jumps to line 815,
which previously did a `setjmp()`. That `setjmp()` then thinks that a
`longjmp()` happens, which causes it to jump past the end of the loop and to
the `err:` label (the code inside `BC_SETJMP_LOCKED(err)` essentially does a
`if (setjmp(buf)) goto err;`).
I have confirmed the bug exists in Clang 12.0.1-rc3, 11.1.0, 10.0.1, and 9.0.1.
I could not get 8.0.1 to compile.
--
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/20210628/d5734143/attachment.html>
More information about the llvm-bugs
mailing list