Hi Steve, Thanks for persevering with this. The patch looks good to me. If it has regtested OK, please feel free to commit.
Cheers Paul On 22 October 2016 at 02:22, Steve Kargl <s...@troutmask.apl.washington.edu> wrote: > All, > > The attached patch fixes PR fortran/78033. This was a REAL pain > to fix because Fortran overloads REAL as an intrinsic type and > an intrinsic subprogram. > > gfc_match_type_spec() in match.c is used to match Fortran 2003 > type-specs in things like array constructors and TYPE IS statements. > At some point in time, PR fortran/54730 was submitted because an ICE > occurred for > > subroutine s > implicit none > intrinsic :: real > real :: vec(1:2) > vec = (/ real(a = 1), 1. /) > end subroutine s > > where a symbol for 'a' was create while parsing for a validate > typespec. The invalid 'a' was causing an ICE during translation. > Mikael fixed the ICE by introducing checkpointing of the symbols in > gfc_match_array_constructor() in array.c, which allowed 'a' to be > removed. > > Fast-forward to PR fortran/78033, submitted a few days ago. > Code like > > subroutine f(n, x) > integer, intent(in) :: n > complex, intent(in) :: x(1:n) > real :: y(2*n) > y = [real(x(1:n), aimag(x(1:n))] > end subroutine f > > was now ICE'ing due what appears to be a tangling checkpoint. > > f951: internal compiler error: in enforce_single_undo_checkpoint, > at fortran/symbol.c:3514 > > If I disabled, Mikael's fix for PR fortran/54730 then PR fortran/78033 > would compile with the expected regression with PR fortran/54730. Having > spent to much time looking for a mismatch in checkpoints, I decided to > remove Mikael's fix in gfc_match_array_constructor() and fix the issue > in gfc_match_type_spec() where I special case the parsing of > REAL([KIND]=scalar-int-initialization-expr). > > An early version of the patch passed regression except for gomp/udr3.f90. > Note that gfortran never vists gfc_match_type_spec while compling udr3.f90. > I've deleted obj/ and started a clean bootstrap to see if this failure > was collateral damage for my tinkering. If regression testing is > successfull, OK to commit? > > 2016-10-21 Steven G. Kargl <ka...@gcc.gnu.org> > > PR fortran/78033 > * array.c (gfc_match_array_constructor): Remove checkpointing > introduced in r196416. Move initialization to top of function. > * match.c (gfc_match_type_spec): Special case matching for REAL. > > 2016-10-21 Steven G. Kargl <ka...@gcc.gnu.org> > > PR fortran/78033 > * gfortran.dg/pr78033.f90: New test. > > -- > Steve -- The difference between genius and stupidity is; genius has its limits. Albert Einstein