[m-rev.] trivial diff: workaround cygwin C compiler bug

Mark Brown dougl at cs.mu.OZ.AU
Tue Feb 4 15:04:15 AEDT 2003


On 03-Feb-2003, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> So the best solution that I can think of is to change the way that the
> Mercury compiler generates code so that it generates something which
> GCC will think is distinct at each label -- for example, a different
> assembler comment.

I discussed this in person with Fergus.  I was surprised that adding a
comment should make any difference here, but it does -- the reason is
that it is the C compiler doing the duplicate code elimination, not the
assembler.  The compiler doesn't attempt to parse assembler code, so it
doesn't know that different assembler comments generate the same code.

> Estimated hours taken: 5
> Branches: main
> 
> Fix a bug that broke tests/debugger/declarative/output_term_dep
> with `--opt-space' when using gcc 3.1.

... so this diff is fine, but don't forget to remove the workaround
I posted which should no longer be needed.

After the above change is committed, I'll add the following test case to
the suite.

Cheers,
Mark.

Estimated hours taken: 0.5
Branches: main

tests/debugger/Mmakefile:
tests/debugger/label_layout.exp:
tests/debugger/label_layout.inp:
tests/debugger/label_layout.m:
	A regression test for the bug that was recently causing
	output_term_dep to fail.  This is a much smaller and simpler
	test case than the existing one.

tests/debugger/Mercury.options:
	Pass --opt-space to mmc for this test, since the problem only showed
	up with that option.

Index: tests/debugger/Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/Mercury.options,v
retrieving revision 1.5
diff -u -r1.5 Mercury.options
--- tests/debugger/Mercury.options	30 Jan 2003 05:59:25 -0000	1.5
+++ tests/debugger/Mercury.options	4 Feb 2003 03:41:16 -0000
@@ -3,6 +3,9 @@
 # the input is not a terminal.
 MLFLAGS-completion = --runtime-flags --force-readline
 
+# The label_layout test is for a bug that showed up only with --opt-space.
+MCFLAGS-label_layout = --opt-space
+
 MCFLAGS-no_inline_builtins = --no-inline-builtins
 MCFLAGS-queens_rep = --trace rep
 MCFLAGS-shallow = --trace shallow
Index: tests/debugger/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/Mmakefile,v
retrieving revision 1.93
diff -u -r1.93 Mmakefile
--- tests/debugger/Mmakefile	30 Jan 2003 05:59:25 -0000	1.93
+++ tests/debugger/Mmakefile	4 Feb 2003 03:39:16 -0000
@@ -27,6 +27,7 @@
 	higher_order			\
 	implied_instance		\
 	interpreter			\
+	label_layout			\
 	loopcheck			\
 	lval_desc_array			\
 	multi_parameter			\
@@ -263,6 +264,9 @@
 implied_instance.out: implied_instance implied_instance.inp
 	$(MDB) ./implied_instance < implied_instance.inp \
 		> implied_instance.out 2>&1
+
+label_layout.out: label_layout label_layout.inp
+	$(MDB) ./label_layout < label_layout.inp > label_layout.out 2>&1
 
 loopcheck.out: loopcheck loopcheck.inp
 	if $(MDB) ./loopcheck < loopcheck.inp			\
Index: tests/debugger/label_layout.exp
===================================================================
RCS file: tests/debugger/label_layout.exp
diff -N tests/debugger/label_layout.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/label_layout.exp	4 Feb 2003 03:39:16 -0000
@@ -0,0 +1,15 @@
+       1:      1  1 CALL pred label_layout:main/2-0 (det) label_layout.m:18
+mdb> echo on
+Command echo enabled.
+mdb> register --quiet
+mdb> break a
+ 0: + stop  interface pred label_layout:a/2-0 (det)
+mdb> continue
+       4:      2  2 CALL pred label_layout:a/2-0 (det) label_layout.m:24 (label_layout.m:11)
+mdb> finish
+       5:      2  2 EXIT pred label_layout:a/2-0 (det) label_layout.m:24 (label_layout.m:11)
+mdb> continue
+       7:      3  2 CALL pred label_layout:a/2-0 (det) label_layout.m:24 (label_layout.m:13)
+mdb> finish
+       8:      3  2 EXIT pred label_layout:a/2-0 (det) label_layout.m:24 (label_layout.m:13)
+mdb> quit -y
Index: tests/debugger/label_layout.inp
===================================================================
RCS file: tests/debugger/label_layout.inp
diff -N tests/debugger/label_layout.inp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/label_layout.inp	4 Feb 2003 03:39:16 -0000
@@ -0,0 +1,8 @@
+echo on
+register --quiet
+break a
+continue
+finish
+continue
+finish
+quit -y
Index: tests/debugger/label_layout.m
===================================================================
RCS file: tests/debugger/label_layout.m
diff -N tests/debugger/label_layout.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/label_layout.m	4 Feb 2003 03:39:16 -0000
@@ -0,0 +1,25 @@
+:- module label_layout.
+:- interface.
+:- import_module io.
+:- pred main(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+main -->
+	(
+		{
+			a(1, X)
+		;
+			a(2, X)
+		},
+		{ X = 0 }
+	->
+		io__write_string("yes\n")
+	;
+		io__write_string("no\n")
+	).
+
+:- pred a(int::in, int::out) is det.
+
+a(X, 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