D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4751 - Regression(1.062, 2.047) ICE(constfold.c) >> after error
Summary: Regression(1.062, 2.047) ICE(constfold.c) >> after error
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords: ice-on-invalid-code, patch
: 4792 (view as issue list)
Depends on:
Blocks:
 
Reported: 2010-08-29 00:08 UTC by Brad Roberts
Modified: 2015-06-09 05:11 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 Brad Roberts 2010-08-29 00:08:07 UTC
to repro, from $(DMD_SVN_ROOT)/src/test:

make test_results/fail_compilation/fail37.d.out

or:

../src/dmd -Ifail_compilation -odtest_results/fail_compilation
-oftest_results/fail_compilation/fail37 -c fail_compilation/fail37.d

The code:

ulong[cast(uint)((cast(float)int.sizeof/ulong.sizeof)-int.max>>2)+int.max>>2]  
hexarray;

The assert:
fail_compilation/fail37.d(1): Error: 'cast(float)4u / cast(float)8u - cast(float)2147483647' is not of integral type, it is a float
dmd: constfold.c:590: Expression* Shr(Type*, Expression*, Expression*): Assertion `0' failed.
Comment 1 Don 2010-08-31 00:41:06 UTC
Reduced test case:

ulong [undefined>>1]   hexarray;
ulong [undefined>>>1]   hexarray2;

It doesn't fail with [undefined<<1]

This is caused by the error propagation introduced in 2.047. 

PATCH constfold.c, Shr(), line 589

        case Tuns64:
                value = (d_uns64)(value) >> count;
                break;

+        case Terror:
+            return e1;

        default:
                assert(0);
    }

And exactly the same for UShr() line 630.
Comment 2 Don 2010-09-03 11:38:15 UTC
*** Issue 4792 has been marked as a duplicate of this issue. ***
Comment 3 Walter Bright 2010-09-11 14:05:38 UTC
http://www.dsource.org/projects/dmd/changeset/670