Bug 8525 – optimizer loops infinitely

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
FreeBSD
Creation time
2012-08-08T19:04:00Z
Last change time
2015-06-09T05:11:36Z
Keywords
ice, pull
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2012-08-08T19:04:00Z
OpenBSD-only cat > bug.d << CODE class Foo { int[] elements; final int bar() { return elements[0]; } } CODE dmd -c -O bug.d ---- The bug is caused by infinitely performing two associative transformations. - cgelem.c(4444): Replace (a op1 (b op2 c)) with ((a op2 b) op1 c) - cgelem.c(4471): Replace ((a op c1) op c2) with (a op (c2 op c1)) It only happens on OpenBSD because folding 'c2 op c1' fails in evalu8 due to a fenv.h workaround. The proposed fix is to perform the first transformation only if 'b' is not a constant.
Comment #1 by code — 2012-08-08T20:19:56Z
There is another similar bug. cat > bug.d << CODE int get(int[] devt) { return devt[$ - 1]; } CODE dmd -c -O bug.d ---- This can be reproduced on non-OpenBSD platforms by deactivating evalu8, i.e. defining 'elem * evalu8(elem *e) { return e; }'. This is effectively what this functions does on OpenBSD.
Comment #2 by code — 2012-08-08T20:30:50Z
Comment #3 by bugzilla — 2013-11-15T00:12:00Z
Comment #4 by github-bugzilla — 2013-11-15T03:00:15Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/9ad67cf518b7bb5747a9f9595d71c394a39c4196 fix Issue 8525 - optimizer loops infinitely https://github.com/D-Programming-Language/dmd/commit/8f635c55a0ee52bcbff193d27a6503855e656a0c Merge pull request #2774 from WalterBright/fix8525 fix Issue 8525 - optimizer loops infinitely
Comment #5 by github-bugzilla — 2013-11-15T11:49:07Z
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/5efd1c82b425992da07c57c929028ab3a0f65e8e Merge pull request #2774 from WalterBright/fix8525 fix Issue 8525 - optimizer loops infinitely