Bug 10949 – CTFE ICE after indexing error

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-01T23:21:00Z
Last change time
2013-09-01T23:45:47Z
Keywords
CTFE, ice
Assigned to
nobody
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2013-09-01T23:21:02Z
In the compiler, any call to optimize() may create an ErrorExp, if an array bounds error occurs. This error is currently not propagated by any of the optimize() functions. If this optimized expression is passed to CTFE, the CTFE check for AST validity will fail. Here's a single static assert which tests 14 cases. int global; static assert((((((([5,5][3] + global - global)*global/global%global)>>global)&global|global)^global) == 9, [2,3][17]) || ([3,3,3][9] is 4) && ([[1,2,3]][4]).length);
Comment #1 by github-bugzilla — 2013-09-01T23:45:15Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4a0f6cca0ade3fdc7e5dc50e8b537db081301028 Fix issue 10949 CTFE ICE after indexing error When an error occurs during optimize(), propagate the ErrorExp.