public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/89428] missing -Wstringop-overflow on a PHI with variable offset
[not found] <bug-89428-4@http.gcc.gnu.org/bugzilla/>
@ 2020-04-22 21:55 ` msebor at gcc dot gnu.org
2020-04-26 8:01 ` xerofoify at gmail dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-04-22 21:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89428
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.0, 9.2.0
Last reconfirmed| |2020-04-22
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
No progress in GCC 10.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/89428] missing -Wstringop-overflow on a PHI with variable offset
[not found] <bug-89428-4@http.gcc.gnu.org/bugzilla/>
2020-04-22 21:55 ` [Bug middle-end/89428] missing -Wstringop-overflow on a PHI with variable offset msebor at gcc dot gnu.org
@ 2020-04-26 8:01 ` xerofoify at gmail dot com
2020-10-29 19:27 ` msebor at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: xerofoify at gmail dot com @ 2020-04-26 8:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89428
Nicholas Krause <xerofoify at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |xerofoify at gmail dot com
--- Comment #2 from Nicholas Krause <xerofoify at gmail dot com> ---
Changing i equal to 1 in the second function gives the warning and gets similar
GIMPLE like this to the first function:
<bb 2> [local count: 1073741824]:
i_3 = MAX_EXPR <i_2(D), 1>;
_1 = &a + i_3;
__builtin_memset (_1, 0, 99); [tail call]
return;
Are we assuming somewhere that zero size offsets should for the first argument
of __builtin_memset to be forgotten about? Because I tried it with multiple
numbers other than zero and they all worked to get GIMPLE similar to the above.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/89428] missing -Wstringop-overflow on a PHI with variable offset
[not found] <bug-89428-4@http.gcc.gnu.org/bugzilla/>
2020-04-22 21:55 ` [Bug middle-end/89428] missing -Wstringop-overflow on a PHI with variable offset msebor at gcc dot gnu.org
2020-04-26 8:01 ` xerofoify at gmail dot com
@ 2020-10-29 19:27 ` msebor at gcc dot gnu.org
2020-11-03 15:32 ` msebor at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-10-29 19:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89428
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=92936
--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
See also pr92936.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/89428] missing -Wstringop-overflow on a PHI with variable offset
[not found] <bug-89428-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2020-10-29 19:27 ` msebor at gcc dot gnu.org
@ 2020-11-03 15:32 ` msebor at gcc dot gnu.org
2020-11-29 22:13 ` cvs-commit at gcc dot gnu.org
2020-11-29 22:38 ` msebor at gcc dot gnu.org
5 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-11-03 15:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89428
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed in the following patch for pr92936:
https://gcc.gnu.org/pipermail/gcc-patches/2020-November/557807.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/89428] missing -Wstringop-overflow on a PHI with variable offset
[not found] <bug-89428-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2020-11-03 15:32 ` msebor at gcc dot gnu.org
@ 2020-11-29 22:13 ` cvs-commit at gcc dot gnu.org
2020-11-29 22:38 ` msebor at gcc dot gnu.org
5 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-29 22:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89428
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:
https://gcc.gnu.org/g:eafe8ee7af13c39805ea09bbf5b4f9ab2a48304a
commit r11-5523-geafe8ee7af13c39805ea09bbf5b4f9ab2a48304a
Author: Martin Sebor <msebor@redhat.com>
Date: Sun Nov 29 15:09:30 2020 -0700
Handle PHIs in compute_objsize.
PR middle-end/92936 - missing warning on a past-the-end store to a PHI
PR middle-end/92940 - incorrect offset and size in -Wstringop-overflow for
out-of-bounds store into VLA and two offset ranges
PR middle-end/89428 - missing -Wstringop-overflow on a PHI with variable
offset
gcc/ChangeLog:
PR middle-end/92936
PR middle-end/92940
PR middle-end/89428
* builtins.c (access_ref::access_ref): Initialize member.
(access_ref::phi): New function.
(access_ref::get_ref): New function.
(access_ref::add_offset): Remove duplicate assignment.
(maybe_warn_for_bound): Add "maybe" kind of warning messages.
(warn_for_access): Same.
(inform_access): Rename...
(access_ref::inform_access): ...to this. Print PHI arguments.
Format
offset the same as size and simplify. Improve printing of
allocation
functions and VLAs.
(check_access): Adjust to the above.
(gimple_parm_array_size): Change argument.
(handle_min_max_size): New function.
* builtins.h (class ssa_name_limit_t): Move class here from
tree-ssa-strlen.c.
(struct access_ref): Declare new members.
(gimple_parm_array_size): Change argument.
* tree-ssa-strlen.c (maybe_warn_overflow): Use access_ref and
simplify.
(handle_builtin_memcpy): Correct argument passed to
maybe_warn_overflow.
(handle_builtin_memset): Same.
(class ssa_name_limit_t): Move class to builtins.{h,c}.
gcc/testsuite/ChangeLog:
PR middle-end/92936
PR middle-end/92940
PR middle-end/89428
* c-c++-common/Wstringop-overflow-2.c: Adjust text of expected
informational notes.
* g++.dg/warn/Wstringop-overflow-3.C: Same.
* g++.dg/warn/Wplacement-new-size.C: Remove a test for a no longer
issued warning.
* gcc.dg/Warray-bounds-43.c: Removed unused declarations.
* gcc.dg/Wstringop-overflow-11.c: Remove xfails.
* gcc.dg/Wstringop-overflow-12.c: Same.
* gcc.dg/Wstringop-overflow-17.c: Adjust text of expected messages.
* gcc.dg/Wstringop-overflow-27.c: Same. Remove xfails.
* gcc.dg/Wstringop-overflow-28.c: Adjust text of expected messages.
* gcc.dg/Wstringop-overflow-29.c: Same.
* gcc.dg/Wstringop-overflow-37.c: Same.
* gcc.dg/Wstringop-overflow-46.c: Same.
* gcc.dg/Wstringop-overflow-47.c: Same.
* gcc.dg/Wstringop-overflow-54.c: Same.
* gcc.dg/warn-strnlen-no-nul.c: Add expected warning.
* gcc.dg/Wstringop-overflow-7.c: New test.
* gcc.dg/Wstringop-overflow-58.c: New test.
* gcc.dg/Wstringop-overflow-59.c: New test.
* gcc.dg/Wstringop-overflow-60.c: New test.
* gcc.dg/Wstringop-overflow-61.c: New test.
* gcc.dg/Wstringop-overflow-62.c: New test.
* gcc.dg/Wstringop-overflow-63.c: New test.
* gcc.dg/Wstringop-overflow-64.c: New test.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/89428] missing -Wstringop-overflow on a PHI with variable offset
[not found] <bug-89428-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2020-11-29 22:13 ` cvs-commit at gcc dot gnu.org
@ 2020-11-29 22:38 ` msebor at gcc dot gnu.org
5 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-11-29 22:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89428
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |11.0
--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
Resolved by r11-5523 for GCC 11 which now issues the following warnings for
the test case in comment #0 (the duplicate note needs to be fixed):
$ gcc -O2 -S pr89428.c
pr89428.c: In function ‘f’:
pr89428.c:7:3: warning: ‘__builtin_memset’ writing 7 bytes into a region of
size 6 overflows the destination [-Wstringop-overflow=]
7 | __builtin_memset (a + i, 0, 7); // warning (good)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pr89428.c:1:6: note: at offset [1, 2] into destination object ‘a’ of size 7
1 | char a[7];
| ^
pr89428.c: In function ‘g’:
pr89428.c:14:3: warning: ‘__builtin_memset’ writing 99 bytes into a region of
size 7 overflows the destination [-Wstringop-overflow=]
14 | __builtin_memset (a + i, 0, 99); // missing warning (bug)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pr89428.c:1:6: note: destination object ‘a’ of size 7
1 | char a[7];
| ^
pr89428.c:1:6: note: destination object ‘a’ of size 7
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-11-29 22:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-89428-4@http.gcc.gnu.org/bugzilla/>
2020-04-22 21:55 ` [Bug middle-end/89428] missing -Wstringop-overflow on a PHI with variable offset msebor at gcc dot gnu.org
2020-04-26 8:01 ` xerofoify at gmail dot com
2020-10-29 19:27 ` msebor at gcc dot gnu.org
2020-11-03 15:32 ` msebor at gcc dot gnu.org
2020-11-29 22:13 ` cvs-commit at gcc dot gnu.org
2020-11-29 22:38 ` msebor at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).