fold-const: Fix division folding with vector operands [PR94412]
authorJakub Jelinek <jakub@redhat.com>
Tue, 31 Mar 2020 09:06:43 +0000 (11:06 +0200)
committerJakub Jelinek <jakub@redhat.com>
Tue, 31 Mar 2020 09:06:43 +0000 (11:06 +0200)
commit1dcffc8ddc48f0b45d3d0d2f763ef5870560eb9a
treeb000d2ce959c64e6d7afc16c63c7c9a73d918008
parent5ea39b2412269d208bb6ebd78303815957bd4f70
fold-const: Fix division folding with vector operands [PR94412]

The following testcase is miscompiled since 4.9, we treat unsigned
vector types as if they were signed and "optimize" negations across it.

2020-03-31  Marc Glisse  <marc.glisse@inria.fr>
    Jakub Jelinek  <jakub@redhat.com>

PR middle-end/94412
* fold-const.c (fold_binary_loc) <case TRUNC_DIV_EXPR>: Use
ANY_INTEGRAL_TYPE_P instead of INTEGRAL_TYPE_P.

* gcc.c-torture/execute/pr94412.c: New test.

Co-authored-by: Marc Glisse <marc.glisse@inria.fr>
gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr94412.c [new file with mode: 0644]