Commit 0cbb13b3 authored by niteria's avatar niteria Committed by Ben Gamari

Don't refer to blocks in debug info when -g1

-g1 removes block information, but it turns out that procs can
refer to block information through parents.
Note [Splitting DebugBlocks] explains the parentage relationship.

Test Plan:
* ./validate
* added a new test

Reviewers: bgamari, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14894

Differential Revision: https://phabricator.haskell.org/D4496
parent 20f14b4f
......@@ -182,10 +182,17 @@ procToDwarf df prc
_otherwise -> showSDocDump df $ ppr $ dblLabel prc
, dwLabel = dblCLabel prc
, dwParent = fmap mkAsmTempDieLabel
$ mfilter (/= dblCLabel prc)
$ mfilter goodParent
$ fmap dblCLabel (dblParent prc)
-- Omit parent if it would be self-referential
}
where
goodParent a | a == dblCLabel prc = False
-- Omit parent if it would be self-referential
goodParent a | not (externallyVisibleCLabel a)
, debugLevel df < 2 = False
-- We strip block information when running -g0 or -g1, don't
-- refer to blocks in that case. Fixes #14894.
goodParent _ = True
-- | Generate DWARF info for a block
blockToDwarf :: DynFlags -> DebugBlock -> DwarfInfo
......
{-# OPTIONS_GHC -g1 -O #-}
import System.Environment
summap :: (Int -> Int) -> (Int -> Int)
summap f n = f 10
{-# NOINLINE summap #-}
main = do
n <- length `fmap` getArgs
print $ summap (+ n) n
......@@ -82,3 +82,4 @@ test('T14768', reqlib('vector'), compile_and_run, [''])
test('T14868',
[when((arch('powerpc64') or arch('powerpc64le')), expect_broken(11261))],
compile_and_run, [''])
test('T14894', normal, compile_and_run, [''])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment