https://gcc.gnu.org/g:175b499a706229543b00d338a75a3e8f32ac0f43

commit r17-4433-g175b499a706229543b00d338a75a3e8f32ac0f43
Author: Xavier Del Campo Romero <[email protected]>
Date:   Thu Sep 17 23:17:02 2026 +0200

    cobol: Fix undefined loc for CALL args
    
    Otherwise, a diagnostic could be printed with undefined line/column
    numbers. Given an example program where 252127536 would be an
    invalid line number, the following diagnostic was issued:
    
    argloc.cbl:252127536: 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: Fix undefined loc for CALL args.

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

diff --git a/gcc/cobol/parse.y b/gcc/cobol/parse.y
index 8e6b0d9a28b3..1e0bbbcb663d 100644
--- a/gcc/cobol/parse.y
+++ b/gcc/cobol/parse.y
@@ -10802,6 +10802,7 @@ end_call:       %empty %prec CALL
 
 call_body:      ffi_name
                 { statement_begin(@1, CALL);
+                  $$.loc = @1;
                   $$.ffi_name = $ffi_name;
                   $$.using_params = NULL;
                   $$.ffi_returning = cbl_refer_t::empty();
@@ -10809,6 +10810,7 @@ call_body:      ffi_name
 
         |       ffi_name USING parameters
                 { statement_begin(@1, CALL);
+                  $$.loc = @1;
                   $$.ffi_name = $ffi_name;
                   $$.using_params = $parameters;
                   $$.ffi_returning = cbl_refer_t::empty();
@@ -10816,12 +10818,14 @@ call_body:      ffi_name
                 }
         |       ffi_name call_returning scalar[ret]
                 { statement_begin(@1, CALL);
+                  $$.loc = @1;
                   $$.ffi_name = $ffi_name;
                   $$.using_params = NULL;
                   $$.ffi_returning = $ret;
                 }
         |       ffi_name USING parameters call_returning scalar[ret]
                 { statement_begin(@1, CALL);
+                  $$.loc = @1;
                   $$.ffi_name = $ffi_name;
                   $$.using_params = $parameters;
                   $$.ffi_returning = $ret;

Reply via email to