On Thu, Jul 14, 2022 at 10:20 AM Eric Botcazou via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > Hi, > > you can build a view conversion between pretty much anything in Ada including > between types with different sizes, although the compiler warns in this case > and gigi pads the smaller type to end up with the same size. > > The attached testcase triggers an ICE at -O or above for one of them: > > FAIL: gnat.dg/opt98.adb (test for excess errors) > Excess errors: > during GIMPLE pass: esra > +===========================GNAT BUG DETECTED==============================+ > | 13.0.0 20220713 (experimental) [master 6f5cf9470aa] (x86_64-suse-linux) GCC > error:| > | in gimplify_modify_expr, at gimplify.cc:6254 | > | Error detected around > /home/eric/cvs/gcc/gcc/testsuite/gnat.dg/opt98.adb:10:7| > | Compiling /home/eric/cvs/gcc/gcc/testsuite/gnat.dg/opt98.adb | > > if (gimplify_ctxp->into_ssa && is_gimple_reg (*to_p)) > { > /* We should have got an SSA name from the start. */ > gcc_assert (TREE_CODE (*to_p) == SSA_NAME > || ! gimple_in_ssa_p (cfun)); > } > > 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. > > Bootstrapped/regtested on x86-64/Linux, OK for the mainline?
OK. Thanks, Richard. > > 2022-07-14 Eric Botcazou <ebotca...@adacore.com> > > * 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. > > > 2022-07-14 Eric Botcazou <ebotca...@adacore.com> > > * gnat.dg/opt98.ads, gnat.dg/opt98.adb: New test. > > -- > Eric Botcazou