2019-08-21 11:33 AEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000038mercuryBugpublic2008-01-16 14:02
Reporterrafe 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000038: Compiler aborts in detism analysis with inst any case in negated context
DescriptionTry compiling this module:

===
:- module negctxtbug.
:- interface.
:- import_module bool, list.

:- pred any_square(list(list(T))::ia, bool::out) is det.

:- implementation.
:- import_module int.

any_square(Xss, YN) :-
        N = any_length(Xss),
        promise_pure
        ( if all [Xs] (any_member(Xs, Xss) => any_length(Xs) = N)
          then YN = yes
          else YN = no
        ).

:- func any_length(list(T)::ia) = (int::out) is det.

any_length([]) = 0.
any_length([_ | Xs]) = 1 + any_length(Xs).

:- pred any_member(T::oa, list(T)::ia) is nondet.

any_member(X, [X | _ ]).
any_member(X, [_ | Xs]) :- any_member(X, Xs).
===
The if-then-else condition causes the compiler to abort with:
Making Mercury/int3s/negctxtbug.int3
Making Mercury/ints/negctxtbug.int
Making Mercury/hlc.gc.tr/x86_64-unknown-linux-gnu/Mercury/cs/negctxtbug.c
Uncaught Mercury exception:
Software Error: det_analysis.m: Unexpected: inappropriate determinism inside a negation
Stack dump follows:
   0 pred exception.throw/1-0 (erroneous) (exception.m:388)
   1 pred require.error/1-0 (erroneous) (require.m:122)
   2 pred libs.compiler_util.unexpected/2-0 (erroneous) (compiler_util.m:87)
   3 pred check_hlds.det_analysis.det_infer_not/10-0 (det) (det_analysis.m:1305)
   4 pred check_hlds.det_analysis.det_infer_goal_2/12-0 (det) (det_analysis.m:607)
   5 pred check_hlds.det_analysis.det_infer_goal/11-0 (det) (det_analysis.m:434)
   6 pred check_hlds.det_analysis.det_infer_if_then_else/15-0 (det) (det_analysis.m:1238)
...

If you change s/ia/in/;s/oa/out/ then the bug does not manifest itself.
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes
There are no notes attached to this issue.
+Notes

-Issue History
Date Modified Username Field Change
2008-01-16 14:02 rafe New Issue
+Issue History