[Issue 6962] Wrong Code With Scope Exit and Array Parameter, only with -O

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 15 23:39:05 PST 2012


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Wrong Code With Scope Exit  |Wrong Code With Scope Exit
                   |+ By-Ref Parameters, only   |and Array Parameter, only
                   |with -O                     |with -O
         OS/Version|Windows                     |All


--- Comment #2 from Don <clugdbug at yahoo.com.au> 2012-11-15 23:39:03 PST ---
Further reduced. The 'ref' is not necessary. The return statement is required,
otherwise the try-finally gets removed in the semantic pass.

void bug6962(string value)
{
    string v = value;
    try
    {
        v = v[0LU..0LU];
        return;
    }
    finally
    {
        assert(!v.length);
    }
}

void main()
{
    bug6962("42");
}
---------
When compiled with -O, the assert is compiled incorrectly. Instead of taking
v.length, it uses value.length.

Bonus: on Linux 64, running obj2asm on the object file (with or without -O)
causes obj2asm to segfault.

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