aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2017-03-09 10:22:29 +0100
committerMartin Liska <marxin@gcc.gnu.org>2017-03-09 09:22:29 +0000
commit8dc19053e1f5af5af97ce7b9e8ebd6e657b23277 (patch)
tree237ec5a5190c692675856739ba4df20c7a6e6606 /gcc
parentbba81f1c84837b1a9bfd5daa46d263e87577af89 (diff)
downloadgcc-8dc19053e1f5af5af97ce7b9e8ebd6e657b23277.zip
gcc-8dc19053e1f5af5af97ce7b9e8ebd6e657b23277.tar.gz
gcc-8dc19053e1f5af5af97ce7b9e8ebd6e657b23277.tar.bz2
Get bounds for a PARM_DECL (PR ipa/79761).
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. From-SVN: r245993
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/pr79761.C34
-rw-r--r--gcc/tree-chkp.c4
4 files changed, 47 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 80d0aea..b3ab72b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 13218ac..371fdbb 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..a97325a
--- /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 b7b412e..66612ba 100644
--- a/gcc/tree-chkp.c
+++ b/gcc/tree-chkp.c
@@ -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: