Thread overview
[Issue 15256] Data races with arrays allowed in @safe code
Jan 19, 2017
Jack Stouffer
Jan 20, 2017
anonymous4
[Issue 15256] Data races with arrays allowed with shared
Jan 20, 2017
Jack Stouffer
Jan 20, 2017
anonymous4
Oct 13, 2022
RazvanN
January 19, 2017
https://issues.dlang.org/show_bug.cgi?id=15256

Jack Stouffer <jack@jackstouffer.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jack@jackstouffer.com

--- Comment #1 from Jack Stouffer <jack@jackstouffer.com> ---
This is more an issue with shared than with @safe. AFAIK @safe makes no guarantees when it comes to data races.

--
January 20, 2017
https://issues.dlang.org/show_bug.cgi?id=15256

--- Comment #2 from anonymous4 <dfj1esp02@sneakemail.com> ---
@safe exists to makes guarantees :)
And memory safety and data races are not shared's issues.

--
January 20, 2017
https://issues.dlang.org/show_bug.cgi?id=15256

Jack Stouffer <jack@jackstouffer.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|safe                        |
            Summary|Data races with arrays      |Data races with arrays
                   |allowed in @safe code       |allowed with shared

--- Comment #3 from Jack Stouffer <jack@jackstouffer.com> ---
(In reply to anonymous4 from comment #2)
> @safe exists to makes guarantees :)
> And memory safety and data races are not shared's issues.

Data races are absolutely shared's problem. The issue is shared has never been fully implemented. See https://issues.dlang.org/show_bug.cgi?id=14932

The only place you can see what shared is supposed to be is in Andrei's book "The D Programming Language".

@safe exists to ensure memory safety; data races do not fall under that umbrella.

--
January 20, 2017
https://issues.dlang.org/show_bug.cgi?id=15256

anonymous4 <dfj1esp02@sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |safe
            Summary|Data races with arrays      |Data races with arrays
                   |allowed with shared         |allowed in @safe code

--- Comment #4 from anonymous4 <dfj1esp02@sneakemail.com> ---
If you corrupt memory in @safe code, then @safe fails, I think, this is specified pretty clearly, whether this happens due to sharing is unimportant. If shared should allow data races can be discussed in issue 14932.

--
October 13, 2022
https://issues.dlang.org/show_bug.cgi?id=15256

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305@gmail.com
         Resolution|---                         |WORKSFORME

--- Comment #5 from RazvanN <razvan.nitu1305@gmail.com> ---
If you compile with -preview=nosharedaccess than this code no longer compiles: "Error: direct access to shared `s` is not allowed, see `core.atomic`". Closing as WORKSFORME.

--