Skip to content
Snippets Groups Projects
Commit 59d73471 authored by niteria's avatar niteria Committed by Ben Gamari
Browse files

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

(cherry picked from commit 0cbb13b3)
parent c3a45d5e
No related branches found
No related tags found
No related merge requests found
...@@ -182,10 +182,17 @@ procToDwarf df prc ...@@ -182,10 +182,17 @@ procToDwarf df prc
_otherwise -> showSDocDump df $ ppr $ dblLabel prc _otherwise -> showSDocDump df $ ppr $ dblLabel prc
, dwLabel = dblCLabel prc , dwLabel = dblCLabel prc
, dwParent = fmap mkAsmTempDieLabel , dwParent = fmap mkAsmTempDieLabel
$ mfilter (/= dblCLabel prc) $ mfilter goodParent
$ fmap dblCLabel (dblParent prc) $ 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 -- | Generate DWARF info for a block
blockToDwarf :: DynFlags -> DebugBlock -> DwarfInfo 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
10
...@@ -82,3 +82,4 @@ test('T14768', reqlib('vector'), compile_and_run, ['']) ...@@ -82,3 +82,4 @@ test('T14768', reqlib('vector'), compile_and_run, [''])
test('T14868', test('T14868',
[when((arch('powerpc64') or arch('powerpc64le')), expect_broken(11261))], [when((arch('powerpc64') or arch('powerpc64le')), expect_broken(11261))],
compile_and_run, ['']) compile_and_run, [''])
test('T14894', normal, compile_and_run, [''])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment