digitalmars.D.bugs - [Issue 6670] New: Compiler seg fault using std.concurrency.atomicOp
- d-bugmail puremagic.com (24/24) Sep 14 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6670
- d-bugmail puremagic.com (9/9) Sep 14 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6670
- d-bugmail puremagic.com (24/24) Sep 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6670
- d-bugmail puremagic.com (30/30) Sep 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6670
- d-bugmail puremagic.com (33/33) Sep 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6670
- d-bugmail puremagic.com (15/15) Oct 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6670
- d-bugmail puremagic.com (8/8) Oct 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6670
- d-bugmail puremagic.com (13/13) Apr 27 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6670
- d-bugmail puremagic.com (11/11) Oct 28 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6670
http://d.puremagic.com/issues/show_bug.cgi?id=6670
Summary: Compiler seg fault using std.concurrency.atomicOp
Product: D
Version: D2
Platform: x86_64
OS/Version: Mac OS X
Status: NEW
Severity: regression
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: peter.alexander.au gmail.com
11:50:41 PDT ---
This program causes DMD 2.055 to seg fault.
import std.concurrency;
void main()
{
int a;
atomicOp!"+="(a, 1);
}
It didn't seg fault in DMD 2.053 (haven't tested DMD 2.054).
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 14 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6670 13:49:26 PDT --- Actually, this is probably related to http://d.puremagic.com/issues/show_bug.cgi?id=6669 core.atomic uses a lot of inline asm, and atomicOp just causes those functions to be instantiated, triggering the other seg fault. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 14 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6670
Brad Roberts <braddr puremagic.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |braddr puremagic.com
AssignedTo|nobody puremagic.com |braddr puremagic.com
---
I'm not seeing a dmd crash with this bug (much like not seeing the crash in bug
6669), but I am seeing something odd:
import std.concurrency;
void main()
{
int a;
atomicOp!"+="(a, 1);
}
yields:
./../../druntime/import/core/atomic.di(108): Error: cast(shared(const(int)))val
is not an lvalue
s/std.concurrency/core.atomic/
And it builds.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 17 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6670
---
My current reduction:
template isMutable(T)
{
enum isMutable = !is(T == const) && !is(T == immutable);
}
unittest
{
static assert(isMutable!(shared const(int)[]));
}
int atomicLoad( ref const shared int val )
{
return 0;
}
void main()
{
int a;
atomicLoad(a);
}
$ dmd bug6670.d
bug6670.d(20): Error: cast(shared(const(int)))a is not an lvalue
Not sure why the unused isMutable template is required, nor why the unittest
block is required when -unittest isn't part of the dmd arguments, but they are
and without them the code compiles.
Don or Daniel, either of you want to take this? I took it because I originally
thought it was a iasm or backend bug, which are areas I'm more familiar with.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 17 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6670
yebblies <yebblies gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yebblies gmail.com
Urrgh.
Reduced test case:
shared(const(int)[]) g;
int atomicLoad( ref const shared int val )
{
return 0;
}
void main()
{
int a;
atomicLoad(a);
}
Due to issue 5493, ref is completely ignored when looking at parameter type
matching. Therefore int matches const(shared(int)), when it really shouldn't.
This gets turned into cast(const(shared(int)))a
The compiler then optimizes cast(const(shared(int)))a, which it shouldn't do
when an lvalue is required. (like bug 2521)
Finally, a bug in CastExp::optimize uses constOf rather than
addMod(MODconst)/implicitConvTo>=MATCHconst to see if the cast can be ignored,
and constOf's wacky behaviour interacts with the previous usage of
shared(const(int)) in the declaration of g.
So yeah, no segfault, and nothing to do with inline asm.
This bug is probably a dupe of bug 6669 and you've had the pleasure of
discovering a new one!
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 17 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6670
Brad Roberts <braddr puremagic.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|braddr puremagic.com |yebblies gmail.com
Summary|Compiler seg fault using |cast(shared(const(int)))a
|std.concurrency.atomicOp |is not an lvalue
---
Updating the description based on where this bug report has evolved.
Reassigning to yebblies since he's done the investigation.
Also lowering to critical from regression since I'm pretty sure it's not
actually a regression. Please correct me if I'm wrong.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 17 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6670
Brad Roberts <braddr puremagic.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|regression |critical
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 17 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6670
SomeDude <lovelydear mailmetrash.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lovelydear mailmetrash.com
PDT ---
With 2.059, none of the examples compile.
PS E:\DigitalMars\dmd2\samples> dmd -c bug.d
bug.d(14): Error: function bug.atomicLoad (ref shared(const(int)) val) is not
callable using argument types (int)
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 27 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6670
yebblies <yebblies gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
All of the contributing bugs seem to have been fixed.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 28 2012









d-bugmail puremagic.com 