aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dse.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-06-27 11:41:34 +0200
committerMartin Liska <marxin@gcc.gnu.org>2019-06-27 09:41:34 +0000
commit4c4be718fb65f9b8dd06d83c6fa3f697a5369d52 (patch)
tree8628d7cbb265cdea6fa0ad8b94a416eee3108674 /gcc/tree-ssa-dse.c
parentfecd7a1ab444a38ebda5c1d495ee48f02f290a25 (diff)
downloadgcc-4c4be718fb65f9b8dd06d83c6fa3f697a5369d52.zip
gcc-4c4be718fb65f9b8dd06d83c6fa3f697a5369d52.tar.gz
gcc-4c4be718fb65f9b8dd06d83c6fa3f697a5369d52.tar.bz2
Fix ICE when __builtin_calloc has no LHS (PR tree-optimization/91014).
2019-06-27 Martin Liska <mliska@suse.cz> PR tree-optimization/91014 * tree-ssa-dse.c (initialize_ao_ref_for_dse): Bail out when LHS is NULL_TREE. 2019-06-27 Martin Liska <mliska@suse.cz> PR tree-optimization/91014 * gcc.target/s390/pr91014.c: New test. From-SVN: r272738
Diffstat (limited to 'gcc/tree-ssa-dse.c')
-rw-r--r--gcc/tree-ssa-dse.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index 1b1a9f3..df05a55 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -129,10 +129,11 @@ initialize_ao_ref_for_dse (gimple *stmt, ao_ref *write)
{
tree nelem = gimple_call_arg (stmt, 0);
tree selem = gimple_call_arg (stmt, 1);
+ tree lhs;
if (TREE_CODE (nelem) == INTEGER_CST
- && TREE_CODE (selem) == INTEGER_CST)
+ && TREE_CODE (selem) == INTEGER_CST
+ && (lhs = gimple_call_lhs (stmt)) != NULL_TREE)
{
- tree lhs = gimple_call_lhs (stmt);
tree size = fold_build2 (MULT_EXPR, TREE_TYPE (nelem),
nelem, selem);
ao_ref_init_from_ptr_and_size (write, lhs, size);