Mercury Bugs - mercury
View Issue Details
0000405mercuryBugpublic2016-02-20 03:042016-02-23 03:24
Assigned To 
Platformamd64OSWindowsOS Version8.1
Product Version 
Target VersionFixed in Version 
Summary0000405: Compiler Software Exception in Certain Projects
DescriptionTrying to build my project MEdit, I run into the following error:

Uncaught Mercury exception:
Software Error: check_hlds.cse_detection: predicate `check_hlds.cse_detection.detect_cse_in_proc'/4: Unexpected: mode check fails when repeated

I had thought this was only an issue with Mercury 14, but it seems to occur with the newest ROTD as well.
Steps To ReproduceDownload the MEdit sources from
Run either just `make` (which requires yasm) or `make medit_mercury`
Additional InformationI'm not really sure if this is actually an error in the compiler or in my own code, but if it is in my code the error reporting could be much improved.
TagsNo tags attached.
Attached Files

2016-02-20 10:50   
(Last edited: 2016-02-20 13:00)
The code relies on nested unique modes, which are not supported. This is a known limitation. In this case it seems to be compounded by another mode error in your code, in the use of SizeIn+0 as an input parameter. (Edit: disregard that last sentence.)

The compiler fails to report the problem accurately.

What is the purpose of writing SizeIn+0 instead of just SizeIn?

2016-02-20 11:06   
(Last edited: 2016-02-20 11:07)
The purpose is to allow a unique output which is partially composed of a non-unique integer input.

What do you mean by nested unique modes?

2016-02-20 12:58   
By nested unique modes I mean modes for structured terms in which the uniqueness of the subterms is significant. That includes being partially composed of a non-unique term, as is the case in what you are attempting.

Is the bug report just that the compiler throws an exception instead of giving a spurious mode error, as it says in the reference manual?
2016-02-20 13:51   
(Last edited: 2016-02-23 03:24)
This bug report is simply that the compiler throws an exception.

2016-02-20 15:23   
Confirm that this is a bug. The compiler should give a proper error message when attempting to use nested unique modes.

Note that the feature itself is officially NYI.

Issue History
2016-02-20 03:04FlyingJesterNew Issue
2016-02-20 10:25markAssigned To => mark
2016-02-20 10:25markStatusnew => assigned
2016-02-20 10:25markAssigned Tomark =>
2016-02-20 10:26markStatusassigned => new
2016-02-20 10:50markNote Added: 0000878
2016-02-20 11:06FlyingJesterNote Added: 0000879
2016-02-20 11:07FlyingJesterNote Edited: 0000879bug_revision_view_page.php?bugnote_id=879#r40
2016-02-20 12:58markNote Added: 0000880
2016-02-20 13:00markNote Edited: 0000878bug_revision_view_page.php?bugnote_id=878#r42
2016-02-20 13:51FlyingJesterNote Added: 0000881
2016-02-20 15:23markNote Added: 0000882
2016-02-20 15:23markStatusnew => confirmed
2016-02-23 03:24FlyingJesterNote Edited: 0000881bug_revision_view_page.php?bugnote_id=881#r44