[m-rev.] diff: fix mantis bug 452
Peter Wang
novalazy at gmail.com
Thu Feb 22 14:00:20 AEDT 2018
On Thu, 22 Feb 2018 13:32:50 +1100 (AEDT), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> A simple fix.
>
> diff --git a/tests/hard_coded/bug452.m b/tests/hard_coded/bug452.m
> index e69de29..f2cf7f6 100644
> --- a/tests/hard_coded/bug452.m
> +++ b/tests/hard_coded/bug452.m
> @@ -0,0 +1,88 @@
> +%---------------------------------------------------------------------------%
> +% vim: ts=4 sw=4 et ft=mercury
> +%---------------------------------------------------------------------------%
> +%
> +% This program used to get a compiler abort in hlc.gc.
> +% This happened because find_int_lookup_switch_params in switch_util.m
> +% said that the inner switch on Thing in classify/2 below needed a bit vector
> +% check. It said so because the inner switch does not cover Thing = nothing.
> +% However, it does *need* to cover Thing = nothing, because the inner switch
does *not* need
> +% is reached only in the arm of the outer switch that is not taken when
> +% Thing = nothing.
> +
> +% In general, cannot_fail switches should not need either bit vector
> +% or range checks. The compiler abort happensed because the MLDS code generator
> +% had sanity checks (assertions) to this effect. The LLDS code generator
> +% just silently generated an unnecessary bit vector check, which would execute
> +% incorrect code if the check failed; however, for these cannot_fail switches,
> +% the check could never fail.
> +%
Thanks for the fix.
Peter
More information about the reviews
mailing list