[PR 89209] Avoid segfault in a peculiar corner case in SRA
authorMartin Jambor <mjambor@suse.cz>
Mon, 18 Feb 2019 08:59:04 +0000 (09:59 +0100)
committerMartin Jambor <jamborm@gcc.gnu.org>
Mon, 18 Feb 2019 08:59:04 +0000 (09:59 +0100)
commit469b4adb4fec2b61caee16ed982f5fab333e784b
tree5d0bbafdf437cf662f2be34721a7245a03b1733c
parentdb30281f0b2ff6dfc0c4146291baf020a27e4065
[PR 89209] Avoid segfault in a peculiar corner case in SRA

2019-02-18  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/89209
* tree-sra.c (create_access_replacement): New optional parameter
reg_tree.  Use it as a type if non-NULL and access type is not of
a register type.
(get_repl_default_def_ssa_name): New parameter REG_TYPE, pass it
to create_access_replacement.
(sra_modify_assign): Pass LHS type to get_repl_default_def_ssa_name.
Check lacc is non-NULL before attempting to re-create it on the RHS.

testsuite/
* gcc.dg/tree-ssa/pr89209.c: New test.

From-SVN: r268980
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr89209.c [new file with mode: 0644]
gcc/tree-sra.c