D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3633 - Optimizer causes access violation
Summary: Optimizer causes access violation
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 critical
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2009-12-18 17:09 UTC by Janzert
Modified: 2014-03-01 00:36 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Janzert 2009-12-18 17:09:02 UTC
The following throws an Access Violation exception under windows when compiled with dmd -release -O

int get_value()
{
    return 1;
}

int[2] array1;
int[2] array2;

int test(ulong a1, ulong extra, ulong extra2, ulong extra3)
{
    if (!((a1 & 1) | (get_value() | array1[a1^1])))
        return 0;

    if (0 >= array2[a1^1])
        return 0;

    return 1;
}

void main(char[][] args)
{
    test(0, 0, 0, 0);
}

Tested with dmd 1.033, 1.041, 1.043, 1.053
Comment 1 Walter Bright 2009-12-24 12:16:22 UTC
changeset 308
Comment 2 Leandro Lucarella 2009-12-25 10:00:38 UTC
http://www.dsource.org/projects/dmd/changeset/308
Comment 3 Walter Bright 2009-12-31 11:17:47 UTC
Fixed dmd 1.054 and 2.038
Comment 4 Janzert 2010-01-05 14:14:12 UTC
Thanks for the quick fix.