D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5180 - ICE(arrayop.c) in-place array operation on incompatible types
Summary: ICE(arrayop.c) in-place array operation on incompatible types
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: ice-on-invalid-code, patch
Depends on:
Blocks:
 
Reported: 2010-11-06 12:32 UTC by Shin Fujishiro
Modified: 2010-11-13 23:30 UTC (History)
1 user (show)

See Also:


Attachments
Patch against dmd r737, handles typeCombine errors (2.37 KB, patch)
2010-11-06 12:32 UTC, Shin Fujishiro
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description Shin Fujishiro 2010-11-06 12:32:31 UTC
Created attachment 803 [details]
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 Walter Bright 2010-11-13 23:30:26 UTC
http://www.dsource.org/projects/dmd/changeset/753