Opened 9 years ago

Closed 9 years ago

Last modified 44 years ago

#395 closed bug (Fixed)

non-termination without optimization

Reported by: c_maeder Owned by: simonmar
Priority: normal Milestone:
Component: Compiler Version: 6.4
Keywords: Cc:
Operating System: Architecture:
Type of failure: Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

I've found a (relatively) small example that does not
terminate if
translated unoptimized under linux with ghc-6.4 or
ghc-6.4.1, although it should (and does with ghc-6.2.2).

I compile with:

ghc --make trans.hs -o trans -no-recomp

and let the program process the file "Map.hs" (that is
merely used as
input data) several times. While "./trans" sometimes
succeeds to
translate Map.hs a couple of times it fails to
translate it more times
and leaves a half translated file Map.hs.trans.
Unfortunately the exact
amount of data that needs to be processed varies in
order to tickle the
bug. (7 times Map.hs below, up to 11 times in other cases).

The program terminates as expected if I use my
(included) Map.hs instead of Data.Map, or if I declare
the character map to be a separate
constant, or if I compile with optimization.

If compiled unoptimized with profiling it also does not
terminate.

maeder@jupiter -> uname -a
Linux jupiter 2.6.8-24.14-smp #1 SMP Tue Mar 29
09:27:43 UTC 2005 i686
i686 i386GNU/Linux

maeder@jupiter -> gcc --version
gcc (GCC) 3.3.4 (pre 3.3.5 20040809)
Copyright (C) 2003 Free Software Foundation, Inc.

maeder@jupiter -> ghc --version
The Glorious Glasgow Haskell Compilation System,
version 6.4.1.20050517

maeder@jupiter -> ghc --make trans.hs -o trans -no-recomp
Chasing modules from: trans.hs
Compiling Main             ( trans.hs, trans.o )
Linking ...

maeder@jupiter -> date
Fr Mai 20 10:27:00 CEST 2005

maeder@jupiter -> time ./trans Map.hs Map.hs Map.hs
Map.hs Map.hs Map.hs

real    0m20.732s
user    0m20.298s
sys     0m0.031s

maeder@jupiter -> ll Map.*
-rw-r--r--  1 maeder wimi  57184 2005-05-20 09:31 Map.hs
-rw-r--r--  1 maeder wimi 207572 2005-05-20 10:27
Map.hs.trans

maeder@jupiter -> time ./trans Map.hs Map.hs Map.hs
Map.hs Map.hs Map.hs
Map.hs
trans: interrupted

real    4m29.816s
user    4m5.554s
sys     0m24.120s

maeder@jupiter -> ll Map.*
-rw-r--r--  1 maeder wimi 57184 2005-05-20 09:31 Map.hs
-rw-r--r--  1 maeder wimi 98304 2005-05-20 10:28
Map.hs.trans




Attachments (1)

transMap.2.tgz (13.9 KB) - added by c_maeder 9 years ago.

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by c_maeder

comment:1 Changed 9 years ago by simonpj

Logged In: YES 
user_id=50165

Christian,

I tried this, but I couldn't get the behaviour you observed. 

Certainly, the program can be very slow without -O, becuase 
iside the inner (per-input-character) loop, you are rebuilding 
the character translation map.  But it still works fine for me, 
no matter how many copies of Map I give it.  

I'm using the HEAD.

I'm not sure how to proceed.  Does this happen with the 
released GHC 6.4?

Simon

comment:2 Changed 9 years ago by c_maeder

Logged In: YES 
user_id=1285667

Hi Simon,

Yes, I used the released GHC 6.4! (and an intermediate
ghc-6.4.1)

As you can see in my original report, processing the file
Map.hs 6 times took 20 secs (ie. less than 4 secs for one
Map.hs). However, Map.hs 7 times on the command line failed
to finish for more than 4 minutes. (ghc seemed to hang but
was running.) 

Please try again with maybe 12 occurrences of Map.hs on the
command line.

What do you mean by rather slow? 4 secs per Map.hs seems
reasonable to me.

Meanwhile, I'll test if some of my environment setting (ie.
LC_CTYPE) does influence the reproducability.

Cheers Christian
 

comment:3 Changed 9 years ago by c_maeder

Logged In: YES 
user_id=1285667

I have no problems to reproduce the error on two of our
linux machines. Can someelse also try to reproduce this
behaviour?

Christian 

maeder@turing:~/haskell/examples> time ./trans Map.hs Map.hs
Map.hs Map.hs Map.hs Map.hs Map.hs

real    0m23.542s
user    0m22.954s
sys     0m0.118s
maeder@turing:~/haskell/examples> set | less
maeder@turing:~/haskell/examples> time ./trans Map.hs Map.hs
Map.hs Map.hs Map.hs Map.hs Map.hs Map.hs
trans: interrupted

real    3m43.887s
user    3m27.224s
sys     0m13.813s
maeder@turing:~/haskell/examples> ll Map.hs*
-rw-r--r--  1 maeder wimi 57184 2005-05-19 21:52 Map.hs
-rw-r--r--  1 maeder wimi 73728 2005-06-10 16:14 Map.hs.trans

comment:4 Changed 9 years ago by c_maeder

Logged In: YES 
user_id=1285667

The error shows up even more dramatic under solaris and on a
mac(!) with Wolfgang's binary:

maeder@leo -> time ./trans Map.hs

real    0m11.346s
user    0m9.250s
sys     0m0.010s
maeder@leo -> time ./trans Map.hs Map.hs
^Ctrans: interrupted

real    4m41.918s
user    3m25.610s
sys     0m7.900s
maeder@leo -> ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.4.1
maeder@leo -> uname -a
SunOS leo 5.8 Generic_117350-20 sun4u sparc SUNW,Sun-Fire-280R

----------------------------------------------------------------------------

maeder@isylvie:~/haskell> time ./trans Map.hs
^Ctrans: interrupted

real    4m58.311s
user    3m59.070s
sys     0m38.850s
maeder@isylvie:~/haskell> uname -a
Darwin isylvie.informatik.uni-bremen.de 7.8.0 Darwin Kernel
Version 7.8.0: Wed Dec 22 14:26:17 PST 2004;
root:xnu/xnu-517.11.1.obj~1/RELEASE_PPC  Power Macintoshpowerpc
maeder@isylvie:~/haskell> ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.4


comment:5 Changed 9 years ago by simonpj

Logged In: YES 
user_id=50165

OK, we can reproduce it now.  It only happens on the 
*current* stable branch, not on the released 6.4.

We'll look at it.

comment:6 Changed 9 years ago by simonmar

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

Very hard bug to reproduce, but eventually tracked down and
now fixed.  Thanks!
Note: See TracTickets for help on using tickets.