Bug 4837 – ICE(constfold.c) CTFE with >>>=

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-09-07T13:05:00Z
Last change time
2011-08-24T12:58:43Z
Keywords
ice-on-valid-code
Assigned to
s.d.hammett
Creator
stanislav.blinov

Attachments

IDFilenameSummaryContent-TypeSize
814issue.4837.patchPATCH against rev 755: remove superfluous assertstext/plain573

Comments

Comment #0 by stanislav.blinov — 2010-09-07T13:05:21Z
Compilation fails with assertion in constfold.c:608 or constfold.c:614 for the following code: bool foo(T)(T t) { t >>>= 1; // triggers assertion for ubytes and ushorts // t = t >>> 1; // this compiles with no errors return true; } void main() { auto g1 = foo!ubyte(1); // Ok for runtime auto g2 = foo!ushort(1); // Ok for runtime // CTFE: enum e1 = foo!ubyte(1); // Assertion failure: '0' on line 608 in file 'constfold.c' enum e2 = foo!ushort(1); // Assertion failure: '0' on line 614 in file 'constfold.c' } DMD 2.048
Comment #1 by s.d.hammett — 2010-11-15T12:24:38Z
Created attachment 814 PATCH against rev 755: remove superfluous asserts fixed, no idea why asserts where placed in there. unsigned shifting of 8 ^ 16 bit values seems perfectly reasonable.
Comment #2 by clugdbug — 2010-11-15T12:39:53Z
(In reply to comment #1) > Created an attachment (id=814) [details] > PATCH against rev 755: remove superfluous asserts > > fixed, no idea why asserts where placed in there. > unsigned shifting of 8 ^ 16 bit values seems perfectly reasonable. The problem is that the code there gives different results to what happens in all other situations. See bug 2809. As far as I can tell, >>> is a broken concept. Andrei and I tried to get it removed from the language before publication of TDPL, but we failed.
Comment #3 by braddr — 2011-02-06T15:39:40Z
Mass migration of bugs marked as x86-64 to just x86. The platform run on isn't what's relevant, it's if the app is a 32 or 64 bit app.
Comment #4 by bugzilla — 2011-08-24T12:58:43Z