Bug 17464 – ICE in cg87.c on arithmetic expression with real numbers

Status
RESOLVED
Resolution
WORKSFORME
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2017-06-03T00:03:31Z
Last change time
2022-03-01T10:55:13Z
Keywords
ice, ice-on-valid-code
Assigned to
No Owner
Creator
Ivan Kazmenko

Comments

Comment #0 by gassa — 2017-06-03T00:03:31Z
Code: ----- void fun () { auto a = new int [1]; real v = a[0] * 1.0 / (a[0] ^^ 2); } ----- Result with dmd 2.074.1 -m32/-m64 on Windows: ----- Internal error: ddmd\backend\cg87.c 300 -----
Comment #1 by gassa — 2017-06-03T00:10:40Z
The compile line is just dmd -main program.d Actually, with -O, the function compiles fine. Here is a slightly longer example to prevent optimizing the whole code away. When compiled with `dmd -O`, it runs as expected. However, compilation fails with just `dmd`: ----- void fun (int x) { auto a = [x]; real v = a[0] * 1.0 / (a[0] ^^ 2); assert (v != 0.0); } void main () { import std.stdio; int v; readf (" %s", &v); fun (v); } -----
Comment #2 by gassa — 2022-03-01T10:55:13Z
Yup, works for me now, too (with dmd 2.097.0).