https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126498
Bug ID: 126498
Summary: cobol1: bad reserved word LOG (intrinsic function
names?)
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: cobol
Assignee: unassigned at gcc dot gnu.org
Reporter: simonsobisch at gnu dot org
Target Milestone: ---
some.cob:39:40: error: syntax error, unexpected LOG, expecting NAME
39 | SELECT OPTIONAL LOG
| ^~~ ^~~
... which is a bison parser error.
But LOG is not a reserved word per standard, so that should not happen.
I _guess_ that is related to FUNCTION LOG which also can be written as LOG
*iff* ALL INTRINSIC (or the specific intrinsic) is coded in the REPOSITORY
paragraph.
What GnuCOBOL does (=why it works there):
* have a FUNCTION_LOG token defined
* the scanner checks FUNCTION - the next token is FUNC_NAME if it is not part
of the intrinsic list (which can, per standard, be adjusted!), otherwise WORD
(which seems to be the equivalent of NAME)
* if a WORD is seen, the scanner checks if it is in the REPOSITORY initrinisic
list, if yes, it returns FUNCTION_LOG, otherwise it returns WORD
I think cobol1 needs to do something similar