Opened 4 years ago

Closed 4 years ago

#12207 closed bug (fixed)

CgStaticPointers fails with -O

Reported by: thomie Owned by: facundo.dominguez
Priority: high Milestone:
Component: Compiler (CodeGen) Version: 8.1
Keywords: StaticPointers Cc: facundo.dominguez, simonpj
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: codeGen/should_run/CgStaticPointers
Blocked By: Blocking:
Related Tickets: #11656 Differential Rev(s): Phab:D2355 Phab:D2366
Wiki Page:


$ make TEST=CgStaticPointers slow
Wrong exit code (expected 0 , actual 1 )

CgStaticPointers: couldn't find StaticPtrInfo {spInfoUnitId = "main", spInfoModuleName = "Main", spInfoSrcLoc = (13,21)}
CallStack (from HasCallStack):
  error, called at CgStaticPointers.hs:25:14 in main:Main

*** unexpected failure for CgStaticPointers(optasm)

This seems to be caused by the patch for #11656 (36d29f7ce332a2b1fbc36de831b0eef7a6405555).

Change History (11)

comment:1 Changed 4 years ago by thomie

Priority: normalhigh

GcStaticPointers and ListStaticPointers also also failing for opt_ways, but with a different error:

GcStaticPointers: user error (Pattern match failure in do expression at GcStaticPointers.hs:29:3-8)

TcStaticPointers01 and TcStaticPointers02 are failing for WAY=hpc with core lint errors:

TcStaticPointers01.hs:14:1: warning:
    [RHS of f2 :: StaticPtr (Bool -> Bool -> Bool)]
    Found StaticPtr nested in an expression:  StaticPtr
                                                @ (Bool -> Bool -> Bool)

All four tests pass with ghc-7.10.3 and ghc-8.0.1. Raising priority.

comment:2 Changed 4 years ago by Thomas Miedema <thomasmiedema@…>

In 1d938aa/ghc:

Testsuite: mark tests expect broken

* CgStaticPointers, GcStaticPointers, ListStaticPointers,
  TcStaticPointers01, TcStaticPointers02:  #12207
* T11535: #12210
* ffi017/ffi021: #12209
* T11108: #11108
* T9646: #9646

comment:3 Changed 4 years ago by facundo.dominguez

@thomie, thanks for reporting this. Will take a look.

comment:4 Changed 4 years ago by facundo.dominguez

CgStaticPointers and ListStaticPointers seem to fail only when compiled with -O.

comment:5 Changed 4 years ago by facundo.dominguez

Cc: simonpj added

With -O the FloatOut pass places the StaticPtr applications at the top level as expected:

lvl_s4Ke =
    4472709404834582951## 17755048586376966233## lvl_s4Kc lvl_s4Kd

... staticKey lvl_s4Ke ...

However some other core-to-core pass is simplifying staticKey lvl_s4Ke and replacing it with Fingerprint 4472709404834582951## 17755048586376966233##.

This is alright but it also removes the lvl_s4Ke binding! Which then cannot be added to the SPT. Any pointers to the code which removes the binding?

My first attempt would be to make a special case for bindings to StaticPtr applications so they are not removed.

comment:6 Changed 4 years ago by facundo.dominguez

Owner: set to facundo.dominguez

comment:7 Changed 4 years ago by facundo.dominguez

Differential Rev(s): Phab:D2355
Status: newpatch

Just submitted a patch to fix the tests failing with -fhpc.

comment:8 Changed 4 years ago by Facundo Domínguez <facundo.dominguez@…>

In 7fc20b0/ghc:

Have Core linter accept programs using StaticPointers and -fhpc.

This patch uses collectArgsTicks instead of collectArgs to test that
StaticPtr only occurs at the top of RHSs of top-level expressions.

Ticks introduced by -fhpc would interfere otherwise.

Test Plan: ./validate

Reviewers: thomie, austin, goldfire, bgamari, simonpj

Reviewed By: simonpj

Differential Revision:

GHC Trac Issues: #12207

comment:9 Changed 4 years ago by facundo.dominguez

Differential Rev(s): Phab:D2355Phab:D2355 Phab:D2366

comment:10 Changed 4 years ago by Facundo Domínguez <facundo.dominguez@…>

In dd92c67b/ghc:

Stop the simplifier from removing StaticPtr binds.

We have the FloatOut pass create exported ids for floated StaticPtr
bindings. The simplifier doesn't try to remove those.

This patch also improves on 7fc20b by making a common definition
collectStaticPtrSatArgs to test for StaticPtr binds.

Fixes #12207.

Test Plan: ./validate

Reviewers: simonpj, austin, bgamari, simonmar, goldfire

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12207

comment:11 Changed 4 years ago by facundo.dominguez

Resolution: fixed
Status: patchclosed
Note: See TracTickets for help on using tickets.