Skip to content
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

Corrupted beam file with maybe and some optimisations disabled #7128

Closed
RobinMorisset opened this issue Apr 17, 2023 · 1 comment · Fixed by #7129
Closed

Corrupted beam file with maybe and some optimisations disabled #7128

RobinMorisset opened this issue Apr 17, 2023 · 1 comment · Fixed by #7129
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@RobinMorisset
Copy link
Contributor

RobinMorisset commented Apr 17, 2023

Describe the bug
Running the following commands:

erlc +no_copt +no_bool_opt +no_ssa_opt -W0 ~/minimized/beam_crash.erl
erl -noshell -pa . -s beam_crash wrapper0 -s init stop

with the following file at location ~/minimized/beam_crash.erl:

f1() -> 
    maybe 
        [_ | _] ?= ((true xor true) andalso foo),
        bar ?= ?MODULE:f1()
    end.

wrapper0() -> 
    ok.

results in the following error message:

Error! Failed to load module 'beam_crash' because it requires a more recent Erlang/OTP version or its .beam file was corrupted.
(You are running Erlang/OTP 26.)

Runtime terminating during boot ({undef,[{init,start_it,1,[]},{init,start_em,1,[]},{init,do_boot,3,[]}]})

Crash dump is being written to: erl_crash.dump...done

Affected versions
master

Additional context
This crash is 100% reproducible, but disappears if any of the three disabled optimizations is re-enabled.

@RobinMorisset RobinMorisset added the bug Issue is reported as a bug label Apr 17, 2023
@jhogberg jhogberg self-assigned this Apr 17, 2023
@jhogberg jhogberg added the team:VM Assigned to OTP team VM label Apr 17, 2023
bjorng added a commit to bjorng/otp that referenced this issue Apr 18, 2023
@bjorng bjorng self-assigned this Apr 18, 2023
@bjorng
Copy link
Contributor

bjorng commented Apr 18, 2023

Thanks! The linked pull request resolves the issue.

bjorng added a commit that referenced this issue Apr 19, 2023
…gen/GH-7128

Fix failure to load module with disabled optimizations
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

Successfully merging a pull request may close this issue.

3 participants