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

Skip to content

Conversation

@bjorng
Copy link
Contributor

@bjorng bjorng commented Feb 27, 2024

Closes #8190

@bjorng bjorng added team:VM Assigned to OTP team VM fix labels Feb 27, 2024
@bjorng bjorng self-assigned this Feb 27, 2024
@bjorng bjorng added the testing currently being tested, tag is used by OTP internal CI label Feb 27, 2024
@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2024

CT Test Results

    2 files     93 suites   34m 34s ⏱️
2 018 tests 1 970 ✅ 48 💤 0 ❌
2 327 runs  2 277 ✅ 50 💤 0 ❌

Results for commit 1b23ddb.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@RobinMorisset
Copy link
Contributor

Thanks for the fix.
It reduced by 100x the number of failing testcases, but there is one that remains and it changed its error message:

-record(r0, {rf0}).
-record(r1, {
    rf1 = fun
        (0.0) ->
            (list_to_bitstring(ok))#r0.rf0;
        (_) when ok ->
            ok
    end
}).

f() ->
    <<0 || (#r1{})>>.

still fails, and now its error message is

Function: f/0
/home/rmorisset/minimized/test7949.erl: internal error in pass core_to_ssa:
exception error: no match of right hand side value {b_remote,{b_literal,erlang},{b_literal,list_to_bitstring},1}
  in function  beam_core_to_ssa:call_cg/5 (beam_core_to_ssa.erl, line 2788)
  in call from beam_core_to_ssa:guard_cg/3 (beam_core_to_ssa.erl, line 2726)
  in call from beam_core_to_ssa:guard_cg/3 (beam_core_to_ssa.erl, line 2720)
  in call from beam_core_to_ssa:guard_clause_cg/3 (beam_core_to_ssa.erl, line 2701)
  in call from beam_core_to_ssa:match_cg/3 (beam_core_to_ssa.erl, line 2403)
  in call from beam_core_to_ssa:match_cg/3 (beam_core_to_ssa.erl, line 2404)
  in call from beam_core_to_ssa:cg/2 (beam_core_to_ssa.erl, line 2357)
  in call from beam_core_to_ssa:cg_fun/2 (beam_core_to_ssa.erl, line 2319)

I don't know whether it is a related bug, or a different one that was masked by the issue in erl_expand_records.

@bjorng bjorng force-pushed the bjorn/fix-erl_expand_records/GH-8190 branch from fa50647 to c8dd54f Compare February 28, 2024 06:04
@bjorng
Copy link
Contributor Author

bjorng commented Feb 28, 2024

I've updated the pull request to fix the second bug too.

@RobinMorisset
Copy link
Contributor

Two other related crashes were found overnight:

-record(r0, {rf0}).
-record(r1, {
    rf0 = {
        ((ok)#r0{})#r0.rf0,
        case ok of
            _ when ok ->
                ok
        end
    }
}).

f() ->
    #{ok => ok || (#r1{})}.

and

-record(r0, {rf0}).
-record(r1, {
    rf0 =
        (begin
            ((_ = ok)#r0.rf0),
            (try
                ok
            catch
                _ when ok ->
                    ok
            end)
        end)
}).

f() ->
    #{ok => ok || (#r1{})}.

crash with this PR with

Function: f/0
/home/rmorisset/minimized/test185701.erl: internal error in pass core:
exception error: no function clause matching v3_core:unforce_tree(
... [very big expression I'm omitting] ...
)
  in function  v3_core:unforce/3 (v3_core.erl, line 593)
  in call from v3_core:force_booleans/4 (v3_core.erl, line 545)
  in call from v3_core:gexpr/3 (v3_core.erl, line 370)
  in call from v3_core:gexpr_top/2 (v3_core.erl, line 357)
  in call from v3_core:guard/2 (v3_core.erl, line 344)
  in call from v3_core:clause/2 (v3_core.erl, line 306)
  in call from v3_core:clauses/2 (v3_core.erl, line 298)

Without the PR, they crash with the same error message as the original testcase.

Also fix other bugs in the `erl_expand_records` pass hidden behind the
original bug.

Closes erlang#8190
@bjorng bjorng force-pushed the bjorn/fix-erl_expand_records/GH-8190 branch from c8dd54f to 1b23ddb Compare March 4, 2024 05:23
@bjorng
Copy link
Contributor Author

bjorng commented Mar 4, 2024

I've force-pushed another update to fix the last two crashes.

@bjorng bjorng merged commit b18a791 into erlang:master Mar 5, 2024
@bjorng bjorng deleted the bjorn/fix-erl_expand_records/GH-8190 branch March 5, 2024 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[erlc] internal error in erl_expand_records:in_guard/1

2 participants