mips: Fix an ICE caused by r12-7962
authorXi Ruoyao <xry111@mengyan1223.wang>
Sat, 2 Apr 2022 10:39:51 +0000 (18:39 +0800)
committerXi Ruoyao <xry111@mengyan1223.wang>
Sat, 2 Apr 2022 11:16:03 +0000 (19:16 +0800)
commitbe07535d0f43390b8906826cc119473dea514b54
treed3f9908464445232c5b4755bca4f25886be91b75
parent2a82301d409d3aa0e0b3b884e4c6daeaa0486d6b
mips: Fix an ICE caused by r12-7962

DECL_SIZE(x) is NULL if x is a flexible array member, but I forgot to
check it in r12-7962.  Then if we increase the size of a struct with
flexible array member (by using aligned attribute), the code will
dereference NULL trying to use the "size" of the flexible array member.

gcc/

* config/mips/mips.cc (mips_function_arg): Check if DECL_SIZE is
NULL before dereferencing it.

gcc/testsuite/

* gcc.target/mips/pr102024-4.c: New test.
gcc/config/mips/mips.cc
gcc/testsuite/gcc.target/mips/pr102024-4.c [new file with mode: 0644]