PR sanitizer/81223
* ubsan.c (instrument_null): Check get_base_address's result for null.
* gcc.dg/ubsan/pr81223.c: New test.
From-SVN: r249687
+2017-06-27 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/81223
+ * ubsan.c (instrument_null): Check get_base_address's result for null.
+
2017-06-27 Marc Glisse <marc.glisse@inria.fr>
* match.pd ((A+-B)+(C-A), (A+B)-(A-C)): New transformations.
+2017-06-27 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/81223
+ * gcc.dg/ubsan/pr81223.c: New test.
+
2017-06-27 Marc Glisse <marc.glisse@inria.fr>
* gcc.dg/tree-ssa/assoc-1.c: New file.
--- /dev/null
+/* PR sanitizer/81223 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined" } */
+
+void bar ();
+
+void
+foo (int x)
+{
+ struct S { char a[x]; } v;
+ bar (v);
+}
if (TREE_CODE (t) == ADDR_EXPR)
t = TREE_OPERAND (t, 0);
tree base = get_base_address (t);
- if (TREE_CODE (base) == MEM_REF
+ if (base != NULL_TREE
+ && TREE_CODE (base) == MEM_REF
&& TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME)
instrument_mem_ref (t, base, &gsi, is_lhs);
}