Opened 15 years ago

Closed 15 years ago

Last modified 48 years ago

#79 closed bug (Fixed)

Optimizer introduces non-termination

Reported by: nhn Owned by: simonmar
Priority: normal Milestone:
Component: Compiler Version: 5.04
Keywords: Cc:
Operating System: Architecture:
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


When compiled with GHC 5.04 and optimization turned on
(-O), AFRP's regression tests fail to terminate. When
compiled with -O0, everything works, except that
somewhat dubious C code seems to be generated (see

I've included a version of the regression tests with
as much code as possible commented out, but you may
need the entire AFRP distribution to make progress on
this one. You can get it as part of the AFrob/AFRP
bundle at

In the regression tests, the following logical
conjunction is used to check if all tests succeeded:

allGood = {- arr_tr
          && comp_tr
          && -} first_tr
          && second_tr
          && laws_tr
          && loop_tr {-
          && looplaws_tr
          && basicsf_tr
          && evsrc_tr
 	  && coc_tr
 	  && switch_tr
 	  && kswitch_tr
 	  && rswitch_tr
 	  && pswitch_tr
 	  && rpswitch_tr
 	  && wfg_tr
	  && accum_tr
 	  && delay_tr
	  && der_tr
	  && loopPre_tr
	  && loopIntegral_tr
	  && react_tr
	  && embed_tr
	  && utils_tr
	  && task_tr

With only the code for the tests "first", "second",
"laws", and "loop" left, and consequently only the
corresponding four boolean test results left in the
above conjunction, the regression tests fail to
terminate when compiled with -O.

However, if I comment out ANY ONE (or more) of the
four boolean result flags from the conjunction above,
the remaining tests do terminate. Thus there does
not appear to be one single test that fails, but
somehow it is the combination of these four tests
that for some reason results in invalid optimizations.

Additionally, when I compile the main module
(testAFRPMain.hs) with no optimization (-O0), I get
the follwing warning:

ghc -c  -fglasgow-exts -O -package lang -package
concurrent -i/usr/local/lib/ghc/imports/arrow:../src
-O0 -o testAFRPMain.o testAFRPMain.hs
/tmp/ghc17120.hc:1150: warning: initialization discards
qualifiers from pointer target type

Again, I'm a bit surprised that C code is generated
here? I thought I was using the native code
generator? This is on a Linux x86 platform.


Henrik Nilsson
Yale University

Attachments (1)

AFRPTests.hs.2.cutdown (93.8 KB) - added by nhn 15 years ago.

Download all attachments as: .zip

Change History (2)

Changed 15 years ago by nhn

Attachment: AFRPTests.hs.2.cutdown added

comment:1 Changed 15 years ago by simonmar

Status: assignedclosed
Logged In: YES 

This was caused by a bug in the garbage collector, which 
has now been fixed.  Thanks for the report.
Note: See TracTickets for help on using tickets.