Bug 5180 – ICE(arrayop.c) in-place array operation on incompatible types

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-11-06T12:32:00Z
Last change time
2010-11-13T23:30:26Z
Keywords
ice-on-invalid-code, patch
Assigned to
nobody
Creator
rsinfu

Attachments

IDFilenameSummaryContent-TypeSize
803ice-array-opassign.patchPatch against dmd r737, handles typeCombine errorstext/plain2427

Comments

Comment #0 by rsinfu — 2010-11-06T12:32:31Z
Created attachment 803 Patch against dmd r737, handles typeCombine errors In-place array operation "x[] op= y" causes a segfault if the types of x and y are incompatible for that array op. ---------- void main() { int[] arr; arr[] *= 1.5; // (4) } ---------- % dmd -o- -c test.d test.d(4): Error: incompatible types for ((arr[]) *= (1.5)): 'int[]' and 'double' zsh: segmentation fault (core dumped) dmd -o- -c test.d ---------- The segfault happens in BinExp::arrayOp() when its type is TypeError because of the incompatible types. The proposed patch makes it sure that the error condition is handled before arrayOp().
Comment #1 by bugzilla — 2010-11-13T23:30:26Z