Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
April 03, 2020 [Issue 20719] Self referential struct definition causes stack overflow | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20719 Ben <ben.james.jones@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Self struct definition |Self referential struct |causes stack overflow |definition causes stack | |overflow -- |
April 14, 2020 [Issue 20719] Self referential struct definition causes stack overflow | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20719 --- Comment #1 from Ben <ben.james.jones@gmail.com> --- Reduced test case: import std.meta : AliasSeq; import std.typecons : ReplaceTypeUnless; import std.traits : isCopyable, isAssignable; struct This; //defined in std.variant this way struct SumType(TypeArgs) { alias Types = AliasSeq!(ReplaceTypeUnless!(isSumType, This, typeof(this), TypeArgs)); union Storage { template memberName(T) { mixin("enum memberName = `values_", "`;"); } static foreach (T; Types) mixin("T ", memberName!T, ";"); } Storage storage; static foreach (T; Types) static if (isCopyable!T){} static foreach (T; Types) static if (isAssignable!T){} } enum isSumType(T) = is(Args); struct B { SumType!(This)elems; } -- |
April 15, 2020 [Issue 20719] Self referential struct definition causes stack overflow | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20719 moonlightsentinel@disroot.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |moonlightsentinel@disroot.o | |rg --- Comment #2 from moonlightsentinel@disroot.org --- Maybe related reduction from dustmite: ============================== alias AliasSeq(TList...) = TList; enum isCopyable(S) = { S foo; }; struct SumType { alias Types = AliasSeq!(typeof(this)); Types[0] t; alias cp = isCopyable!(Types[0]); } ================================ This also segfaults but prints test.d(6): Error: struct test.SumType cannot have field t with same struct type -- |
April 15, 2020 [Issue 20719] Self referential struct definition causes stack overflow | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20719 --- Comment #3 from Ben <ben.james.jones@gmail.com> --- Not sure it's the same bug since mine triggers a stack overflow with no diagnostics. Here's the dustmite script I used to reduce: #!/bin/sh # arguments to dmd DMDARGS="test20719.d" OUTPUT=$(lldb --batch -o "run $DMDARGS" -k 'bt 30' -k 'quit' -o 'quit' dmd 2>&1) #echo $OUTPUT echo "$OUTPUT" | egrep -q "_D3dmd4func15FuncDeclaration14isTypeIsolatedMFCQBt5mtype4TypeZb" exit $? -- |
April 15, 2020 [Issue 20719] Self referential struct definition causes stack overflow | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20719 --- Comment #4 from moonlightsentinel@disroot.org --- Without error message: ================================ struct SumType { alias Types = AliasSeq!(typeof(this)); union Storage { Types[0] t; } Storage storage; static if (isCopyable!(Types[0])) {} static if (isAssignable!(Types[0])) {} } alias AliasSeq(TList...) = TList; enum isAssignable(Rhs) = __traits(compiles, lvalueOf = rvalueOf!Rhs); struct __InoutWorkaroundStruct {} T rvalueOf(T)(); T lvalueOf()(__InoutWorkaroundStruct); enum isCopyable(S) = { S foo; }; ===================================== Both original and reduction cause a segfault for me. -- |
April 30, 2020 [Issue 20719] Self referential struct definition causes stack overflow | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20719 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> --- @benjones created dlang/dmd pull request #11083 "fix issue 20719 by passing previously seen structs to isTypeIsolated …" fixing this issue: - fix issue 20719 by passing previously seen structs to isTypeIsolated recursive calls https://github.com/dlang/dmd/pull/11083 -- |
May 04, 2020 [Issue 20719] Self referential struct definition causes stack overflow | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20719 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> --- dlang/dmd pull request #11083 "fix issue 20719 by passing previously seen structs to isTypeIsolated …" was merged into master: - 9fa18aa20a9975b2c5673522a4761a564c8b067b by Ben Jones: fix issue 20719 by passing previously seen structs to isTypeIsolated recursive calls https://github.com/dlang/dmd/pull/11083 -- |
Copyright © 1999-2021 by the D Language Foundation