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

            Bug ID: 119695
           Summary: Incorrect diagnostic format specifiers in COBOL FE
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: cobol
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

For make gcc.pot I see
cobol/cdf-copy.cc:109: warning: Although being used in a format string
position, the msgid is not a valid GCC internal format string. Reason: In the
directive number 1, the character 'z' is not a valid conversion specifier.
cobol/except.cc:53: warning: Although being used in a format string position,
the msgid is not a valid GCC internal format string. Reason: In the directive
number 1, the character '0' is not a valid conversion specifier.
cobol/genapi.cc:7626: warning: Although being used in a format string position,
the msgid is not a valid GCC internal format string. Reason: In the directive
number 3, the character 'z' is not a valid conversion specifier.
cobol/genapi.cc:16419: warning: Although being used in a format string
position, the msgid is not a valid GCC internal format string. Reason: In the
directive number 2, the character '2' is not a valid conversion specifier.
cobol/genapi.cc:16465: warning: Although being used in a format string
position, the msgid is not a valid GCC internal format string. Reason: In the
directive number 1, the character '2' is not a valid conversion specifier.
cobol/genapi.cc:16678: warning: Although being used in a format string
position, the msgid is not a valid GCC internal format string. Reason: In the
directive number 2, the character '2' is not a valid conversion specifier.
cobol/symbols.cc:456: warning: Although being used in a format string position,
the msgid is not a valid GCC internal format string. Reason: In the directive
number 4, the character 'z' is not a valid conversion specifier.

The ones mentioning 'z' are gettext fault, %zd/%zu is supported in
gcc-internal-format.
The remaining are:
    cbl_internal_error("no such exception: 0x%04x", type);
      cbl_internal_error(
          "%s(): %2.2d %s is a table, but it improperly has a capacity of
zero",
           __func__,
           new_var->level,
           new_var->name);
      cbl_internal_error("parser_symbol_add(): %2.2d %s has null ancestor",
            new_var->level,
            new_var->name);
      cbl_internal_error(  "%s(): %2.2d %s<%s> improperly has a data.capacity
of zero",
              __func__,
              new_var->level,
              new_var->name,
              cbl_field_type_str(new_var->type));
These are COBOL FE bugs, gcc-internal-format doesn't support %04x nor %2.2d, it
will crash on it (fail assertion).  The only valid case of a number after % is
in %5$ style form, and .number can be only specified for s, not others.  So,
either just use 0x%x and %d, or perhaps char ach[5]; snprintf(ach, sizeof(ach),
"%04x", type); and use %s in cbl_internal_error.

Reply via email to