[m-dev.] assertion failure in compiler

Julien Fischer juliensf at cs.mu.OZ.AU
Tue Dec 21 18:47:52 AEDT 2004


(This is (one of) the bugs that is breaking the nightly
builds on earth and jupiter and the moment - I've applied
a workaround for this one and (hopefully) fixed most of the
others)

The attached file, which is a very cut-down version of
the robdd module from the library that causes an assertion
failure in the compiler when compiled with:

	mmc --grade asm_fast.gc -O5 robdd_bug

(I tested this on earth and ascolais - it seems
to occur with most of the lowlevel C grades).

The asertion failure is:

	Uncaught Mercury exception:
	Software Error: map__lookup: key not found
		Key Type: term.var(parse_tree.prog_data.prog_var_type)
		Key Functor: var/1
		Value Type: ll_backend.var_locn.var_state
	Stack dump not available in this grade.

The call to map.lookup which throws the exception is the one
at var_locn.m:1107.

Cheers,
Julien.
-------------- next part --------------
% Causes the following assertion failure in the compiler:
%
%	Uncaught Mercury exception:
%	Software Error: map__lookup: key not found
%		Key Type: term.var(parse_tree.prog_data.prog_var_type)
%		Key Functor: var/1
%		Value Type: ll_backend.var_locn.var_state
%	Stack dump not available in this grade.
%
% Compile with: mmc --grade asm_fast.gc -O5 robdd_bug 

:- module robdd_bug.

:- interface.

:- import_module term, sparse_bitset.

:- type robdd(T).

:- type vars(T) == sparse_bitset(var(T)).

:- pred restrict_true_false_vars_2(vars(T)::in, vars(T)::in,
	robdd(T)::in, robdd(T)::out) is det.

:- implementation.

:- type robdd(T) ---> robdd(int).

:- func value(robdd(T)) = var(T).
:- func tr(robdd(T)) = robdd(T).

:- pragma foreign_proc("C",
	value(_F::in) = (Value::out),
	[will_not_call_mercury, promise_pure],
"
	Value = 0;
").

:- pragma foreign_proc("C",
	tr(_F::in) = (Tr::out),
	[will_not_call_mercury, promise_pure],
"
	Tr = 0;
").

restrict_true_false_vars_2(TrueVars0, FalseVars0, R0, R) :-
  	Var = value(R0),
   	TrueVars = sparse_bitset.remove_leq(TrueVars0, Var),
   	FalseVars = sparse_bitset.remove_leq(FalseVars0, Var),
  	restrict_true_false_vars_2(TrueVars, FalseVars,
  		tr(R0), R).


More information about the developers mailing list