]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport r245993
authorMartin Liska <mliska@suse.cz>
Wed, 22 Mar 2017 12:29:36 +0000 (13:29 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Wed, 22 Mar 2017 12:29:36 +0000 (12:29 +0000)
2017-03-22  Martin Liska  <mliska@suse.cz>

Backport from mainline
2017-03-09  Martin Liska  <mliska@suse.cz>

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  <mliska@suse.cz>

Backport from mainline
2017-03-09  Martin Liska  <mliska@suse.cz>

PR ipa/79761
* g++.dg/pr79761.C: New test.

From-SVN: r246371

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr79761.C [new file with mode: 0644]
gcc/tree-chkp.c

index cb742fef7b0672352025badbd68f23647a730975..dfabfa856eef666dcb1a944949355d607bfef54b 100644 (file)
@@ -1,3 +1,12 @@
+2017-03-22  Martin Liska  <mliska@suse.cz>
+
+       Backport from mainline
+       2017-03-09  Martin Liska  <mliska@suse.cz>
+
+       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  <mliska@suse.cz>
 
        Backport from mainline
index daceba125eee4ca8e34bc8db7cc11d90730db7c8..e8524cb0f804d19ef0c531a798e01dba207f80e5 100644 (file)
@@ -1,3 +1,11 @@
+2017-03-22  Martin Liska  <mliska@suse.cz>
+
+       Backport from mainline
+       2017-03-09  Martin Liska  <mliska@suse.cz>
+
+       PR ipa/79761
+       * g++.dg/pr79761.C: New test.
+
 2017-03-22  Martin Liska  <mliska@suse.cz>
 
        Backport from mainline
diff --git a/gcc/testsuite/g++.dg/pr79761.C b/gcc/testsuite/g++.dg/pr79761.C
new file mode 100644 (file)
index 0000000..a97325a
--- /dev/null
@@ -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;
+}
index 218c7eb40aba71068e65d40ec2d4f6cfcea96ca9..237399ecc96078a090b3838a665f47f23af39890 100644 (file)
@@ -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: