diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-04-05 05:25:18 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-04-05 05:25:18 +0000 |
commit | d992f757accd492ec238bb18264a9d3500f6678f (patch) | |
tree | e33a8dee4a33fe4fdf2bf3811fa6c87ed9b76b78 | |
parent | 69e10a01243aa2e149bbb16ea3b4aab3742f504d (diff) |
PR target/80310
* tree-nvr.c: Include internal-fn.h.
(pass_return_slot::execute): Ignore internal calls without
direct optab.
* c-c++-common/ubsan/pr80310.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246699 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/ubsan/pr80310.c | 12 | ||||
-rw-r--r-- | gcc/tree-nrv.c | 7 |
4 files changed, 31 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ac9ab8ad960..3e1e0701e44 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-04-05 Jakub Jelinek <jakub@redhat.com> + + PR target/80310 + * tree-nvr.c: Include internal-fn.h. + (pass_return_slot::execute): Ignore internal calls without + direct optab. + 2017-04-04 Jakub Jelinek <jakub@redhat.com> Richard Biener <rguenther@suse.de> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bdb1c01c6e6..b030d22daf0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-04-05 Jakub Jelinek <jakub@redhat.com> + + PR target/80310 + * c-c++-common/ubsan/pr80310.c: New test. + 2017-04-04 Jakub Jelinek <jakub@redhat.com> PR c++/80297 diff --git a/gcc/testsuite/c-c++-common/ubsan/pr80310.c b/gcc/testsuite/c-c++-common/ubsan/pr80310.c new file mode 100644 index 00000000000..529f32ae9af --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/pr80310.c @@ -0,0 +1,12 @@ +/* PR target/80310 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fsanitize=signed-integer-overflow" } */ +/* { dg-additional-options "-mno-avx" { target i?86-*-* x86_64-*-* } } */ + +typedef int V __attribute__((vector_size (32))); + +void +foo (V *a, V *b, V *c) +{ + *a = *b + *c; /* { dg-bogus "AVX vector return without AVX enabled changes the ABI" "" { target i?86-*-* x86_64-*-* } } */ +} diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c index 78b6c0e2c25..953135b0375 100644 --- a/gcc/tree-nrv.c +++ b/gcc/tree-nrv.c @@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-pretty-print.h" #include "gimple-iterator.h" #include "gimple-walk.h" +#include "internal-fn.h" /* This file implements return value optimizations for functions which return aggregate types. @@ -377,6 +378,12 @@ pass_return_slot::execute (function *fun) if (stmt && gimple_call_lhs (stmt) && !gimple_call_return_slot_opt_p (stmt) + /* Ignore internal functions without direct optabs, + those are expanded specially and aggregate_value_p + on their result might result in undesirable warnings + with some backends. */ + && (!gimple_call_internal_p (stmt) + || direct_internal_fn_p (gimple_call_internal_fn (stmt))) && aggregate_value_p (TREE_TYPE (gimple_call_lhs (stmt)), gimple_call_fndecl (stmt))) { |