Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
December 18, 2016 [Issue 16980] [REG2.072.0] vtable issue in slightly complex scenario | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16980 Sönke Ludwig <sludwig@outerproduct.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code -- |
December 27, 2016 [Issue 16980] [REG2.072.0] vtable issue in slightly complex scenario | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16980 Martin Nowak <code@dawg.eu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |code@dawg.eu --- Comment #1 from Martin Nowak <code@dawg.eu> --- Digger says https://github.com/dlang/dmd/pull/5500 is the culprit. -- |
December 29, 2016 [Issue 16980] [REG2.072.0] vtable issue in slightly complex scenario | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16980 --- Comment #2 from Martin Nowak <code@dawg.eu> --- For whatever reason the ab in the ab.bar() call of the dtor isn't casted to B (cast(B)dst.ab).bar(); // <- correct in main, offsets this (AB) by 8 byte ab.bar(); // <- broken, uses this (AB) w/o offset which is A, thus methods of B are called on A's vtbl should be (cast(B)ab).bar(); -- |
December 29, 2016 [Issue 16980] [REG2.072.0] vtable issue in slightly complex scenario | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16980 --- Comment #3 from Martin Nowak <code@dawg.eu> --- Semantic for this.ab.bar() in the dtor runs first. The cast gets incorrectly optimized away, because the offset returned by cdto.isBaseOf(cdfrom, &offset) [¹] is 0 instead of 8. Maybe the struct size for one of the classes hasn't been finalized. [¹]: https://github.com/dlang/dmd/blob/3cbb4d8dee6c2be433a147996c445db0ccdc81db/src/optimize.d#L596 -- |
December 29, 2016 [Issue 16980] [REG2.072.0] wrong interface called | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16980 Martin Nowak <code@dawg.eu> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[REG2.072.0] vtable issue |[REG2.072.0] wrong |in slightly complex |interface called |scenario | --- Comment #4 from Martin Nowak <code@dawg.eu> --- So what happens is that the size finalization of aggregates (classes and structs) was moved to semantic2 in order to resolve various forward reference issues. The module level T!() tinst; declaration already triggers a FunctionDeclaration::semantic3 for the dtor during Module::semantic(). IIRC this is done for any template instances. What's missing is a call to ad.size/determineSize somewhere before determining the offset when the CastExp is optimized. -- |
December 29, 2016 [Issue 16980] [REG2.072.0] wrong interface called | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16980 --- Comment #5 from github-bugzilla@puremagic.com --- Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/bbd22804313fa37fe2848b7f3bc45f83f4ea8db8 fix Issue 16980 - wrong interface called - ensure that class/interface size is finalized before determining the interface offsets https://github.com/dlang/dmd/commit/6b294ff205772ef2ca0dfc3df90dc0b16c2a2772 Merge pull request #6383 from MartinNowak/fix16980 fix Issue 16980 - wrong interface called -- |
December 29, 2016 [Issue 16980] [REG2.072.0] wrong interface called | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16980 github-bugzilla@puremagic.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED -- |
December 31, 2016 [Issue 16980] [REG2.072.0] wrong interface called | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16980 --- Comment #6 from github-bugzilla@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/bbd22804313fa37fe2848b7f3bc45f83f4ea8db8 fix Issue 16980 - wrong interface called https://github.com/dlang/dmd/commit/6b294ff205772ef2ca0dfc3df90dc0b16c2a2772 Merge pull request #6383 from MartinNowak/fix16980 -- |
January 16, 2017 [Issue 16980] [REG2.072.0] wrong interface called | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16980 --- Comment #7 from github-bugzilla@puremagic.com --- Commits pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/bbd22804313fa37fe2848b7f3bc45f83f4ea8db8 fix Issue 16980 - wrong interface called https://github.com/dlang/dmd/commit/6b294ff205772ef2ca0dfc3df90dc0b16c2a2772 Merge pull request #6383 from MartinNowak/fix16980 -- |
December 27, 2018 [Issue 16980] [REG2.072.0] wrong interface called | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16980 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |razvan.nitu1305@gmail.com Resolution|FIXED |--- --- Comment #8 from RazvanN <razvan.nitu1305@gmail.com> --- Slightly modified example: interface A { void foo(); } interface B { void bar(); } interface AB : A, B {} class C : AB { void foo() { assert(false, "Never called!"); } void bar() {} } struct T() { AB ab; ~this() { ab.bar(); // not OK, calls foo(); } } static ~this() // calling the destructor still fails { tinst.__dtor(); } T!() tinst; // NOTE: the destructor of tinst is never run! void main() { T!() dst; dst.ab = new C; dst.ab.bar(); // OK, calls bar() } -- |
Copyright © 1999-2021 by the D Language Foundation