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

Sub pass ssa_opt_private_append #8630

Closed
manuel-rubio opened this issue Jul 1, 2024 · 6 comments
Closed

Sub pass ssa_opt_private_append #8630

manuel-rubio opened this issue Jul 1, 2024 · 6 comments
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@manuel-rubio
Copy link
Contributor

Describe the bug
I'm trying to compile my project (https://github.com/bragful/ephp) using OTP 26.2.5.1 and looks like it's experiencing an issue, first, I compiled and found the error about +0.00 but solving that, it's failing again with this error message:

./rebar3 escriptize
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling ephp
Sub pass ssa_opt_private_append
===> Compiling src/ephp_parser.erl failed
src/ephp_parser.erl:none: internal error in pass beam_ssa_opt:
exception error: no function clause matching beam_ssa_private_append:patch_literal_term([],{hd,self},429)
  in function  beam_ssa_private_append:patch_opargs/6 (beam_ssa_private_append.erl, line 540)
  in call from beam_ssa_private_append:patch_opargs/3 (beam_ssa_private_append.erl, line 534)
  in call from beam_ssa_private_append:patch_appends_is/5 (beam_ssa_private_append.erl, line 488)
  in call from beam_ssa_private_append:patch_appends_f/5 (beam_ssa_private_append.erl, line 469)
  in call from beam_ssa_private_append:'-patch_appends/3-anonymous-2-'/3 (beam_ssa_private_append.erl, line 438)
  in call from maps:fold_1/4 (maps.erl, line 416)
  in call from beam_ssa_private_append:private_append/3 (beam_ssa_private_append.erl, line 72)

make: *** [Makefile:23: ephp] Error 1

To Reproduce
Check using these commands:

wget https://raw.githubusercontent.com/bragful/ephp/master/include/ephp.hrl
wget https://raw.githubusercontent.com/bragful/ephp/master/include/ephp_parser.hrl
wget https://raw.githubusercontent.com/bragful/ephp/master/src/ephp_parser.erl
erlc ephp_parser.erl

It should drop this error:

$ erlc ephp_parser.erl
Sub pass ssa_opt_private_append
ephp_parser.erl: internal error in pass beam_ssa_opt:
exception error: no function clause matching beam_ssa_private_append:patch_literal_term([],{hd,self},429)
  in function  beam_ssa_private_append:patch_opargs/6 (beam_ssa_private_append.erl, line 540)
  in call from beam_ssa_private_append:patch_opargs/3 (beam_ssa_private_append.erl, line 534)
  in call from beam_ssa_private_append:patch_appends_is/5 (beam_ssa_private_append.erl, line 488)
  in call from beam_ssa_private_append:patch_appends_f/5 (beam_ssa_private_append.erl, line 469)
  in call from beam_ssa_private_append:'-patch_appends/3-anonymous-2-'/3 (beam_ssa_private_append.erl, line 438)
  in call from maps:fold_1/4 (maps.erl, line 416)
  in call from beam_ssa_private_append:private_append/3 (beam_ssa_private_append.erl, line 72)

Expected behavior
Compile ok.

Affected versions
I tested with 26.1 and 26.2.5.1, I've also tested 26.0 and it's working fine.

Additional context
None.

@manuel-rubio manuel-rubio added the bug Issue is reported as a bug label Jul 1, 2024
@jhogberg jhogberg added the team:VM Assigned to OTP team VM label Jul 1, 2024
@frej
Copy link
Contributor

frej commented Jul 1, 2024

27 and master are not affected.

@frej
Copy link
Contributor

frej commented Jul 1, 2024

@manuel-rubio : Are you sure about 26.0 working? For me it crashes in the same way as all the other 26.*.

@manuel-rubio
Copy link
Contributor Author

@frej Yes, in my installed OTP 26 it's working, I'm using 26.0.2.

@frej
Copy link
Contributor

frej commented Jul 1, 2024

@frej Yes, in my installed OTP 26 it's working, I'm using 26.0.2.

That's strange, I must be doing something wrong when building from the Git tag. I'll double check at work tomorrow. But anyway, I'm pretty sure on what causes the crash and hope to have a fix ready tomorrow. If you compile your module with erlc +no_ssa_opt_private_append ephp_parser.erl you'll bypass the compiler pass which crashes and only miss out a binary optimization that was introduced in 26.0.

@frej
Copy link
Contributor

frej commented Jul 3, 2024

There is a fix in #8633, thanks for the easy to use reproducing example.

@manuel-rubio
Copy link
Contributor Author

Thanks for the fix, @frej

jhogberg added a commit that referenced this issue Jul 15, 2024
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