]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Get bounds for a PARM_DECL (PR ipa/79761).
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Mar 2017 09:22:29 +0000 (09:22 +0000)
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Mar 2017 09:22:29 +0000 (09:22 +0000)
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-09  Martin Liska  <mliska@suse.cz>

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245993 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 80d0aeaa6e450ea4a3f334d7037b2b2a27e53e29..b3ab72b3d8206239b7f7bc88f9f037043f297799 100644 (file)
@@ -1,3 +1,9 @@
+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-09  Jakub Jelinek  <jakub@redhat.com>
 
        PR sanitizer/79944
index 13218ac30eb286f657e2d10907ff302ace8b965c..371fdbb84282b6ab67db7b1408a633cc79e24b59 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-09  Martin Liska  <mliska@suse.cz>
+
+       PR ipa/79761
+       * g++.dg/pr79761.C: New test.
+
 2017-03-09  Jakub Jelinek  <jakub@redhat.com>
 
        PR sanitizer/79944
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 b7b412efcef7bdf622ff089e8c2aebe30232cd96..66612baaaff3bcf0ff58768c8a292137ab370802 100644 (file)
@@ -3604,8 +3604,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: