[m-rev.] diff: bug with polymorphic modes and intermodule optimization

Julien Fischer juliensf at cs.mu.OZ.AU
Thu Nov 3 18:03:00 AEDT 2005


Estimated hours taken: 0.2
Branches: main

tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/hard_coded/intermod_poly_mode.m:
tests/hard_coded/intermod_poly_mode_2.m:
tests/hard_coded/intermod_poly_mode.exp:
	Add a test case that exposes a bug with intermodule optimization.

Julien.

Index: Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/Mercury.options,v
retrieving revision 1.13
diff -u -r1.13 Mercury.options
--- Mercury.options	2 Dec 2004 08:03:56 -0000	1.13
+++ Mercury.options	3 Nov 2005 06:56:46 -0000
@@ -17,6 +17,8 @@
 MCFLAGS-intermod_c_code2 =	--intermodule-optimization
 MCFLAGS-intermod_foreign_type = --intermodule-optimization
 MCFLAGS-intermod_foreign_type2 = --intermodule-optimization
+MCFLAGS-intermod_poly_mode = --intermodule-optimization
+MCFLAGS-intermod_poly_mode_2 = --intermodule-optimization
 MCFLAGS-intermod_pragma_clause = --intermodule-optimization
 MCFLAGS-intermod_pragma_clause_sub = --intermodule-optimization
 MCFLAGS-intermod_type_qual =	--intermodule-optimization
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.273
diff -u -r1.273 Mmakefile
--- Mmakefile	26 Oct 2005 03:04:25 -0000	1.273
+++ Mmakefile	3 Nov 2005 06:56:08 -0000
@@ -106,6 +106,7 @@
 	intermod_c_code \
 	intermod_foreign_type \
 	intermod_multimode_main \
+	intermod_poly_mode \
 	intermod_pragma_clause \
 	intermod_type_qual \
 	int_fold_up_down \
Index: intermod_poly_mode.exp
===================================================================
RCS file: intermod_poly_mode.exp
diff -N intermod_poly_mode.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ intermod_poly_mode.exp	3 Nov 2005 06:55:36 -0000
@@ -0,0 +1 @@
+561
Index: intermod_poly_mode.m
===================================================================
RCS file: intermod_poly_mode.m
diff -N intermod_poly_mode.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ intermod_poly_mode.m	3 Nov 2005 06:59:05 -0000
@@ -0,0 +1,22 @@
+%
+% This test case exposes a bug with intermodule optimization
+% in rotd-2005-11-02 and before.  (This is a cut-down version
+% of the original test case provided by Peter Hawkins.)
+%
+:- module intermod_poly_mode.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io::di, io::uo) is det.
+
+:- implementation.
+
+:- import_module int.
+:- import_module intermod_poly_mode_2.
+
+main(!IO) :-
+	New = new(561),
+	io.write(New, !IO),
+	io.nl(!IO).
Index: intermod_poly_mode_2.m
===================================================================
RCS file: intermod_poly_mode_2.m
diff -N intermod_poly_mode_2.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ intermod_poly_mode_2.m	3 Nov 2005 06:55:36 -0000
@@ -0,0 +1,14 @@
+:- module intermod_poly_mode_2.
+
+:- interface.
+
+:- func new(T::in(I)) = (T::out(I)) is det.
+
+:- implementation.
+
+:- pragma foreign_proc("C",
+	new(X::in(I)) = (R::out(I)),
+	[promise_pure, will_not_call_mercury],
+"
+	R = X;
+").

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list