Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Corrupted beam file with maybe and some optimisations disabled #7128

@RobinMorisset

Description

@RobinMorisset

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.

Metadata

Metadata

Labels

bugIssue is reported as a bugteam:VMAssigned to OTP team VM

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions