https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90608
--- Comment #13 from Mikael Morin <mikael at gcc dot gnu.org> --- (In reply to Tamar Christina from comment #12) > (In reply to Mikael Morin from comment #11) > > Created attachment 56094 [details] > > Improved patch > > > > This improved patch (still single argument only) passes the fortran > > regression testsuite. > > > > Awesome! Thanks! it looks like the benchmark always uses dim=1 or the mask > argument. > > Can you give a hint into what I'd need to do to add the additional params? For the mask argument, I hope it would just need gfc_inline_intrinsic_function_p to return true to work. For the dim argument, it's a bit more complicated. You can have a look at how the dim argument support for sum and product was introduced here: https://gcc.gnu.org/pipermail/fortran/2011-October/037574.html To describe in a few words the needed bits: - gfc_walk_inline_intrinsic_function needs to collect the arrays involved in scalarization. In the case where dim is absent, there is just the result of minloc and it can't be decomposed further. If dim is present on the other hand, the arrays are the non-dim arguments, and there is one nested loop reducing those arrays' dimension by one. One important thing to pay attention for, the arrays must be present in the same order they will be consumed by the gfc_conv_intrinsic_minmaxloc later. - All the calls to gfc_walk_expr in gfc_conv_intrinsic_minmaxloc should be disabled in favor enter_nested_loop. - Setting of gfc_se::ss pointers should be disabled, as they should come correct from initialization. - The call to gfc_cleanup_loop should be disabled These 4 points are very similar to the sum/product patch mentioned above. Additionally, one has to disable the changes to support the other cases of {min,max}loc. Possibly it's easier to start with an unpatched master and merge the patches afterwards. Anyway, I should be able to help, maybe by the end of this week, or next week.