https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105381
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Mikael Morin <mik...@gcc.gnu.org>: https://gcc.gnu.org/g:3e0c9fdfd00b5b5cbff1a0bd6ac012a10fe81348 commit r12-8280-g3e0c9fdfd00b5b5cbff1a0bd6ac012a10fe81348 Author: Mikael Morin <mik...@gcc.gnu.org> Date: Wed Apr 27 11:36:00 2022 +0200 fortran: Avoid infinite self-recursion [PR105381] Dummy array decls are local decls different from the argument decl accessible through GFC_DECL_SAVED_DESCRIPTOR. If the argument decl has a DECL_LANG_SPECIFIC set, it is copied over to the local decl at the time the latter is created, so that the DECL_LANG_SPECIFIC object is shared between local dummy decl and argument decl, and thus the GFC_DECL_SAVED_DESCRIPTOR of the argument decl is the argument decl itself. The r12-8230-g7964ab6c364c410c34efe7ca2eba797d36525349 change introduced the non_negative_strides_array_p predicate which recurses through GFC_DECL_SAVED_DESCRIPTOR to avoid seeing dummy decls as purely local decls. As the GFC_DECL_SAVED_DESCRIPTOR of the argument decl is itself, this can cause infinite recursion. This change adds a check to avoid infinite recursion. PR fortran/102043 PR fortran/105381 gcc/fortran/ChangeLog: * trans-array.cc (non_negative_strides_array_p): Inline variable orig_decl and merge nested if conditions. Add condition to not recurse if the next argument is the same as the current. gcc/testsuite/ChangeLog: * gfortran.dg/character_array_dummy_1.f90: New test.