Fix ICE on view conversion between struct and integer
commitb0f02eeb906b6351099ac97066ef74b6167d9ecb
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 14 Jul 2022 10:15:35 +0000 (14 12:15 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Thu, 14 Jul 2022 10:18:42 +0000 (14 12:18 +0200)
treea2328234213a4e55c84fe46648ec6aab7f60a56b
parent9f7f04998964451ff487b546d77ea48d0ce01451
Fix ICE on view conversion between struct and integer

This happens from prepare_gimple_addressable for the variable to be marked
with DECL_NOT_GIMPLE_REG_P when its initialization is gimplified, so it's
apparently just a matter of setting the flag earlier.

gcc/
* gimplify.cc (lookup_tmp_var): Add NOT_GIMPLE_REG boolean parameter
and set DECL_NOT_GIMPLE_REG_P on the variable according to it.
(internal_get_tmp_var): Add NOT_GIMPLE_REG boolean parameter and
pass it in the call to lookup_tmp_var.
(get_formal_tmp_var): Pass false in the call to lookup_tmp_var.
(get_initialized_tmp_var): Likewise.
(prepare_gimple_addressable): Call internal_get_tmp_var instead of
get_initialized_tmp_var with NOT_GIMPLE_REG set to true.

gcc/testsuite/
* gnat.dg/opt98.ads, gnat.dg/opt98.adb: New test.
gcc/gimplify.cc
gcc/testsuite/gnat.dg/opt98.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/opt98.ads [new file with mode: 0644]