]> git.ipfire.org Git - thirdparty/gcc.git/commit
d: Fix ICE in setValue, at d/dmd/dinterpret.c:7013
authorIain Buclaw <ibuclaw@gdcproject.org>
Sat, 1 Jul 2023 13:04:25 +0000 (15:04 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Sat, 1 Jul 2023 13:48:37 +0000 (15:48 +0200)
commita44fb702058974cc7592e8f8a81260f6ab35bece
tree03989d4a0d612c09ee207fef47fc0e697cc7239e
parent31012ea997656061d07790de5a07b4e629211cd1
d: Fix ICE in setValue, at d/dmd/dinterpret.c:7013

Backports ICE fix from upstream.  When casting null to integer or real,
instead of painting the type on the NullExp, we emplace an
IntegerExp/RealExp with the value zero.  Same as when casting from
NullExp to bool.

Reviewed-on: https://github.com/dlang/dmd/pull/13172

PR d/110511

gcc/d/ChangeLog:

* dmd/dinterpret.c (Interpreter::visit (CastExp *)): Handle casting
null to int or float.

gcc/testsuite/ChangeLog:

* gdc.test/compilable/test21794.d: New test.

(cherry picked from commit 066385c918485d4cef5c243d3b0691193df382de)
gcc/d/dmd/dinterpret.c
gcc/testsuite/gdc.test/compilable/test21794.d [new file with mode: 0644]