Applied as 'obvious' after regtesting on FC28/x86_64. The second part of the patch (in simplify_ref_chain) is due to Jakub, for which many thanks. The first is consequent on the need to deal with more than one inquiry part ref (see the testcase) and yet be able to return true from simplify_ref_chain. The testcase checks this part.
Paul 2018-12-21 Paul Thomas <pa...@gcc.gnu.org> PR fortran/87881 * expr.c (find_inquiry_ref): Loop through the inquiry refs in case there are two of them. (simplify_ref_chain): Return true after a successful call to find_inquiry_ref. 2018-12-21 Paul Thomas <pa...@gcc.gnu.org> PR fortran/87881 * gfortran.dg/inquiry_part_ref_4.f90: New test.