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

commit r17-4434-gaa4345370bf4fb1077b1559c0f8a17e6b90b2b41
Author: Xavier Del Campo Romero <[email protected]>
Date:   Thu Sep 17 23:18:55 2026 +0200

    cobol: Set loc also for numeric literals BY REFERENCE
    
    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 REFERENCE ‘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 also for numeric literals BY REFERENCE.

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

diff --git a/gcc/cobol/parse.y b/gcc/cobol/parse.y
index 1e0bbbcb663d..0552f77f6193 100644
--- a/gcc/cobol/parse.y
+++ b/gcc/cobol/parse.y
@@ -10914,6 +10914,7 @@ ffi_by_ref:     scalar_arg[refer]
                               "cannot pass %qs BY REFERENCE",
                               $1->data.original());
                   cbl_refer_t *r = new_reference($1);
+                  r->loc = @1;
                   $$ = new cbl_ffi_arg_t(by_content_e, r);
                 }
         |       ADDRESS OF scalar_arg[refer]

Reply via email to