https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105069
--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #6) > While changing mdiv= from accepting a string to Enum(something) might be > worth it, wouldn't that be GCC 13 material? I think right now -mdiv= > accepts random garbage like -mdiv=foobar . There is also an enum already > but there is no 1:1 > mapping between what is assigned to sh_div_strategy from what is in > sh_div_str, > and sh_div_strategy probably should be a TargetVariable. > > Anyway, wouldn't the following be enough for now to just do: > > 2022-03-31 Jakub Jelinek <ja...@redhat.com> > > PR target/105069 > * config/sh/sh.opt (mdiv=): Add Save. > > --- gcc/config/sh/sh.opt.jj 2022-01-11 23:11:21.990295775 +0100 > +++ gcc/config/sh/sh.opt 2022-03-31 09:43:45.916244944 +0200 > @@ -207,7 +207,7 @@ Target RejectNegative Mask(ALIGN_DOUBLE) > Align doubles at 64-bit boundaries. > > mdiv= > -Target RejectNegative Joined Var(sh_div_str) Init("") > +Target Save RejectNegative Joined Var(sh_div_str) Init("") > Division strategy, one of: call-div1, call-fp, call-table. > > mdivsi3_libfunc= > > The testcase doesn't ICE with it anymore, and e.g. i386.opt has various Save > strings too. Yes, that's going to work as with the patch the target value is properly saved and restored in cl_target_option_{save,restore}.