2024-11-22 00:15 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000047mercuryBugpublic2008-02-25 13:29
Reporteruser57 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000047: mutable dependency problem
DescriptionThe program (attached) contains two mutables `a' and `b' whose initialisation mutually depends on each other. Thus to initialise `a' we need the value of `b' and vice versa. Mercury does not detect this problem, and happily compiles the program, which (unsurprisingly) seg. faults when you try and run it.

Note that non-mutual dependencies may also be a problem, depending on the order the mutables are initialised. This is how the bug was discovered.
TagsNo tags attached.
Attached Files
  • ? file icon crash.m (485 bytes) 2008-02-25 11:43

-Relationships
+Relationships

-Notes

~0000079

juliensf (administrator)

In *this* case it could be detected, but in general it is not possible to detect this at compile-time.

The order in which mutables are initialised is specified in the reference manual, for initialisations
within a module it is:

    For the purposes of determining when mutables are assigned their initial values, the expression `initial_value' behaves as though it were a predicate specified in an `initialise' directive.

There is no initialisation order assumed beteween (sub-)modules.

As a matter of practice I recommend that mutable initialisation expressions should not call mutable
access predicates (I will add this to the reference manual).
+Notes

-Issue History
Date Modified Username Field Change
2008-02-25 11:43 user57 New Issue
2008-02-25 11:43 user57 File Added: crash.m
2008-02-25 13:29 juliensf Note Added: 0000079
+Issue History