[m-rev.] for review: fix bug 432

Peter Wang novalazy at gmail.com
Thu May 13 13:26:30 AEST 2021


On Thu, 13 May 2021 13:04:17 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> diff --git a/tests/hard_coded/Mmakefile b/tests/hard_coded/Mmakefile
> index a5b0e998d..594d43d7e 100644
> --- a/tests/hard_coded/Mmakefile
> +++ b/tests/hard_coded/Mmakefile
> @@ -65,6 +65,7 @@ ORDINARY_PROGS = \
>  	complicated_unify_bug \
>  	conditional_trace_scope \
>  	constant_prop_1 \
> +	constant_prop_loop_inv \
>  	constraint \
>  	constraint_order \
>  	construct_bug \

You may need to place constant_prop_loop_inv in the confusingly-named
PROF_PROGS list, for the same reason as constant_prop_2.

> diff --git a/tests/hard_coded/constant_prop_loop_inv.m b/tests/hard_coded/constant_prop_loop_inv.m
> index e69de29bb..84fcf5352 100644
> --- a/tests/hard_coded/constant_prop_loop_inv.m
> +++ b/tests/hard_coded/constant_prop_loop_inv.m
> @@ -0,0 +1,31 @@
> +%---------------------------------------------------------------------------%
> +% vim: ts=4 sw=4 et ft=mercury
> +%---------------------------------------------------------------------------%
> +%
> +% This is a regression test for Mantis bug 532.
> +%
> +
> +:- module constant_prop_loop_inv.
> +:- interface.
> +:- import_module io.
> +
> +:- pred main(io::di, io::uo) is det.
> +
> +:- implementation.
> +
> +:- import_module float.
> +:- import_module int.
> +:- import_module string.
> +:- import_module uint.

You can delete unused imports.

> +
> +main(!IO) :-
> +    ( if "abc" ++ "xyz" = "abcxyz" then
> +        io.write_string("yes\n", !IO)
> +    else
> +        link_error(!IO)
> +    ).
> +
> +    % We should be able to optimize away the call to this procedure
> +    % at compile time, so we should not even emit a reference to it.
> +:- pred link_error(io::di, io::uo) is det.
> +:- pragma external_pred(link_error/2).

That looks fine, otherwise.

Peter


More information about the reviews mailing list