diff: test cases for .agc bugs.

Tyson Richard DOWD trd at cs.mu.oz.au
Tue May 13 14:32:19 AEST 1997


Hi,

	Can someone review these? They are the test cases for the bugs
	I recently fixed.

===================================================================

Estimated hours taken: 1

Add test cases for recently accurate garbage collection compilation
problems.

tests/valid/Mmake:
tests/valid/agc_unused_in.m:
	Test case for getting liveness right with an unused polymorphic typed
	variable with a mode of `in'.

tests/valid/agc_unbound_typevars.m:
	Test case for keeping the information needed for unbound type
	variables.

Index: tests/valid/Mmake
===================================================================
RCS file: /home/staff/zs/imp/tests/valid/Mmake,v
retrieving revision 1.36
diff -u -r1.36 Mmake
--- Mmake	1997/05/11 11:00:55	1.36
+++ Mmake	1997/05/13 03:39:38
@@ -8,6 +8,8 @@
 
 # please keep this list sorted
 SOURCES= \
+	agc_unbound_typevars.m \
+	agc_unused_in.m \
 	compl_unify_bug.m \
 	complicated_unify.m \
 	constructor_arg_names.m \
@@ -73,6 +75,8 @@
 
 # some regression tests only failed with particular options enabled
 # (please keep this list sorted)
+MCFLAGS-agc_unbound_typevars	= --grade asm_fast.agc
+MCFLAGS-agc_unused_in		= --grade asm_fast.agc
 MCFLAGS-compl_unify_bug		= -O3
 MCFLAGS-middle_rec_labels	= --middle-rec --no-follow-vars 
 MCFLAGS-simplify_bug		= -O-1


New File: tests/valid/agc_unbound_typevars.m
===================================================================
% 
% Regression test.
%
% Name: agc_unbound_typevars.m
%
% Description of bug:
% 	This module uses code that contains unbound type variables. The
% 	compiler was not recording what variables the type variables
% 	were mapped to in this case.
%
% Symptom(s) of bug:
% 	Map lookups fail when looking up unbound type variables.
%
% Date bug existed: 11-May-1997
%
% Author: trd

:- module agc_unbound_typevars.
:- interface.

:- pred foo(int::out) is det.

:- implementation.

:- import_module std_util, int, map.

foo(X) :-
	TypeInfo = type_of([]), 
	map__init(Map),
	TypeInfo2 = type_of(Map), 
	N = num_functors(TypeInfo),
	M = num_functors(TypeInfo2),
	X = N + M.

New File: tests/valid/agc_used_in.m
===================================================================
%
% Regression test.
%
% Name: agc_used_in.m
%
% Description of bug:
% 	This module uses code that has a variable of type T that is
% 	unused, but has mode in (the argument of `type_of' has mode
% 	unused). This caused problems since the variable was considered 
% 	always live because there was no use of the variable that killed it. 
% 	In accurate gc grades, it caused the compiler to try to save the
% 	typeinfo associated with it (TypeInfo_for_T).
%
% Symptom(s) of bug:
% 	Map lookups fail when trying to save TypeInfo_for_T, or cannot
% 	find stackslots for the variable.
%
% Date bug existed: 11-May-1997
%
% Author: trd

:- module agc_unused_in.
:- interface.

:- pred test_1(T::in, string::out) is det.

%----------------------------------------------------------------------------%
:- implementation.

:- import_module std_util.

test_1(T, N) :-
	Info = type_of(T),
	N = type_name(Info).

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't eveyone's cup of
     trd at cs.mu.oz.au        #  fur.
http://www.cs.mu.oz.au/~trd #



More information about the developers mailing list