Skip to content

Commit 745cae1

Browse files
authored
Merge pull request #11424 from lucioleKi/isabell/compiler/fix/GH-11414/OTP-20280
compiler: Fix crash when calling `erlang:0()` inside fun
2 parents 3b6d355 + 91fb3b4 commit 745cae1

3 files changed

Lines changed: 35 additions & 3 deletions

File tree

lib/compiler/src/sys_core_fold.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2318,7 +2318,7 @@ is_simple_case_arg(_) -> false.
23182318
%%
23192319

23202320
is_bool_expr(#c_call{module=#c_literal{val=erlang},
2321-
name=#c_literal{val=Name},args=Args}) ->
2321+
name=#c_literal{val=Name},args=Args}) when is_atom(Name) ->
23222322
NumArgs = length(Args),
23232323
erl_internal:comp_op(Name, NumArgs) orelse
23242324
erl_internal:new_type_test(Name, NumArgs) orelse

lib/compiler/test/compilation_SUITE.erl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
vsn_3/1,
6363
infinite_loop/0,infinite_loop/1,
6464
native_record/1,
65-
use_nifs/1,gh_11352/1,gh_11367/1]).
65+
use_nifs/1,gh_11352/1,gh_11367/1,
66+
gh_11414/1]).
6667

6768
-include_lib("common_test/include/ct.hrl").
6869
-include_lib("stdlib/include/assert.hrl").
@@ -92,7 +93,7 @@ groups() ->
9293
otp_7202,on_load,on_load_inline,
9394
string_table,otp_8949_a,split_cases,
9495
infinite_loop, native_record,
95-
use_nifs,gh_11352,gh_11367]}].
96+
use_nifs,gh_11352,gh_11367,gh_11414]}].
9697

9798
init_per_suite(Config) ->
9899
test_lib:recompile(?MODULE),
@@ -148,6 +149,7 @@ end_per_group(_GroupName, Config) ->
148149
?comp(use_nifs).
149150
?comp(gh_11352).
150151
?comp(gh_11367).
152+
?comp(gh_11414).
151153

152154
infinite_loop() -> [{timetrap,{minutes,1}}].
153155
?comp(infinite_loop).
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
%%
2+
%% %CopyrightBegin%
3+
%%
4+
%% SPDX-License-Identifier: Apache-2.0
5+
%%
6+
%% Copyright Ericsson AB 2026. All Rights Reserved.
7+
%%
8+
%% Licensed under the Apache License, Version 2.0 (the "License");
9+
%% you may not use this file except in compliance with the License.
10+
%% You may obtain a copy of the License at
11+
%%
12+
%% http://www.apache.org/licenses/LICENSE-2.0
13+
%%
14+
%% Unless required by applicable law or agreed to in writing, software
15+
%% distributed under the License is distributed on an "AS IS" BASIS,
16+
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
%% See the License for the specific language governing permissions and
18+
%% limitations under the License.
19+
%%
20+
%% %CopyrightEnd%
21+
%%
22+
23+
-module(gh_11414).
24+
-export([?MODULE/0]).
25+
26+
?MODULE() ->
27+
ok.
28+
29+
run() ->
30+
fun(Res) -> Res = erlang:0() end.

0 commit comments

Comments
 (0)