Ticket #7366 (closed bug: fixed)

Opened 7 months ago

Last modified 7 months ago

Strange data corruption with HEAD

Reported by: bgamari Owned by:
Priority: normal Milestone: 7.8.1
Component: Compiler Version: 7.7
Keywords: Cc: bgamari@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Building GHC failed Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Since at least 5f37e0c ghc has failed to build for me. The failure occurs early in the final stage build, showing up as,

"inplace/bin/ghc-stage2" -fPIC -dynamic  -H32m -O    -hide-all-packages -i -iutils/haddock/src -iutils/haddock/dist/build -iutils/haddock/dist/build/autogen -Iutils/haddock/dist/build -Iutils/haddock/dist/build/autogen    -optP-DIN_GHC_TREE -optP-include -optPutils/haddock/dist/build/autogen/cabal_macros.h -package Cabal-1.17.0 -package array-0.4.0.1 -package base-4.6.0.0 -package containers-0.5.0.0 -package directory-1.2.0.0 -package filepath-1.3.0.1 -package ghc-7.7.20121024 -package pretty-1.1.1.0 -package xhtml-3000.2.1 -package deepseq-1.3.0.1  -funbox-strict-fields -O2 -Wall -fwarn-tabs -XHaskell2010 -XCPP -XDeriveDataTypeable -XScopedTypeVariables -XMagicHash  -no-user-package-db -rtsopts      -odir utils/haddock/dist/build -hidir utils/haddock/dist/build -stubdir utils/haddock/dist/build -hisuf dyn_hi -osuf  dyn_o -hcsuf dyn_hc -c utils/haddock/src/Haddock/GhcUtils.hs -o utils/haddock/dist/build/Haddock/GhcUtils.dyn_o
/m/vinci7/data1/dietz/ghc/ghc/inplace/lib/settings: openFile: does not exist (No such file or directory)

Investigation with strace shows that the path passed to open() has been corrupted,

open("/m/vinci7/data1/dietz/ghc/ghc/inplace/lib/settin@\270\215\240\347\277\212", O_RDONLY|O_NOCTTY|O_NONBLOCK) = -1 ENOENT (No such file or directory)

Furthermore, the stage 1 testsuite fails immediately,

$ make
../mk/boilerplate.mk:149: ../mk/ghcconfig_m_vinci7_data1_dietz_ghc_ghc_inplace_bin_ghc-stage2.mk: No such file or directory
../mk/ghc-config "/m/vinci7/data1/dietz/ghc/ghc/inplace/bin/ghc-stage2" >"../mk/ghcconfig_m_vinci7_data1_dietz_ghc_ghc_inplace_bin_ghc-stage2.mk"; if [ $? != 0 ]; then rm -f "../mk/ghcconfig_m_vinci7_data1_dietz_ghc_ghc_inplace_bin_ghc-stage2.mk"; exit 1; fi
ghc-config: b���羌
make: *** [../mk/ghcconfig_m_vinci7_data1_dietz_ghc_ghc_inplace_bin_ghc-stage2.mk] Error 1

I am using gcc 4.4.6 and have tried both self-built ghc 7.4.2 and ghc 7.6.1 for stage 0.

Change History

Changed 7 months ago by bgamari

To be clear, this is the output of "make stage=1" (which was omitted from the run cited previously),

$ make stage=1
../mk/boilerplate.mk:149: ../mk/ghcconfig_m_vinci7_data1_dietz_ghc_ghc_inplace_bin_ghc-stage1.mk: No such file or directory
../mk/ghc-config "/m/vinci7/data1/dietz/ghc/ghc/inplace/bin/ghc-stage1" >"../mk/ghcconfig_m_vinci7_data1_dietz_ghc_ghc_inplace_bin_ghc-stage1.mk"; if [ $? != 0 ]; then rm -f "../mk/ghcconfig_m_vinci7_data1_dietz_ghc_ghc_inplace_bin_ghc-stage1.mk"; exit 1; fi
ghc-config: ���美
make: *** [../mk/ghcconfig_m_vinci7_data1_dietz_ghc_ghc_inplace_bin_ghc-stage1.mk] Error 1

Changed 7 months ago by bgamari

  • cc bgamari@… added

I have now reproduced this on two machines. I believe the regression occurred sometime between 176a360 and 0b3811c.

Changed 7 months ago by bgamari

Here is my bisection log.

git bisect start
# good: [176a360031e1e7ef4d49ff18f1dd3e32ce4f56d9] Fix typo
git bisect good 176a360031e1e7ef4d49ff18f1dd3e32ce4f56d9
# bad: [0b3811c093736950c1d2757fb12dba60f9bf97ca] typo
git bisect bad 0b3811c093736950c1d2757fb12dba60f9bf97ca
# good: [2c2be637206cb1d58f4fc8a4a2e717e419c9fa5d] comments only
git bisect good 2c2be637206cb1d58f4fc8a4a2e717e419c9fa5d
# bad: [88a6f863d9f127fc1b03a1e2f068fd20ecbe096c] Small optimisation: always sink/inline reg1 = reg2 assignments
git bisect bad 88a6f863d9f127fc1b03a1e2f068fd20ecbe096c
# good: [2471a6bacccdf4d187aa4b31c382d5a5094b6fa5] Use canned heap checks to save a few bytes of code
git bisect good 2471a6bacccdf4d187aa4b31c382d5a5094b6fa5
# good: [2324b40f65b5cb7e427c5ec0185d635422b4a265] removeWay should also unset the wayGeneralFlags
git bisect good 2324b40f65b5cb7e427c5ec0185d635422b4a265
# good: [a7e0d4484189d08125083638582a6f8e4ae44801] a small -fPIC optimisation
git bisect good a7e0d4484189d08125083638582a6f8e4ae44801

It seems that the first bad commit is,

commit 88a6f863d9f127fc1b03a1e2f068fd20ecbe096c
Author: Simon Marlow <marlowsd@gmail.com>
Date:   Tue Oct 23 13:06:17 2012 +0100

    Small optimisation: always sink/inline reg1 = reg2 assignments

Changed 7 months ago by bgamari

  • owner set to smarlow

Changed 7 months ago by bgamari

  • owner changed from smarlow to simonmar

Changed 7 months ago by simonmar

  • difficulty set to Unknown

What platform and build settings?

Changed 7 months ago by marlowsd@…

commit 24b4bfbcb320670a62dad10009d43f06211a5a2a

Author: Simon Marlow <marlowsd@gmail.com>
Date:   Thu Oct 25 09:25:49 2012 +0100

    Fix bug in 88a6f863d9f127fc1b03a1e2f068fd20ecbe096c (#7366)

 compiler/cmm/CmmSink.hs |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

Changed 7 months ago by simonmar

  • status changed from new to closed
  • version set to 7.7
  • resolution set to fixed
  • milestone set to 7.8.1

So I haven't yet been able to reproduce the bug, but I think I know what it is so I've committed a speculative fix. I'll optimistically close the bug, please re-open if it still occurs.

Changed 7 months ago by bgamari

Thanks! I'm doing a test build right now.

Both machines I was able to reproduce on are x86_64 running some variant of Linux (one running a 2.6.31 kernel, the other 3.7).

Changed 7 months ago by simonmar

  • owner simonmar deleted
  • status changed from closed to new
  • resolution fixed deleted

I do have a repro in one of my builds, but the patch didn't fix it. Re-opening.

Changed 7 months ago by marlowsd@…

commit c588395719241c4b5756bd8d60dbf822915dfc5b

Author: Simon Marlow <marlowsd@gmail.com>
Date:   Thu Oct 25 16:18:36 2012 +0100

    Fix a bug in CmmSink exposed by a recent optimisation (#7366)

 compiler/cmm/CmmSink.hs |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

Changed 7 months ago by simonmar

  • status changed from new to closed
  • resolution set to fixed

Now fixed, I believe.

Changed 7 months ago by marlowsd@…

commit 3a6b1bfb08602a8193b0025f0fe47ec8ddf8dad2

Author: Simon Marlow <marlowsd@gmail.com>
Date:   Fri Oct 26 11:12:49 2012 +0100

    Turn on -O2 for the RTS by default
    
    Optimisation now makes a difference when compiling .cmm code, because
    it enables the optimisation passes in CmmPipeline.  Recently validate
    has not been optimising the .cmm code because it uses SRC_HC_OPTS=-O0,
    which explains why I couldn't reproduce #7366 in validate (the bug
    miscompiled rts/PrimOps.cmm).

 mk/config.mk.in |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
Note: See TracTickets for help on using tickets.