2024-11-21 23:47 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000278mercuryBugpublic2015-10-29 14:47
Reporterpbone 
Assigned Tozs 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Platformx86_64OSDebian LinuxOS Version7.0
Product Version 
Target Version15.11Fixed in Version 
Summary0000278: Compiler crash from bad state variable use.
DescriptionIf I refer to the wrong state variable in the head of a lambda expression, I can reliably crash the compiler. I have a test case.
Steps To ReproduceAttached in the testcase It crashes when I compile it with 'mmc --make' It also crashes in the Java grade.

mmc -V prints out the following just before the crash.
% Converting parse tree to hlds...
% Processing clause 1 for predicate `bug.main/2'...
% Processing clause 1 for predicate `bug.build_map/5'...

The exception thrown is:
Uncaught Mercury exception:
Software Error: hlds.make_hlds.state_var: predicate `hlds.make_hlds.state_var.svar_find_final_renames_and_copy_goals'/7: Unexpected: readonly status
Stack dump not available in this grade.
** Error making `Mercury/cs/bug.c'.

I'm using the 12.08 beta (The release MCit is using)
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0000502

juliensf (administrator)

In principle this is easy to fix, just replace the relevant call to unexpected/2 in compiler/state_var.m
with something that generates a proper error message. The issue is: what should that error message
be? (Probably, before zs rewrote the state var transformation this would have been picked up
later by mode checking ...)

~0000503

juliensf (administrator)

It (hopefully) goes without saying, that this has nothing do with what backend is being used!

~0000532

juliensf (administrator)

Actually, with Mercury 10.04.2, lots of phases picked up the error:


bug278.m:023: In clause for predicate `build_map'/5:
bug278.m:023: in argument 1 of call to predicate `list.foldl2'/6:
bug278.m:023: type error: argument has type `pred(tree234.tree234(K, V), V,
bug278.m:023: tree234.tree234(K, V), V_11, V_9)',
bug278.m:023: expected type was `pred(L, A, A, Z, Z)'.
bug278.m:023: In clause for predicate `bug278.build_map'/5:
bug278.m:023: warning: variable `STATE_VARIABLE_MemoTable' occurs only once
bug278.m:023: in this scope.
bug278.m:028: In clause for predicate `build_map'/5:
bug278.m:028: in argument 1 (i.e. the predicate term) of higher-order
bug278.m:028: predicate call:
bug278.m:028: type error: variable `KeyToValue' has type `(some [K, V]
bug278.m:028: pred(K, V))',
bug278.m:028: expected type was `pred(V_13, V_12, V_11, V_10)'.
bug278.m:030: In clause for predicate `build_map'/5:
bug278.m:030: in implicit state variable unification:
bug278.m:030: type error in unification of variable `STATE_VARIABLE_M_1'
bug278.m:030: and variable `STATE_VARIABLE_M_0'.
bug278.m:030: `STATE_VARIABLE_M_1' has type `tree234.tree234(K, V)',
bug278.m:030: `STATE_VARIABLE_M_0' has type `V'.

The issue here is: what is an appropriate error message to generate during the state var transformation?

~0000856

zs (developer)

fix committed 2015 oct 22.
+Notes

-Issue History
Date Modified Username Field Change
2013-04-04 23:16 pbone New Issue
2013-04-04 23:19 pbone File Added: bug278.m
2013-04-10 16:06 juliensf Note Added: 0000502
2013-04-10 16:06 juliensf Assigned To => juliensf
2013-04-10 16:06 juliensf Status new => confirmed
2013-04-10 16:07 juliensf Note Added: 0000503
2013-05-29 00:43 juliensf Note Added: 0000532
2015-10-21 11:33 zs Assigned To juliensf => zs
2015-10-21 11:33 zs Status confirmed => assigned
2015-10-22 06:49 zs Note Added: 0000856
2015-10-22 06:49 zs Status assigned => resolved
2015-10-22 06:49 zs Resolution open => fixed
2015-10-29 14:47 pbone Target Version => 15.11
+Issue History