On Tue, Dec 3, 2019 at 6:41 PM Tobias Burnus <tob...@codesourcery.com> wrote: > > The problem here is that one gets two symbols - one inside the block and > one outside and they do not really agree whether one has a function or a > variable – which later gives an ICE. As sym->module was "(intrinsic)" > and FL_VARIABLE, one was running into an assert. > > The problem is that when resolving the expression with "max", gfortran > detects that it got an intrinsic function and resolves the > expression/function call (in this case to a constant). However, the > information that "max" was regarded as intrinsic procedure never ends up > in the symbol itself, only in the expression. > > My first idea was to call gfc_resolve_intrinsic, which does a lot of > nice things like setting the attributes, warning that the type is > ignored with intrinsic procedures (-Wsurprsing, only) etc. However, that > gives a bunch of ICE. Even a more Spartan attr setting had similar > issues – hence, I moved it below the simplification, in the hope it > would work there. Well, gfc_resolve_intrinsic still gave tons of errors > and ICEs, but what I now have works. (I think it also works w/o the > FL_UNKNOWN condition, but, in any case, I am not sure which variant is > better) > > The settings I use with this patch seem to work and I have the hope that > it covers all valid/invalid code correctly (fingers crossed). > > Build and regtested on x86-64-gnu-linux. > OK for the trunk?
Yeah, this seems a bit convoluted. But at least we now have yet another testcase to catch similar issues. So, Ok. -- Janne Blomqvist