]> git.ipfire.org Git - thirdparty/gcc.git/commit
aarch64: Fix ICE when laying out arguments of size 0 [PR 122763]
authorAlfie Richards <alfie.richards@arm.com>
Wed, 19 Nov 2025 11:47:09 +0000 (11:47 +0000)
committerAlfie Richards <alfie.richards@arm.com>
Wed, 19 Nov 2025 17:02:47 +0000 (17:02 +0000)
commitd56eb2fbcb5a65ca738534fab640e36b9061b0b2
treef406ba450b4f5d49efe70c4ca260c342b683d3a7
parent5eebbc9662745d7e74f2b06eb5d2c42e96fe6765
aarch64: Fix ICE when laying out arguments of size 0 [PR 122763]

When laying out arguments of size 0, previously would return the next argument
passing register, without checking that there was a next one.

This was fine for AAPCS as it used R0-R7 for argument passing and R9 would be
occasionally be assigned, but never used.

However, with the introduction of preserve_none PCS there is no obvious "next
register" to use as aaaa dummy value, and so when laying out in the
"next register" when there were no more, an assert triggered an ICE.

This patch fixes this ICE by instead using NULL_RTX for arguments of size 0.

PR target/122763

gcc/ChangeLog:

* config/aarch64/aarch64.cc (aarch64_layout_arg): Return NULL_RTX for
arguments of size 0.
(aarch64_function_arg_advance): Remove assert.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/pr122763.c: New test.
gcc/config/aarch64/aarch64.cc
gcc/testsuite/gcc.target/aarch64/pr122763.c [new file with mode: 0644]