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

Backport from mainline
2016-06-13  Martin Liska  <mliska@suse.cz>

PR target/65705
PR target/69804
PR sanitizer/71458

* toplev.c (process_options): Enable MPX with LSAN and UBSAN.
* tree-chkp.c (chkp_walk_pointer_assignments): Verify that
FIELD != NULL.
2017-03-22  Martin Liska  <mliska@suse.cz>

Backport from mainline
2016-06-13  Martin Liska  <mliska@suse.cz>

PR sanitizer/71458
* gcc.target/i386/pr71458.c: New test.

From-SVN: r246373

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr71458.c [new file with mode: 0644]
gcc/toplev.c
gcc/tree-chkp.c

index 1fb90dbb7a07a6b959b974a05497773bf897082e..afa1abf4c41f3bfb067827df5cb708f81ddf8839 100644 (file)
@@ -1,3 +1,16 @@
+2017-03-22  Martin Liska  <mliska@suse.cz>
+
+       Backport from mainline
+       2016-06-13  Martin Liska  <mliska@suse.cz>
+
+       PR target/65705
+       PR target/69804
+       PR sanitizer/71458
+
+       * toplev.c (process_options): Enable MPX with LSAN and UBSAN.
+       * tree-chkp.c (chkp_walk_pointer_assignments): Verify that
+       FIELD != NULL.
+
 2017-03-22  Martin Liska  <mliska@suse.cz>
 
        Backport from mainline
index 93c381c7ba73c4844b48b2d89e2f32b979511a2f..c32a149b563cc0e24884f74ad32e36d6409f7f9c 100644 (file)
@@ -1,3 +1,11 @@
+2017-03-22  Martin Liska  <mliska@suse.cz>
+
+       Backport from mainline
+       2016-06-13  Martin Liska  <mliska@suse.cz>
+
+       PR sanitizer/71458
+       * gcc.target/i386/pr71458.c: New test.
+
 2017-03-22  Martin Liska  <mliska@suse.cz>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.target/i386/pr71458.c b/gcc/testsuite/gcc.target/i386/pr71458.c
new file mode 100644 (file)
index 0000000..d36b61c
--- /dev/null
@@ -0,0 +1,7 @@
+/* { dg-do compile { target { ! x32 } } } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -fsanitize=bounds" } */
+/* { dg-error "'-fcheck-pointer-bounds' is not supported with '-fsanitize=bounds'" "" { target *-*-* } 0 } */
+
+enum {} a[0];
+void fn1(int);
+void fn2() { fn1(a[-1]); }
index cb6c51739ffc40d19f83efafb02d7670e4da2915..c565ea4797e383ddafbdd2504f23e3ed77447606 100644 (file)
@@ -1367,16 +1367,33 @@ process_options (void)
     {
       if (targetm.chkp_bound_mode () == VOIDmode)
        {
-         error ("-fcheck-pointer-bounds is not supported for this target");
+         error ("%<-fcheck-pointer-bounds%> is not supported for this "
+                "target");
          flag_check_pointer_bounds = 0;
        }
 
+      if (flag_sanitize & SANITIZE_BOUNDS)
+       {
+         error ("%<-fcheck-pointer-bounds%> is not supported with "
+                "%<-fsanitize=bounds%>");
+         flag_check_pointer_bounds = 0;
+       }
+
       if (flag_sanitize & SANITIZE_ADDRESS)
        {
-         error ("-fcheck-pointer-bounds is not supported with "
+         error ("%<-fcheck-pointer-bounds%> is not supported with "
                 "Address Sanitizer");
          flag_check_pointer_bounds = 0;
        }
+
+      if (flag_sanitize & SANITIZE_THREAD)
+       {
+         error (UNKNOWN_LOCATION,
+                "%<-fcheck-pointer-bounds%> is not supported with "
+                "Thread Sanitizer");
+
+         flag_check_pointer_bounds = 0;
+       }
     }
 
   /* One region RA really helps to decrease the code size.  */
index 237399ecc96078a090b3838a665f47f23af39890..049bafae4e2d2d34e37b9916bb396b1b1bd36578 100644 (file)
@@ -3690,7 +3690,7 @@ chkp_walk_pointer_assignments (tree lhs, tree rhs, void *arg,
 
          FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (rhs), cnt, field, val)
            {
-             if (chkp_type_has_pointer (TREE_TYPE (field)))
+             if (field && chkp_type_has_pointer (TREE_TYPE (field)))
                {
                  tree lhs_field = chkp_build_component_ref (lhs, field);
                  chkp_walk_pointer_assignments (lhs_field, val, arg, handler);