]> gcc.gnu.org Git - gcc.git/commit - gcc/c-family/ChangeLog
c-family: Tighten vector handling in type_for_mode [PR94072]
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 17 Mar 2020 14:43:08 +0000 (14:43 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Fri, 20 Mar 2020 16:14:56 +0000 (16:14 +0000)
commit1aa22b1916a493ac46453d96e0c78ca47bcaeda3
tree0ea7e0d2da9a34f3b23eb384770101da82a67775
parentc3562f81042e05d9bc82d6834cac761c9d9db0c8
c-family: Tighten vector handling in type_for_mode [PR94072]

In this PR we had a 512-bit VECTOR_TYPE whose mode is XImode
(an integer mode used for four 128-bit vectors).  When trying
to expand a zero constant for it, we hit code in expand_expr_real_1
that tries to use the associated integer type instead.  The code used
type_for_mode (XImode, 1) to get this integer type.

However, the c-family implementation of type_for_mode checks for
any registered built-in type that matches the mode and has the
right signedness.  This meant that it could return a built-in
vector type when given an integer mode (particularly if, as here,
the vector type isn't supported by the current subtarget and so
TYPE_MODE != TYPE_MODE_RAW).  The expand code would then cycle
endlessly trying to use this "new" type instead of the original
vector type.

2020-03-20  Richard Sandiford  <richard.sandiford@arm.com>

gcc/c-family/
PR middle-end/94072
* c-common.c (c_common_type_for_mode): Before using a registered
built-in type, check that the vectorness of the type matches
the vectorness of the mode.

gcc/testsuite/
PR middle-end/94072
* gcc.target/aarch64/pr94072.c: New test.
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/pr94072.c [new file with mode: 0644]
This page took 0.060665 seconds and 5 git commands to generate.