Skip to content

GCC 15 error: initializer-string for array of ‘char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (4 chars into 3 available) #10

@mkleczek

Description

@mkleczek

Does not build against GCC 15:

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -Wmissing-variable-declarations -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -std=c11 -Wextra -Wall -Werror -Wno-declaration-after-statement -Wno-vla -Wno-long-long -fPIC -fvisibility=hidden  -DEXTVERSION=\"1.0\" -I. -I./ -I/usr/pgsql-18/include/server -I/usr/pgsql-18/include/internal -D_GNU_SOURCE  -I/usr/include -I/usr/include/libxml2 -DWITH_GZFILEOP     -c -o src/aggs.o src/aggs.c
src/aggs.c:10:22: error: initializer-string for array of ‘char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (4 chars into 3 available) [-Werror=unterminated-string-initialization]
   10 | const char BOM[3]  = "\xEF\xBB\xBF";
      |                      ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [<builtin>: src/aggs.o] Error 1

Originally posted by @devrimgunduz in #9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions