www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3672] New: read-modify-write (rmw) operators must be disabled for shared

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3672

           Summary: read-modify-write (rmw) operators must be disabled for
                    shared
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrei metalanguage.com



08:51:32 PST ---
shared int x;

void main()
{
    x++;
}

This compiles but it shouldn't. For a shared word-sized object, only reading
and writing it are allowed, as well as shared and synchronized calls where
applicable.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 04 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3672


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com
           Platform|Other                       |All
            Version|2.040                       |D2
         AssignedTo|nobody puremagic.com        |yebblies gmail.com
         OS/Version|Linux                       |All



Since this is a couple of years old, can you confirm that this is still what is
desired?
Essentially shared variables act like rvalues except for assignment?
Is the compiler expected to make reads/writes atomic or is it better disabled
completely and left to atomicStore/atomicLoad etc?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 30 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3672


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei erdani.com,
                   |                            |andrej.mitrovich gmail.com



18:26:54 PST ---
CC'ing Andrei for update.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 04 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3672




PDT ---
I've had a discussion with Walter in which we agreed that atomic increment
should NOT be generated implicitly for shared variables. Herb Sutter also
agrees that C++11 made a mistake adding the sugar to atomic<T> and recommends
using named functions.

Code using operands with shared data should not compile. Named functions should
provide the appropriate primitives.

There is no issue of code breakage because the code listed was behaving
incorrectly to start with.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 23 2013