tree-optimization/103987 - guard DSE modref query
authorRichard Biener <rguenther@suse.de>
Tue, 18 Jan 2022 12:26:22 +0000 (13:26 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 18 Jan 2022 13:33:01 +0000 (14:33 +0100)
commit3ed40db0f12994e64434dc2e0590ba1da7ba5f60
tree52aa05b7d8a4568e15ad66da96bcdfcee26b0ac7
parent4288b57affe34fbc60badf798eb0c19892e69980
tree-optimization/103987 - guard DSE modref query

This adds a missing guard for a pointer to the DSE modref query,
otherwise we can end up invoking APIs desired to only work on
pointers on non-pointers when there are mismatches between declared
and actual arguments of functions in the program.

2022-01-18  Richard Biener  <rguenther@suse.de>

PR tree-optimization/103987
* tree-ssa-dse.cc (dse_optimize_call): Properly guard modref
query with a pointer check.

* gcc.dg/torture/pr103987.c: New testcase.
gcc/testsuite/gcc.dg/torture/pr103987.c [new file with mode: 0644]
gcc/tree-ssa-dse.cc