Fix tree-optimization/78886.

PR tree-optimization/78886
	* gcc.dg/tree-ssa/pr78886.c: New test.
	PR tree-optimization/78886
	* tree-ssa-strlen.c (handle_builtin_malloc): Return when LHS
	is equal to NULL.

From-SVN: r243886
This commit is contained in:
Martin Liska 2016-12-22 14:09:11 +01:00 committed by Martin Liska
parent 7fbb9b18cc
commit a71dcca81e
4 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2016-12-22 Martin Liska <mliska@suse.cz>
PR tree-optimization/78886
* tree-ssa-strlen.c (handle_builtin_malloc): Return when LHS
is equal to NULL.
2016-12-22 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/78817

View File

@ -1,3 +1,8 @@
2016-12-22 Martin Liska <mliska@suse.cz>
PR tree-optimization/78886
* gcc.dg/tree-ssa/pr78886.c: New test.
2016-12-22 Georg-Johann Lay <avr@gjlay.de>
PR testsuite/52641

View File

@ -0,0 +1,10 @@
/* { dg-do compile } */
/* { dg-options "-O2" } */
void *malloc(unsigned long x);
void foo(void)
{
volatile int i;
malloc(1);
i;
}

View File

@ -1869,6 +1869,9 @@ handle_builtin_malloc (enum built_in_function bcode, gimple_stmt_iterator *gsi)
{
gimple *stmt = gsi_stmt (*gsi);
tree lhs = gimple_call_lhs (stmt);
if (lhs == NULL_TREE)
return;
gcc_assert (get_stridx (lhs) == 0);
int idx = new_stridx (lhs);
tree length = NULL_TREE;