PR sanitizer/64121
* ubsan.c (instrument_object_size): Stop searching if the base
occurs in abnormal phi.
* c-c++-common/ubsan/pr64121.c: New test.
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r218222
+2014-12-01 Marek Polacek <polacek@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/64121
+ * ubsan.c (instrument_object_size): Stop searching if the base
+ occurs in abnormal phi.
+
2014-12-01 Marek Polacek <polacek@redhat.com>
PR sanitizer/63956
+2014-12-01 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/64121
+ * c-c++-common/ubsan/pr64121.c: New test.
+
2014-12-01 Marek Polacek <polacek@redhat.com>
PR sanitizer/63956
--- /dev/null
+/* PR sanitizer/64121 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined -Wno-pointer-arith" } */
+
+extern int tab[16];
+
+void
+execute (int *ip, int x)
+{
+ int *xp = tab;
+base:
+ if (x)
+ return;
+ *xp++ = *ip;
+ goto *(&&base + *ip);
+}
&& POINTER_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (def_stmt))))
|| (is_gimple_assign (def_stmt)
&& gimple_assign_rhs_code (def_stmt) == POINTER_PLUS_EXPR))
- base = gimple_assign_rhs1 (def_stmt);
+ {
+ tree rhs1 = gimple_assign_rhs1 (def_stmt);
+ if (TREE_CODE (rhs1) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1))
+ break;
+ else
+ base = rhs1;
+ }
else
break;
}