gnu/gcc/d35cd84185331e8f13eb7ce01029fb16c4cb8d31 forwprop: Add missing NULL check on vdef in optimize_aggr_zeroprop [PR124742]
When I converted optimize_aggr_zeroprop into a forward walk instead of
a backward walk, I missed that the vdef of a memset call could be NULL.
This only happens when there is "undefined" declaration of memset exists.
Anyways this fixes the ICE by adding the NULL check and an early out.
Bootstrapped and tested on x86_64-linux-gnu.
PR tree-optimization/124742
gcc/ChangeLog:
* tree-ssa-forwprop.cc (optimize_aggr_zeroprop): Exit
if the vdef on the stmt is NULL.
gcc/testsuite/ChangeLog:
* gcc.dg/torture/pr124742-1.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2 files changed