re PR sanitizer/79897 (ICE in gimplify_modify_expr, at gimplify.c:5627 on ARM target)
authorJakub Jelinek <jakub@redhat.com>
Tue, 7 Mar 2017 06:11:14 +0000 (07:11 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 7 Mar 2017 06:11:14 +0000 (07:11 +0100)
PR sanitizer/79897
* ubsan.c (ubsan_encode_value): Call mark_addressable on the
temporary.

* c-c++-common/ubsan/pr79897.c: New test.

From-SVN: r245945

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/ubsan/pr79897.c [new file with mode: 0644]
gcc/ubsan.c

index 2727acd19292b7731e676f4aeb57c031a7288554..eb06b5ab2eb9dfe49f3e33e049fd13430c1ecc3f 100644 (file)
@@ -1,3 +1,9 @@
+2017-03-07  Jakub Jelinek  <jakub@redhat.com>
+
+       PR sanitizer/79897
+       * ubsan.c (ubsan_encode_value): Call mark_addressable on the
+       temporary.
+
 2017-03-06  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/79821
index 2f27e4b535c519ceabeabbad9624f7a4df78cb87..9c8b87e90c70218646050844d6b46d2603f1dc7a 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-07  Jakub Jelinek  <jakub@redhat.com>
+
+       PR sanitizer/79897
+       * c-c++-common/ubsan/pr79897.c: New test.
+
 2017-03-06  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR rtl-optimization/79571
diff --git a/gcc/testsuite/c-c++-common/ubsan/pr79897.c b/gcc/testsuite/c-c++-common/ubsan/pr79897.c
new file mode 100644 (file)
index 0000000..0dadcff
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR sanitizer/79897 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=enum -O2" } */
+
+enum E
+{
+  A = 0,
+  B = ~0U + 1LL
+} x = A;
+
+int
+main ()
+{
+  return x != A;
+}
index 11a41e1dc535eb87167450879d025bb8537d6d8a..17965efde5c0e917da44f34d1d006a1e0c01793c 100644 (file)
@@ -145,6 +145,7 @@ ubsan_encode_value (tree t, bool in_expand_p)
             code by making vars unnecessarily addressable.  */
          tree var = create_tmp_var (type);
          tree tem = build2 (MODIFY_EXPR, void_type_node, var, t);
+         mark_addressable (var);
          if (in_expand_p)
            {
              rtx mem