https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126393
--- Comment #4 from Simon Sobisch <simonsobisch at gnu dot org> ---
and indeed, changing that to the standard
01 Z01-SHMKEY.
05 Z01-SHMKEY-ENV PIC X(06).
01 Z01-SHMKEY-RED REDEFINES Z01-SHMKEY.
03 filler OCCURS 6 INDEXED BY Z01-IND.
05 Z01-BYTE PIC 99 COMP.
does compile
My suggestion would be to:
* ensure the diagnostic points to the data item (it _seems_ to point to end of
storage definition)
* mid-term: support that nonstandard option
* short-term: raise an error message on 01 OCCURS (or, if this is supposed to
commonly work: on OCCURS with REDEFINES on the same data item)