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

Mark Brown dougl at cs.mu.OZ.AU
Mon Jan 27 22:55:15 AEDT 2003


Hi,

When compiled with '--opt-space', the following module exposes what appears
to be a bug in the cygwin C compiler installed on hermes.  The symptom is
that walking up the stack to retrieve the caller's label layout sometimes
returns the wrong layout.  Under mdb, the call event for the first call
to a/2 reports the calling context as line 11, which is correct.  However,
the call event for the second call to a/2 reports the same calling context,
when in fact the context should be line 13.

	:- module o.
	:- interface.
	:- import_module io.
	:- pred main(io__state::di, io__state::uo) is det.

	:- implementation.

	main -->
		(
			{
				a(1, X)		% line 11
			;
				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).

This bug has been causing tests/debugger/declarative/output_term_dep to
fail on hermes, hance the following workaround:

Estimated hours taken: 5
Branches: main, release

Work around a bug in the cygwin C compiler.

tests/debugger/declarative/Mercury.options:
	Pass '--optimize-fulljumps' when compiling the output_term_dep
	test case.

Index: tests/debugger/declarative/Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mercury.options,v
retrieving revision 1.5
diff -u -r1.5 Mercury.options
--- tests/debugger/declarative/Mercury.options	22 Oct 2002 04:36:22 -0000	1.5
+++ tests/debugger/declarative/Mercury.options	27 Jan 2003 11:35:28 -0000
@@ -3,7 +3,9 @@
 MCFLAGS-dependency=--trace rep
 MCFLAGS-dependency2=--trace rep
 MCFLAGS-input_term_dep=--trace rep
-MCFLAGS-output_term_dep=--trace rep
+# The following test case triggers a bug in the C compiler under cygwin
+# if --no-optimize-fulljumps is given (or if --opt-space is given).
+MCFLAGS-output_term_dep=--trace rep --optimize-fulljumps
 MCFLAGS-shallow_2=--trace shallow
 MCFLAGS-special_term_dep=--trace rep
 MCFLAGS-tabled_read_decl=--trace rep --trace-table-io-all
--------------------------------------------------------------------------
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