[Bug sanitizer/91707] New: spurious stringop-overflow warning with -fsanitize=undefined
uecker at eecs dot berkeley.edu
gcc-bugzilla@gcc.gnu.org
Mon Sep 9 08:36:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91707
Bug ID: 91707
Summary: spurious stringop-overflow warning with
-fsanitize=undefined
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: uecker at eecs dot berkeley.edu
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org
Target Milestone: ---
Created attachment 46854
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46854&action=edit
test case
With recent GCC versions from git there is a spurious warning
when the undefined behavior sanitizer is used.
$ ../gcc_build_clean/gcc/xgcc -B ../gcc_build_clean/gcc -Wall -O2
-fsanitize=undefined -c strop.c
In function ‘real_from_complex_dims’,
inlined from ‘md_test’ at strop.c:14:2:
strop.c:7:11: warning: writing 8 bytes into a region of size 0
[-Wstringop-overflow=]
7 | odims[0] = 2;
| ~~~~~~~~~^~~
$ ../gcc_build_clean/gcc/xgcc --version
xgcc (GCC) 10.0.0 20190907 (experimental)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ cat strop.c
extern void md_copy_dims(unsigned int D, long odims[D], const long idims[D]);
extern void md_test(unsigned int D, const long idims[D]);
static void real_from_complex_dims(unsigned int D, long odims[D + 1], const
long idims[D])
{
odims[0] = 2;
md_copy_dims(D, odims + 1, idims);
}
void md_test(unsigned int D, const long idims[D])
{
long dimsR[D + 1];
real_from_complex_dims(D, dimsR, idims);
long strsR[D + 1];
(void)strsR;
return;
}
More information about the Gcc-bugs
mailing list