8000 beam_ssa_throw optimization may suppress stack traces that are used · Issue #7356 · erlang/otp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

beam_ssa_throw optimization may suppress stack traces that are used #7356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ilya-klyuchnikov opened this issue Jun 3, 2023 · 0 comments
Closed
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@ilya-klyuchnikov
Copy link
Contributor

Describe the bug
Compiling code with and without +no_throw_opt may lead to different behavior with respect to stack traces.

To Reproduce

-module(mod1).

-export([f1/1, f3/0]).

f1(A) ->
  try f2(A)
  catch _:Val -> Val
  end.

f2(a) ->
  throw(a);
f2(A) ->
  A.

f3() ->
  fun f2/1.
-module(mod2).
-export([f/0]).

f() ->
  F = mod1:f3(),
  try F(a)
  catch _:_:Stack -> length(Stack)
  end.
erlc mod1.erl mod2.erl
erl
1> mod2:f().
0

The stack trace was suppressed in this case.


erlc +no_throw_opt mod1.erl mod2.erl
erl
1> mod2:f().
6

Expected behavior
Stack traces are not suppressed in this case

Affected versions
OTP 25, 26, master

@ilya-klyuchnikov ilya-klyuchnikov added the bug Issue is reported as a bug label Jun 3, 2023
@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Jun 5, 2023
@jhogberg jhogberg self-assigned this Jun 5, 2023
jhogberg added a commit that referenced this issue Jun 8, 2023
…18626' into maint

* john/compiler/fix-ssa-throw-miscompilation/GH-7356/OTP-18626:
  beam_ssa_throw: Exceptions may escape modules through funs
bjorng pushed a commit that referenced this issue Jun 29, 2023
…18626' into maint-26

* john/compiler/fix-ssa-throw-miscompilation/GH-7356/OTP-18626:
  beam_ssa_throw: Exceptions may escape modules through funs
bjorng pushed a commit that referenced this issue Jun 29, 2023
…18626' into maint-25

* john/compiler/fix-ssa-throw-miscompilation/GH-7356/OTP-18626:
  beam_ssa_throw: Exceptions may escape modules through funs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

3 participants
0