https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88771
Sam James <sjames at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
--- Comment #29 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to qinzhao from comment #28)
> (In reply to qinzhao from comment #27)
>
> > Yes, I agree with Jeff.
> > This looks like a similar issue as PR109071.
>
> the patch that improve the diagnostic for PR109071 could also improve this
> one.
Indeed:
$ gcc a.c -c -O2 -Wall -Wextra -fdiagnostics-show-context=1
a.c: In function ‘d’:
a.c:11:3: warning: ‘__builtin_strncpy’ specified bound 18446744073709551615
exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
11 | __builtin_strncpy(c, x, f);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
‘d’: events 1-2
10 | char a = f + 1 ?: f;
| ^
| |
| (1) when the condition is evaluated to false
11 | __builtin_strncpy(c, x, f);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| (2) warning happens here
a.c:13:10: warning: ‘e’ may be used uninitialized [-Wmaybe-uninitialized]
13 | e->a = 0;
| ~~~~~^~~
a.c:9:5: note: ‘e’ was declared here
9 | b e;
| ^