Hi Jerry!
On 5/27/25 21:36, Jerry D wrote:
On 5/27/25 11:24 AM, Harald Anlauf wrote:
Dear all,
the attached patch fixes a variety of small issues with parsing of
inquiry references of substrings. The testcase exercises variations
of the examples in the PR and ensures that these are successfully
simplified.
Don't try it with other compilers... ;-)
Regtested on x86_64-pc-linux-gnu. OK for mainline?
I believe this is sufficiently safe that it can be backported
later to 15-branch, unless someone objects.
Thanks,
Harald
My only question is why the gcc_assert here:
+ if (sym->ts.type == BT_CHARACTER && tail->type == REF_SUBSTRING)
+ {
+ gcc_assert (sym->attr.dimension);
+ /* Find array reference for substrings of character arrays. */
+ for (ref = primary->ref; ref && ref->next; ref = ref->next)
+ if (ref->type == REF_ARRAY && ref->next->type == REF_SUBSTRING)
+ {
+ strarr = ref;
+ break;
+ }
+ }
+ else
+ tail->type = REF_ARRAY;
I put the gcc_assert here because the enclosing if() (primary.cc:2298)
is not easy to understand and there might be situations to which the
new logic is not prepared. (Possibly some ASSOCIATE-stuff, where types
are inferred, and which I didn't dare to exercise.)
So if it breaks there, I would rather want to see it and find out why.
(The testsuite did not hit it). But it might be superfluous.
Otherwise, OK
Jerry
Pushed as r16-914-g787a8dec1acedf.
Thanks for the review!
Harald