[Bug c/83989] New: -Wrestrict false positive with malloc-style functions
sirl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jan 23 09:50:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83989
Bug ID: 83989
Summary: -Wrestrict false positive with malloc-style functions
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: sirl at gcc dot gnu.org
Target Milestone: ---
Created attachment 43216
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43216&action=edit
testcase
Compiling the attached file with r256939 of trunk issues 2 warnings. I believe
they are false positives and should have been suppressed by
__attribute__((__malloc__)).
gcc-7.2.1 didn't issue a warning here.
# gcc-trunk -c -Wall -Wrestrict -O2 Wrestrict-false-positive.c
Wrestrict-false-positive.c: In function 'load1':
Wrestrict-false-positive.c:44:4: warning: 'memcpy' accessing between 384 and
25769803764 bytes at offsets 0 and 0 overlaps between 384 and 25769803764 bytes
at offset 0 [-Wrestrict]
memcpy(recmem, oldrecmem, oldsize * sizeof(record_t));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Wrestrict-false-positive.c: In function 'load2':
Wrestrict-false-positive.c:75:4: warning: 'memcpy' accessing between 384 and
25769803764 bytes at offsets 0 and 0 overlaps between 384 and 25769803764 bytes
at offset 0 [-Wrestrict]
memcpy(recmem, oldrecmem, oldsize * sizeof(record_t));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the Gcc-bugs
mailing list