https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118233
Bug ID: 118233
Summary: -Werror=stringop-overflow __builtin___memcpy_chk
Product: gcc
Version: 14.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: costamagnagianfranco at yahoo dot it
Target Milestone: ---
Created attachment 59994
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59994&action=edit
testcase
hello, this happens when compiling opensc for amd64 and ppc64el, two
architecture now defaulting to -O3 in Ubuntu plucky development release.
gcc -O2 works.i -c -Werror=stringop-overflow
ok
gcc -O3 works.i -c -Werror=stringop-overflow
In function 'memcpy',
inlined from 'epass2003_select_path' at works.i:10074:4,
inlined from 'epass2003_select_file' at works.i:10123:10:
works.i:872:10: error: '__builtin___memcpy_chk' specified bound between
18446744073709551608 and 18446744073709551613 exceeds maximum object size
9223372036854775807 [-Werror=stringop-overflow=]
872 | return __builtin___memcpy_chk (__dest, __src, __len,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
873 | __builtin_dynamic_object_size (__dest, 0));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
I'm attaching the preprocessed source, can't reduce it.
I can't see if this is a bug in the code, but looks like some optimization
error at a first glance