D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 16348 - [REG 2.070.2] ICE with package visibility
Summary: [REG 2.070.2] ICE with package visibility
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 All
: P1 regression
Assignee: Martin Nowak
URL:
Keywords: ice, ice-on-valid-code, pull
Depends on:
Blocks:
 
Reported: 2016-08-02 08:17 UTC by Lodovico Giaretta
Modified: 2016-11-04 09:04 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Lodovico Giaretta 2016-08-02 08:17:46 UTC
Segmentation fault in function hasPackageAccess(Module*, DSymbol*).

Test case:

file source/mypackage/bar.d
==============
module mypackage.bar;

package bool bar()
{
    return false;
}
==============

file source/mypackage/foo.d
==============
module mypackage.foo;

void foo()
{
    // removing the if-else also removes the segfault
    if (false) {}
    else
    {
        // changing this to a selective import removes the segfault
        import mypackage.bar;

        auto b = bar();
    }
}
==============
Comment 1 Lodovico Giaretta 2016-08-02 08:42:33 UTC
Raising as a regression, as the test case compiles fine with 2.070.2 but segfaults with 2.071.1
Comment 2 Martin Nowak 2016-08-02 12:14:42 UTC
Seems like the anonymous scope created in the else branch after the import doesn't contain a parent link to the current module.
Comment 3 Martin Nowak 2016-08-08 10:25:32 UTC
https://github.com/dlang/dmd/pull/6014
Comment 4 github-bugzilla 2016-08-08 20:11:53 UTC
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/93c3dcf26f5c5ae612ccce044012d2b297fe46bf
fix Issue 16348 - ICE with package visibility

- fix scopesym parent chain when using semanticScope
- fixes getAccessModule for scope symbols in do bodies,
  try bodies, and else branches

https://github.com/dlang/dmd/commit/d400dffec4f782ac9cc27f7e682a726042949f9e
Merge pull request #6014 from MartinNowak/fix16348

fix Issue 16348 - ICE with package visibility
Comment 5 github-bugzilla 2016-09-19 23:46:51 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/93c3dcf26f5c5ae612ccce044012d2b297fe46bf
fix Issue 16348 - ICE with package visibility

https://github.com/dlang/dmd/commit/d400dffec4f782ac9cc27f7e682a726042949f9e
Merge pull request #6014 from MartinNowak/fix16348
Comment 6 github-bugzilla 2016-11-04 09:04:56 UTC
Commits pushed to newCTFE at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/93c3dcf26f5c5ae612ccce044012d2b297fe46bf
fix Issue 16348 - ICE with package visibility

https://github.com/dlang/dmd/commit/d400dffec4f782ac9cc27f7e682a726042949f9e
Merge pull request #6014 from MartinNowak/fix16348