]> 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:21:16 +0000 (15:21 +0200)
commit066385c918485d4cef5c243d3b0691193df382de
tree6d4ba493811abeee2bb7277658d9fa9d2fa37bc1
parentfe369fa9c5a2056ee060c35d2ba9afb748ab568f
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.
gcc/d/dmd/dinterpret.c
gcc/testsuite/gdc.test/compilable/test21794.d [new file with mode: 0644]