[Bug middle-end/87363] New: Duplicate and bogus -Wstringop-overflow warning
bernd.edlinger at hotmail dot de
gcc-bugzilla@gcc.gnu.org
Wed Sep 19 11:39:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87363
Bug ID: 87363
Summary: Duplicate and bogus -Wstringop-overflow warning
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: bernd.edlinger at hotmail dot de
Target Milestone: ---
as pointed out here: https://gcc.gnu.org/ml/gcc-patches/2018-09/msg00975.html
the following test program emits a duplicate warning, which is bogus, as
u.z is used, and not u.x:
$ cat gcc/testsuite/gcc.c-torture/execute/pr87053.c
/* PR middle-end/87053 */
const union
{ struct {
char x[4];
char y[4];
};
struct {
char z[8];
};
} u = {{"1234", "567"}};
int main ()
{
if (__builtin_strlen (u.z) != 7)
__builtin_abort ();
}
$ gcc gcc/testsuite/gcc.c-torture/execute/pr87053.c
gcc/testsuite/gcc.c-torture/execute/pr87053.c: In function ‘main’:
gcc/testsuite/gcc.c-torture/execute/pr87053.c:15:26: warning: ‘strlen’ argument
missing terminating nul [-Wstringop-overflow=]
15 | if (__builtin_strlen (u.z) != 7)
| ~^~
gcc/testsuite/gcc.c-torture/execute/pr87053.c:11:3: note: referenced argument
declared here
11 | } u = {{"1234", "567"}};
| ^
gcc/testsuite/gcc.c-torture/execute/pr87053.c:15:26: warning: ‘strlen’ argument
missing terminating nul [-Wstringop-overflow=]
15 | if (__builtin_strlen (u.z) != 7)
| ~^~
gcc/testsuite/gcc.c-torture/execute/pr87053.c:11:3: note: referenced argument
declared here
11 | } u = {{"1234", "567"}};
| ^
More information about the Gcc-bugs
mailing list