https://gcc.gnu.org/g:628c2b735f489d75a24a2c280e318951544350f0

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

    cobol: Print arg loc rather than rule loc
    
    Before:
    
    cbl-get-program-info.cbl:17:45: error: ‘BY CONTENT expression’ requires 
‘-dialect ibm’ [-Wcontent-expr]
    17 |           call "CBL_GET_PROGRAM_INFO" using by value fn
      |                                             ^~~~~~~~~~~
    18 |                                 by reference param-block
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~
    19 |                                 by reference buf
      |                                 ~~~~~~~~~~~~~~~~
    20 |                                 by reference 0
      |                                 ~~~~~~~~~~~~~~
    
    Now:
    
    cbl-get-program-info.cbl:20:46: error: ‘BY CONTENT expression’ requires 
‘-dialect ibm’ [-Wcontent-expr]
    20 |                                 by reference 0
      |                                              ^
    
    gcc/cobol/ChangeLog:
    
            * parse_ante.h (by_content_ok): Use temporary symbol location.

Diff:
---
 gcc/cobol/parse_ante.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/cobol/parse_ante.h b/gcc/cobol/parse_ante.h
index b8db55e49184..df48210d6b60 100644
--- a/gcc/cobol/parse_ante.h
+++ b/gcc/cobol/parse_ante.h
@@ -3273,7 +3273,8 @@ by_content_ok( const cbl_loc_t& loc,
     if( arg.by_content() && field->has_attr(intermediate_e) ) {
       auto e = symbol_program( 0, field->name, true ); // seek prototoype
       if( ! e ) {
-        dialect_ok(loc, IbmContentExpr, "BY CONTENT expression");
+        auto argloc = symbol_temporary_location(arg.field());
+        dialect_ok(argloc, IbmContentExpr, "BY CONTENT expression");
       }
     }
     if( arg.crv == by_value_e &&

Reply via email to