|View Issue Details [ Jump to Notes ]||[ Issue History ] [ Print ]|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000047||mercury||Bug||public||2008-02-25 11:43||2008-02-25 13:29|
|Target Version||Fixed in Version|
|Summary||0000047: mutable dependency problem|
|Description||The 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.
|Tags||No tags attached.|
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).
||File Added: crash.m|
|2008-02-25 13:29||juliensf||Note Added: 0000079|