ipa: Check cst type when propagating controled uses info
authorMartin Jambor <mjambor@suse.cz>
Mon, 30 May 2022 20:04:21 +0000 (22:04 +0200)
committerMartin Jambor <mjambor@suse.cz>
Mon, 30 May 2022 20:04:42 +0000 (22:04 +0200)
commit081c472589329fc6c58c4dfed70f1fbc029083a5
tree89e0ac57ea78bca2c6e3400b2f9e74128c28afa5
parent8f32de15e469673935618fc1a998dcafddb0bbf4
ipa: Check cst type when propagating controled uses info

PR 105639 shows that code with type-mismatches can trigger an assert
after runnning into a branch that was inteded only for references to
variables - as opposed to references to functions.  Fixed by moving
the condition from the assert to the guarding if statement.

gcc/ChangeLog:

2022-05-25  Martin Jambor  <mjambor@suse.cz>

PR ipa/105639
* ipa-prop.cc (propagate_controlled_uses): Check type of the
constant before adding a LOAD reference.

gcc/testsuite/ChangeLog:

2022-05-25  Martin Jambor  <mjambor@suse.cz>

PR ipa/105639
* gcc.dg/ipa/pr105639.c: New test.

(cherry picked from commit f571596f8cd8fbad34305b4bec1a813620e0cbf0)
gcc/ipa-prop.cc
gcc/testsuite/gcc.dg/ipa/pr105639.c [new file with mode: 0644]