Bug 4751 – Regression(1.062, 2.047) ICE(constfold.c) >> after error

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-08-29T00:08:00Z
Last change time
2015-06-09T05:11:54Z
Keywords
ice-on-invalid-code, patch
Assigned to
nobody
Creator
braddr

Comments

Comment #0 by braddr — 2010-08-29T00:08:07Z
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 by clugdbug — 2010-08-31T00:41:06Z
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 by clugdbug — 2010-09-03T11:38:15Z
*** Issue 4792 has been marked as a duplicate of this issue. ***
Comment #3 by bugzilla — 2010-09-11T14:05:38Z