[Issue 6670] Compiler seg fault using std.concurrency.atomicOp

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 17 22:26:44 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6670


yebblies <yebblies at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies at gmail.com


--- Comment #4 from yebblies <yebblies at gmail.com> 2011-09-18 15:26:19 EST ---
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: -------


More information about the Digitalmars-d-bugs mailing list