[Issue 9957] [2.061 -> 2.062] Taking pointer of enum float array gives some garbage

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 23 00:10:17 PDT 2013


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



--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> 2013-04-23 00:10:16 PDT ---
This is a regression caused by fixing bug 8913.

(In reply to comment #1)
> I don't think this should compile. It's like writing auto p = &5;
> -- taking the address of a manifest constant doesn't make sense.

I think it should work. Manifest constant with array value will create array
literal, so:

    auto a = A[0].ptr;

will be optimized to:

    auto a = [1.0, 2.0, 3.0].ptr;

By fixing bug 8913, accessing sarr.ptr is now lowered to &sarr[0]. With this,
above code is also lowered to:

    auto a = &[1.0, 2.0, 3.0][0];

Then currently it is optimized to:

    auto a = &1.0;

I think that the root cause of this bug is here. Essentially optimizer should
keep lvalue-ness of expressions, but it is accidentally disappeared in the last
optimization. It is incorrect.

-- 
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