From: Martin Liska Date: Wed, 22 Mar 2017 12:29:36 +0000 (+0100) Subject: Backport r245993 X-Git-Tag: releases/gcc-5.5.0~450 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a097a9a20a4e647c5ebfbd1e9d5d4f85b924bba;p=thirdparty%2Fgcc.git Backport r245993 2017-03-22 Martin Liska Backport from mainline 2017-03-09 Martin Liska PR ipa/79761 * tree-chkp.c (chkp_get_bound_for_parm): Get bounds for a param. (chkp_find_bounds_1): Remove gcc_unreachable. 2017-03-22 Martin Liska Backport from mainline 2017-03-09 Martin Liska PR ipa/79761 * g++.dg/pr79761.C: New test. From-SVN: r246371 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cb742fef7b06..dfabfa856eef 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2017-03-22 Martin Liska + + Backport from mainline + 2017-03-09 Martin Liska + + PR ipa/79761 + * tree-chkp.c (chkp_get_bound_for_parm): Get bounds for a param. + (chkp_find_bounds_1): Remove gcc_unreachable. + 2017-03-22 Martin Liska Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index daceba125eee..e8524cb0f804 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2017-03-22 Martin Liska + + Backport from mainline + 2017-03-09 Martin Liska + + PR ipa/79761 + * g++.dg/pr79761.C: New test. + 2017-03-22 Martin Liska Backport from mainline diff --git a/gcc/testsuite/g++.dg/pr79761.C b/gcc/testsuite/g++.dg/pr79761.C new file mode 100644 index 000000000000..a97325a1fc4d --- /dev/null +++ b/gcc/testsuite/g++.dg/pr79761.C @@ -0,0 +1,34 @@ +/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && { ! x32 } } } } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx -mabi=ms" } */ + +struct Foo +{ + Foo() : a(1), b(1), c('a') {} + int a; + int b; + char c; +}; + +static Foo copy_foo(Foo) __attribute__((noinline, noclone)); + +static Foo copy_foo(Foo A) +{ + return A; +} + +struct Bar : Foo +{ + Bar(Foo t) : Foo(copy_foo(t)) {} +}; + +Foo F; + +int main (void) +{ + Bar B (F); + + if (B.a != 1 || B.b != 1 || B.c != 'a') + __builtin_abort (); + + return 0; +} diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c index 218c7eb40aba..237399ecc960 100644 --- a/gcc/tree-chkp.c +++ b/gcc/tree-chkp.c @@ -3556,8 +3556,8 @@ chkp_find_bounds_1 (tree ptr, tree ptr_src, gimple_stmt_iterator *iter) break; case PARM_DECL: - gcc_unreachable (); - bounds = chkp_get_bound_for_parm (ptr_src); + /* Handled above but failed. */ + bounds = chkp_get_invalid_op_bounds (); break; case TARGET_MEM_REF: