https://gcc.gnu.org/g:fdaa1a57862e313b20c7bb7e134cd02683d3f2be

commit r17-4436-gfdaa1a57862e313b20c7bb7e134cd02683d3f2be
Author: Xavier Del Campo Romero <[email protected]>
Date:   Thu Sep 17 23:23:21 2026 +0200

    cobol: Set loc for numeric literals BY VALUE
    
    Otherwise, diagnostics could be printed with invalid or missing location
    data. For example, location data is missing from the following
    diagnostic:
    
    argloc.cbl: error: parameter 2 BY VALUE ‘0’ (NUMERIC LITERAL, capacity 1, 
unsigned) invalid for ‘foo’ parameter BY REFERENCE ‘param-b’ (COMPUTATIONAL-5, 
capacity 4, signed)
    
    gcc/cobol/ChangeLog:
    
            * parse.y: Set loc for numeric literals BY VALUE.

Diff:
---
 gcc/cobol/parse.y | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/cobol/parse.y b/gcc/cobol/parse.y
index 24b870f8dd68..14e11e82c5a7 100644
--- a/gcc/cobol/parse.y
+++ b/gcc/cobol/parse.y
@@ -10953,6 +10953,7 @@ ffi_by_val:     by_value_arg
                 {
                   const char *s = $1.s? $1.s : string_of($1.r);
                   auto r = new_reference(new_literal(@1, s));
+                  r->loc = @1;
                   $$ = new cbl_ffi_arg_t(by_value_e, r);
                 }
         |       ADDRESS OF scalar

Reply via email to