Skip to content

error compiling with gcc 15.2.0 on mingw #88

@roboticarm2000

Description

@roboticarm2000

I get the following error when trying to compile on mingw with gcc 15.2.0

cc -I. -Wall -O2 -pedantic -Werror -Wshadow -std=c99 -DYY_NO_INPUT -Wformat-truncation=1   -c -o cobra_prim.o cobra_prim.c
cobra_prim.c: In function 'dogrep':
cobra_prim.c:151:67: error: '%s' directive output may be truncated writing up to 2030 bytes into a region of size between 0 and 2030 [-Werror=format-truncation=]
  151 |                 snprintf(cmd, sizeof(cmd), "grep -q -n -e  \"%s\" %s",
      |                                                                   ^~
cobra_prim.c:151:17: note: 'snprintf' output between 19 and 4079 bytes into a destination of size 2048
  151 |                 snprintf(cmd, sizeof(cmd), "grep -q -n -e  \"%s\" %s",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  152 |                         s, f->s);
      |                         ~~~~~~~~
cc1.exe: all warnings being treated as errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions