Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
0234-beam_call_types-Fix-erlang-band-2-range-ca...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0234-beam_call_types-Fix-erlang-band-2-range-calculation.patch of Package erlang
From bb3d99c74ec66ec0d96b7e71b849c5bda4460464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20H=C3=B6gberg?= <john@erlang.org> Date: Wed, 25 Nov 2020 15:47:25 +0100 Subject: [PATCH 2/2] beam_call_types: Fix erlang:band/2 range calculation I forgot to clamp the maximum, sometimes resulting in a nonsense type that failed to validate. --- lib/compiler/src/beam_call_types.erl | 2 +- lib/compiler/test/beam_type_SUITE.erl | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/compiler/src/beam_call_types.erl b/lib/compiler/src/beam_call_types.erl index f4065b2e15..7433d02940 100644 --- a/lib/compiler/src/beam_call_types.erl +++ b/lib/compiler/src/beam_call_types.erl @@ -730,7 +730,7 @@ erlang_band_type_1(LHS, Int) -> {Intersection, Union} = range_masks(Min0, Max0), Min = Intersection band Int, - Max = min(Max0, Union band Int), + Max = max(Min, min(Max0, Union band Int)), #t_integer{elements={Min,Max}}; #t_integer{} when Int >= 0 -> diff --git a/lib/compiler/test/beam_type_SUITE.erl b/lib/compiler/test/beam_type_SUITE.erl index 5189afde58..5f002f9541 100644 --- a/lib/compiler/test/beam_type_SUITE.erl +++ b/lib/compiler/test/beam_type_SUITE.erl @@ -90,6 +90,8 @@ integers(_Config) -> house = do_integers_7(), + {'EXIT',{badarith,_}} = (catch do_integers_8()), + ok. do_integers_1(B0) -> @@ -155,6 +157,9 @@ do_integers_7() -> house end. +do_integers_8() -> + -1 band ((0 div 0) band 0). + numbers(_Config) -> Int = id(42), true = is_integer(Int), -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor