https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90608
--- Comment #15 from Tamar Christina <tnfchris at gcc dot gnu.org> --- (In reply to Mikael Morin from comment #14) > Created attachment 56313 [details] > inline minloc with mask > > This patch adds support for {min,max}loc with mask. Awesome, thank you! > It is not 100% testsuite clean as there are (runtime) error messages that > regress slightly for maxloc_bounds_{4,5,6,7}.f90 > > > (In reply to Mikael Morin from comment #11) > > > > > The problem could be with the initialization of loop iteration variables. > > > (...) > > > Unfortunately, this conditional initialization seems to > > > confuse the optimizers a lot. > > > > > On closer look, the conditional initialization doesn't seem to be that > > confusing (at least in the problematic case), as it's removed early (ccp1) > > in the pipeline. The loop iteration variables remain initialized with phis, > > but that's because of the loops. > > Unfortunately, this is true for rank 1 arrays, but not for higher ranks. > Constant values are slowly propagated to the phi arguments as optimization > passes are run, but no simplification of the control flow happens as soon as > multiple loop levels are involved. > > Need to look into the dim argument next. It's very much appreciated! this should help greatly! Sorry I hadn't reply to the previous message. Finishing up some work for stage-1.