Thread overview
[Issue 16526] @safe code should do null check for members when appropriate
Sep 22, 2016
Sobirari Muhomori
Dec 17, 2022
Iain Buclaw
September 22, 2016
https://issues.dlang.org/show_bug.cgi?id=16526

Sobirari Muhomori <dfj1esp02@sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|x86                         |All
                 OS|Mac OS X                    |All

--- Comment #1 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
struct S
{
    byte[3000] a,b;
}
void f(ref S s)
{
    g(s.b);
}
void g(ref byte[3000] b)
{
    b[2000]=0;
}

Similar with slicing:
void f(ref byte[6000] a)
{
    g(a[0..3000]);
}
void g(ref byte[3000] b)
{
    b[2000]=0;
}

--
September 22, 2016
https://issues.dlang.org/show_bug.cgi?id=16526

--- Comment #2 from Steven Schveighoffer <schveiguy@yahoo.com> ---
Yes, this is what I meant by "There are still ways to access data beyond one page without incurring a check with this scheme, but we are talking about very weird and rare code."

--
September 22, 2016
https://issues.dlang.org/show_bug.cgi?id=16526

--- Comment #3 from Steven Schveighoffer <schveiguy@yahoo.com> ---
(In reply to Sobirari Muhomori from comment #1)
> struct S
> {
> 	byte[3000] a,b;
> }
> void f(ref S s)
> {
> 	g(s.b);
> }

Actually, technically this could trigger a check of s address, since b's data is beyond the 1 page boundary.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=16526

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
December 13
https://issues.dlang.org/show_bug.cgi?id=16526

--- Comment #4 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/17776

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--