diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-09-16 09:09:27 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-09-16 09:09:27 +0200 |
commit | 7d704548e7aabca540cc173f70df1e0dcfc6304c (patch) | |
tree | 13801b02aa4d59b734c19f7511e572c11dd58192 | |
parent | ff18118fba30ff4befcf94eba9b239a4fe6f3a6c (diff) | |
download | gcc-7d704548e7aabca540cc173f70df1e0dcfc6304c.zip gcc-7d704548e7aabca540cc173f70df1e0dcfc6304c.tar.gz gcc-7d704548e7aabca540cc173f70df1e0dcfc6304c.tar.bz2 |
re PR middle-end/77594 (double computation for __builtin_sub_overflow (0, ...))
PR middle-end/77594
* internal-fn.c (expand_arith_overflow) <case MINUS_EXPR>: Don't fall
through into expand_addsub_overflow after expand_neg_overflow.
* gcc.target/i386/pr77594.c: New test.
Co-Authored-By: Eric Botcazou <ebotcazou@adacore.com>
From-SVN: r240173
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/internal-fn.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr77594.c | 11 |
4 files changed, 28 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d103ae6..0287d52 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-09-16 Jakub Jelinek <jakub@redhat.com> + Eric Botcazou <ebotcazou@adacore.com> + + PR middle-end/77594 + * internal-fn.c (expand_arith_overflow) <case MINUS_EXPR>: Don't fall + through into expand_addsub_overflow after expand_neg_overflow. + 2016-09-15 David Malcolm <dmalcolm@redhat.com> * diagnostic-show-locus.c diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c index cd4b625..c269ca6 100644 --- a/gcc/internal-fn.c +++ b/gcc/internal-fn.c @@ -1833,7 +1833,10 @@ expand_arith_overflow (enum tree_code code, gimple *stmt) { case MINUS_EXPR: if (integer_zerop (arg0) && !unsr_p) - expand_neg_overflow (loc, lhs, arg1, false); + { + expand_neg_overflow (loc, lhs, arg1, false); + return; + } /* FALLTHRU */ case PLUS_EXPR: expand_addsub_overflow (loc, code, lhs, arg0, arg1, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3c20875..8d739b5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-09-16 Jakub Jelinek <jakub@redhat.com> + Eric Botcazou <ebotcazou@adacore.com> + + PR middle-end/77594 + * gcc.target/i386/pr77594.c: New test. + 2016-09-15 Louis Krupp <louis.krupp@zoho.com> PR fortran/69963 diff --git a/gcc/testsuite/gcc.target/i386/pr77594.c b/gcc/testsuite/gcc.target/i386/pr77594.c new file mode 100644 index 0000000..96c51fd --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr77594.c @@ -0,0 +1,11 @@ +/* PR middle-end/77594 */ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +int +foo (int a, int *b) +{ + return __builtin_sub_overflow (0, a, b); +} + +/* { dg-final { scan-assembler-times "\tjn?o\t" 1 } } */ |