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


yebblies <yebbl...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebbl...@gmail.com


--- Comment #4 from yebblies <yebbl...@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: -------

Reply via email to