https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119933

James K. Lowden <jklowden at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|rdubner at gcc dot gnu.org         |jklowden at gcc dot 
gnu.org

--- Comment #6 from James K. Lowden <jklowden at gcc dot gnu.org> ---
Thank you for the report.  The following changes seem correct and our tests
continue to pass.  Can you apply and try on loongarch64 ?

```
diff --git a/gcc/cobol/parse.y b/gcc/cobol/parse.y
index 04a6c966c7a..631a25bfd8b 100644
--- a/gcc/cobol/parse.y
+++ b/gcc/cobol/parse.y
@@ -12892,8 +12892,6 @@ current_tokens_t::tokenset_t::find( const cbl_name_t
name, bool include_intrinsi
   if( p == tokens.end() ) return 0;
   int token = p->second;

-  if( token == SECTION ) yylval.number = 0;
-
   if( include_intrinsics && intrinsic_cname(token) ) return token;
   if( iso_cobol_word(uppercase(name), true) ) return token;

diff --git a/gcc/cobol/scan.l b/gcc/cobol/scan.l
index 53475484801..e6edb82acf1 100644
--- a/gcc/cobol/scan.l
+++ b/gcc/cobol/scan.l
@@ -617,7 +617,7 @@ SECTION{SPC}[+-]?{INTEGERZ}/{OSPC}{DOTSEP}  {
                                }

 SECTION{OSPC}{DOTSEP}/USE[[:space:]]   { yylval.string = NULL; return SECTION;
}
-SECTION                                        { yylval.string = NULL; return
SECTION; }
+SECTION/{OSPC}{DOTSEP}                 { yylval.string = NULL; return SECTION;
}

 PARAGRAPH      { return PARAGRAPH; }
 SEARCH         { return SEARCH; }
```

I will have a word with the so-called programmer (me) who modifies a global
variable without comment in a "find" function.  It apparently was a workaround
for the scanner not matching the SECTION token, falling through to the
generalized NAME match, and then backpedalling.

Reply via email to