[m-dev.] problem with value numbering & floating point

Zoltan Somogyi zs at cs.mu.oz.au
Mon Jul 21 18:05:09 AEST 1997


> The currently installed compiler is failing various test cases involving
> floating point numbers, e.g. tests/hard_coded/float_round_bug.m, at -O4
> and higher.  The problem seems to be in value numbering (although it
> might perhaps be somewhere else, if value numbering was itself miscompiled).

The problem does not occur when the compiler is executed with SICStus.
It does occur when the compiler is executed with Mercury, on both
cyclone and kryten.

The problem is not in value numbering but in the map routines it calls.
I have created a small test case:

:- module float_map.

:- interface.
:- import_module io.

:- pred main(io__state::di, io__state::uo) is det.

:- implementation.

:- import_module map, float.

main(S0, S) :-
	map__init(M1),
	map__det_insert(M1, 1.0, 5, M2),
	( map__search(M2, 14.5, _) ->
		io__write_string("found it: bug\n", S0, S)
	;
		io__write_string("did not find it: ok\n", S0, S)
	).

This fails as it is; however, it succeeds when the 14.5 is replaced
with 0.5. I don't know why, but my guess is that the problem concerns
unboxed floats and the higher-order calls to compare/3 from map.

Fergus, do you want to take a crack at it?

Zoltan.



More information about the developers mailing list