Opened 12 years ago

Closed 12 years ago

Last modified 44 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: Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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
below).

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 www.haskell.org/afrp.

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

--
Henrik Nilsson
Yale University
nilsson@cs.yale.edu

Attachments (1)

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

Download all attachments as: .zip

Change History (2)

Changed 12 years ago by nhn

comment:1 Changed 12 years ago by simonmar

  • Status changed from assigned to closed
Logged In: YES 
user_id=48280

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.