Thread overview
[Issue 3672] New: read-modify-write (rmw) operators must be disabled for shared
Jan 31, 2012
yebblies
Feb 05, 2013
Andrej Mitrovic
January 04, 2010
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


--- Comment #0 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-01-04 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: -------
January 31, 2012
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


--- Comment #1 from yebblies <yebblies@gmail.com> 2012-01-31 12:33:30 EST ---
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: -------
February 05, 2013
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


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-04 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: -------
March 24, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=3672



--- Comment #3 from Andrei Alexandrescu <andrei@erdani.com> 2013-03-23 17:28:09 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: -------