Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
February 15, 2019 [Issue 19679] variable escapes unnoticed when referenced in function called from function whose address is taken | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19679 FeepingCreature <default_357-line@yahoo.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code -- |
February 16, 2019 [Issue 19679] variable escapes unnoticed when referenced in function called from function whose address is taken | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19679 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ibuclaw@gdcproject.org --- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> --- I think the correct place to check would be checkEscapingSiblings. // After g.isThis() check. for (auto p = g; p; p = p.parent.isFuncDeclaration()) { // A parent of the sibling had its address taken. // Assume escaping of parent affects its children, so needs propagating. if (p.tookAddressOf) { markAsNeedingClosure(p, outerFunc); bAnyClosures = true; } } It's a bit of a weak check though. It would be a stronger guarantee to keep a reference of _all_ callers of a function, not just its siblings, so that nested functions that are unreferenced are correctly ignored. -- |
February 18, 2019 [Issue 19679] variable escapes unnoticed when referenced in function called from function whose address is taken | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19679 --- Comment #2 from FeepingCreature <default_357-line@yahoo.de> --- Seems a good start. Wanna open a PR so we can GTM? If they don't like it, they can always request changes. Most of all I want to get it into the testsuite, even with an inadequate fix, instead of waiting for a better one that may come whenever. -- |
February 18, 2019 [Issue 19679] variable escapes unnoticed when referenced in function called from function whose address is taken | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19679 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> --- @FeepingCreature created dlang/dmd pull request #9372 "Fix issue 19679, add test" fixing this issue: - Fix issue 19679, add test: if the address of the parent of a sibling caller was taken, consider the caller escaped via that reference https://github.com/dlang/dmd/pull/9372 -- |
February 19, 2019 [Issue 19679] variable escapes unnoticed when referenced in function called from function whose address is taken | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19679 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> --- dlang/dmd pull request #9372 "Fix issue 19679, add test" was merged into master: - c3b725d0476edef0b291b4c34fc369a50b9d40c8 by Mathis Beer: Fix issue 19679, add test: if the address of the parent of a sibling caller was taken, consider the caller escaped via that reference https://github.com/dlang/dmd/pull/9372 -- |
Copyright © 1999-2021 by the D Language Foundation