digitalmars.D.learn - Postblit segfault.
- MaoKo (15/15) May 31 2020 Hello, I don't understand why this code segfault on Linux/FreeBSD:
- Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= (6/22) Jun 01 2020 I cannot help much, but I can say that problem is not about
- Boris Carvajal (8/9) Jun 01 2020 Reduced to:
- Bastiaan Veelo (5/14) Jun 01 2020 This used to work up to dmd 2.084.1. It fails since 2.085.1.
- H. S. Teoh (8/26) Jun 01 2020 [...]
- Basile B. (5/30) Jun 01 2020 Possibly a backend bug (keyword "wrong code"), caused by either
- H. S. Teoh (9/14) Jun 01 2020 Yeah, it looks like a backend bug. The struct address was somehow
- Basile B. (3/16) Jun 01 2020 yeah done. culprit commit confirmed and reduced w/o phobos:
Hello, I don't understand why this code segfault on Linux/FreeBSD:
import std.stdio;
struct _Poc {
this(this) { writeln("_Poc.this(this)"); }
}
void main() {
_Poc[1] valueArray = [ _Poc() ];
writeln(valueArray);
}
I've just defined the postblit function in _Poc to see how much
it's invoked.
In my system, it's invoked 3 time after the segfault.
When the array is allocated on the heap, nothing happen.
So I guess it's because it's located on the stack but why?
regard.
May 31 2020
On Monday, 1 June 2020 at 06:35:36 UTC, MaoKo wrote:
Hello, I don't understand why this code segfault on
Linux/FreeBSD:
import std.stdio;
struct _Poc {
this(this) { writeln("_Poc.this(this)"); }
}
void main() {
_Poc[1] valueArray = [ _Poc() ];
writeln(valueArray);
}
I've just defined the postblit function in _Poc to see how much
it's invoked.
In my system, it's invoked 3 time after the segfault.
When the array is allocated on the heap, nothing happen.
So I guess it's because it's located on the stack but why?
regard.
I cannot help much, but I can say that problem is not about
postblit. I tried running the code on https://run.dlang.io/. It
works with LDC but not with DMD. Even though postblit is removed,
it crashes because there may be a bug with DMD's writeln or there
is something more that I missed too.
Jun 01 2020
On Monday, 1 June 2020 at 06:35:36 UTC, MaoKo wrote:Hello, I don't understand why this code segfault onReduced to: import std.stdio; struct S {} void main() { S[1] s; writeln(s); }
Jun 01 2020
On Monday, 1 June 2020 at 09:42:44 UTC, Boris Carvajal wrote:On Monday, 1 June 2020 at 06:35:36 UTC, MaoKo wrote:This used to work up to dmd 2.084.1. It fails since 2.085.1. Please file a regression report at https://issues.dlang.org/enter_bug.cgi?product=D — Bastiaan.Hello, I don't understand why this code segfault onReduced to: import std.stdio; struct S {} void main() { S[1] s; writeln(s); }
Jun 01 2020
On Mon, Jun 01, 2020 at 01:53:09PM +0000, Bastiaan Veelo via Digitalmars-d-learn wrote:On Monday, 1 June 2020 at 09:42:44 UTC, Boris Carvajal wrote:[...] Tracked the segfault to Phobos, writeUpToNextSpec(): 1216 if (trailing[i] != '%') continue; Apparently `trailing` has an invalid pointer. T -- They pretend to pay us, and we pretend to work. -- Russian sayingOn Monday, 1 June 2020 at 06:35:36 UTC, MaoKo wrote:This used to work up to dmd 2.084.1. It fails since 2.085.1. Please file a regression report at https://issues.dlang.org/enter_bug.cgi?product=DHello, I don't understand why this code segfault onReduced to: import std.stdio; struct S {} void main() { S[1] s; writeln(s); }
Jun 01 2020
On Monday, 1 June 2020 at 14:53:43 UTC, H. S. Teoh wrote:On Mon, Jun 01, 2020 at 01:53:09PM +0000, Bastiaan Veelo via Digitalmars-d-learn wrote:Possibly a backend bug (keyword "wrong code"), caused by either of [1] or [2] [1] https://github.com/dlang/dmd/pull/9357 [2] https://github.com/dlang/dmd/pull/9623/filesOn Monday, 1 June 2020 at 09:42:44 UTC, Boris Carvajal wrote:[...] Tracked the segfault to Phobos, writeUpToNextSpec(): 1216 if (trailing[i] != '%') continue; Apparently `trailing` has an invalid pointer. TOn Monday, 1 June 2020 at 06:35:36 UTC, MaoKo wrote:This used to work up to dmd 2.084.1. It fails since 2.085.1. Please file a regression report at https://issues.dlang.org/enter_bug.cgi?product=DHello, I don't understand why this code segfault onReduced to: import std.stdio; struct S {} void main() { S[1] s; writeln(s); }
Jun 01 2020
On Mon, Jun 01, 2020 at 03:27:11PM +0000, Basile B. via Digitalmars-d-learn wrote: [...]Possibly a backend bug (keyword "wrong code"), caused by either of [1] or [2] [1] https://github.com/dlang/dmd/pull/9357 [2] https://github.com/dlang/dmd/pull/9623/filesYeah, it looks like a backend bug. The struct address was somehow either not loaded correctly, or not passed correctly (didn't look into more detail which case). A regression should be filed for this, if not already. T -- It's amazing how careful choice of punctuation can leave you hanging:
Jun 01 2020
On Monday, 1 June 2020 at 15:55:45 UTC, H. S. Teoh wrote:On Mon, Jun 01, 2020 at 03:27:11PM +0000, Basile B. via Digitalmars-d-learn wrote: [...]yeah done. culprit commit confirmed and reduced w/o phobos: https://issues.dlang.org/show_bug.cgi?id=20890Possibly a backend bug (keyword "wrong code"), caused by either of [1] or [2] [1] https://github.com/dlang/dmd/pull/9357 [2] https://github.com/dlang/dmd/pull/9623/filesYeah, it looks like a backend bug. The struct address was somehow either not loaded correctly, or not passed correctly (didn't look into more detail which case). A regression should be filed for this, if not already. T
Jun 01 2020
On Monday, 1 June 2020 at 19:52:39 UTC, Basile B. wrote:On Monday, 1 June 2020 at 15:55:45 UTC, H. S. Teoh wrote:Ok cool. I hesitate to report an issue because the bug was too "simple". This is a proof that dmd user use the GC a lot :).On Mon, Jun 01, 2020 at 03:27:11PM +0000, Basile B. via Digitalmars-d-learn wrote: [...]yeah done. culprit commit confirmed and reduced w/o phobos: https://issues.dlang.org/show_bug.cgi?id=20890Possibly a backend bug (keyword "wrong code"), caused by either of [1] or [2] [1] https://github.com/dlang/dmd/pull/9357 [2] https://github.com/dlang/dmd/pull/9623/filesYeah, it looks like a backend bug. The struct address was somehow either not loaded correctly, or not passed correctly (didn't look into more detail which case). A regression should be filed for this, if not already. T
Jun 01 2020
On Tuesday, 2 June 2020 at 06:34:14 UTC, MaoKo wrote:On Monday, 1 June 2020 at 19:52:39 UTC, Basile B. wrote:Mmmmh I don't follow you, this has nothing to do with the GC. It's rather a problem with the backend (i.e the translation to an IR andthe generation of byte code) Anyway someone already pushed a fix so next point release (~1 or 2 weeks) will not produce invalid code for the case you've found.On Monday, 1 June 2020 at 15:55:45 UTC, H. S. Teoh wrote:Ok cool. I hesitate to report an issue because the bug was too "simple". This is a proof that dmd user use the GC a lot :).On Mon, Jun 01, 2020 at 03:27:11PM +0000, Basile B. via Digitalmars-d-learn wrote: [...]yeah done. culprit commit confirmed and reduced w/o phobos: https://issues.dlang.org/show_bug.cgi?id=20890Possibly a backend bug (keyword "wrong code"), caused by either of [1] or [2] [1] https://github.com/dlang/dmd/pull/9357 [2] https://github.com/dlang/dmd/pull/9623/filesYeah, it looks like a backend bug. The struct address was somehow either not loaded correctly, or not passed correctly (didn't look into more detail which case). A regression should be filed for this, if not already. T
Jun 01 2020
On Tuesday, 2 June 2020 at 06:53:47 UTC, Basile B. wrote:Yes, ok I see. But anyway, thank for you help :D.Ok cool. I hesitate to report an issue because the bug was too "simple". This is a proof that dmd user use the GC a lot :).Mmmmh I don't follow you, this has nothing to do with the GC. It's rather a problem with the backend (i.e the translation to an IR andthe generation of byte code) Anyway someone already pushed a fix so next point release (~1 or 2 weeks) will not produce invalid code for the case you've found.
Jun 02 2020









Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= <aferust gmail.com> 