+2018-08-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR middle-end/86121
+ * tree-ssa-strlen.c (adjust_last_stmt): Avoid folding away undefined
+ behaviour.
+
2018-08-21 Rasmus Villemoes <rv@rasmusvillemoes.dk>
* config/vxworks.h: Guard vxworks_asm_out_constructor and
+2018-08-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR middle-end/86121
+ * gcc.dg/Wstringop-overflow-6.c: Remove xfail.
+
2018-08-21 Tom de Vries <tdevries@suse.de>
* gcc.c-torture/unsorted/dump-noaddr.x: Use -gno-record-gcc-switches
void test_strcpy_strcat_2 (void)
{
- strcpy (a2, "12"), strcat (a2, "3"); /* { dg-warning "\\\[-Wstringop-overflow=]" "bug 86121" { xfail *-*-* } } */
+ strcpy (a2, "12"), strcat (a2, "3"); /* { dg-warning "\\\[-Wstringop-overflow=]" } */
}
void test_strcpy_strcat_3 (void)
to store the extra '\0' in that case. */
if ((tree_to_uhwi (len) & 3) == 0)
return;
+
+ /* Don't fold away an out of bounds access, as this defeats proper
+ warnings. */
+ tree dst = gimple_call_arg (last.stmt, 0);
+ tree size = compute_objsize (dst, 0);
+ if (size && tree_int_cst_lt (size, len))
+ return;
}
else if (TREE_CODE (len) == SSA_NAME)
{