]> git.ipfire.org Git - thirdparty/gcc.git/commit
d: fix ICE at convert_expr(tree_node*, Type*, Type*) (PR101490)
authorIain Buclaw <ibuclaw@gdcproject.org>
Mon, 26 Jul 2021 13:11:42 +0000 (15:11 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Wed, 28 Jul 2021 11:29:54 +0000 (13:29 +0200)
commit45be6e80884d452c927c24e43b9018e2aa141c64
treebbe0deb29c9402fdf042266f04f9742ea34de615
parent9075f62ddc3b9ffdb9e1b28d472adfd7fef4a0f1
d: fix ICE at convert_expr(tree_node*, Type*, Type*) (PR101490)

Both the front-end and code generator had a modulo by zero bug when testing if
a conversion from a static array to dynamic array was valid.

PR d/101490

gcc/d/ChangeLog:

* d-codegen.cc (build_array_index): Handle void arrays same as byte.
* d-convert.cc (convert_expr): Handle converting to zero-sized arrays.
* dmd/dcast.c (castTo): Handle casting to zero-sized arrays.

gcc/testsuite/ChangeLog:

* gdc.dg/pr101490.d: New test.
* gdc.test/fail_compilation/fail22144.d: New test.

(cherry picked from commit c936c39f86c74b3bfc6831f694b3165296c99dc0)
gcc/d/d-codegen.cc
gcc/d/d-convert.cc
gcc/d/dmd/dcast.c
gcc/testsuite/gdc.dg/pr101490.d [new file with mode: 0644]
gcc/testsuite/gdc.test/fail_compilation/fail22144.d [new file with mode: 0644]