[Issue 18598] cyclic constructor calls have undefined behavior but are accepted in @safe code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 25 14:16:27 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18598

--- Comment #4 from ag0aep6g <ag0aep6g at gmail.com> ---
(In reply to Walter Bright from comment #3)
> I'm open to advice on what to do about it.

I'm by no means an expert here, but don't we have a guaranteed guard page
beyond the stack? If we have, stack overflow is guaranteed to fail with a
segfault, as long as the access doesn't jump over guard page (cf. issue 17566).

The situation is very similar to null dereferences then. A null dereference
also hits a guard page, as long as the offset from null isn't too large (cf.
issue 5176).

In both cases, the compiler has to detect offsets that are so large that they
would jump over the guard page, and then it has to inject code that makes an
earlier access to trigger the segfault. If I got the term right, for the stack
that's called "stack probing".

--


More information about the Digitalmars-d-bugs mailing list