PR modula2/109586 cc1gm2 ICE when compiling large source files.
commita7e1ee39e4fa37d005929c4ff9457d1a199559c6
authorGaius Mulley <gaiusmod2@gmail.com>
Fri, 21 Apr 2023 12:19:54 +0000 (21 13:19 +0100)
committerGaius Mulley <gaiusmod2@gmail.com>
Fri, 21 Apr 2023 12:19:54 +0000 (21 13:19 +0100)
tree69044e6be9a89e990e4055adcc15fe8d353552b7
parentcddfe6bc40b3dc0806e260bbfb4cac82d609a258
PR modula2/109586 cc1gm2 ICE when compiling large source files.

The function m2block_RememberConstant calls m2tree_IsAConstant.
However IsAConstant does not recognise TREE_CODE(t) ==
CONSTRUCTOR as a constant.  Without this patch CONSTRUCTOR
contants are garbage collected (and not preserved) resulting in
a corrupt tree and crash.

gcc/m2/ChangeLog:

PR modula2/109586
* gm2-gcc/m2tree.cc (m2tree_IsAConstant): Add (TREE_CODE
(t) == CONSTRUCTOR) to expression.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
gcc/m2/gm2-gcc/m2tree.cc