From: Tom de Vries <Tom_deVries@mentor.com>
To: Martin Sebor <msebor@gmail.com>, Jeff Law <law@redhat.com>,
Richard Biener <richard.guenther@gmail.com>
Cc: Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [PING 2][PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)
Date: Mon, 08 Jan 2018 09:56:00 -0000 [thread overview]
Message-ID: <38f3574a-b45c-12d2-c84a-b28b2f10696b@mentor.com> (raw)
In-Reply-To: <6fedb302-439c-78a5-4772-454b31a0a4f8@gmail.com>
On 12/17/2017 01:01 AM, Martin Sebor wrote:
>>> Â Â Â Â * c-c++-common/Wrestrict.c: New test.
> 681 /* The following doesn't overlap but it should trigger -Wstrinop-ovewrflow
> 682 for writing past the end. */
> 683 T ("012", a + sizeof a, a);
For nvptx, the warning actually shows up and is classified as excess error:
...
gcc/testsuite/c-c++-common/Wrestrict.c:683:3: warning:
'__builtin_memcpy' writing 4 bytes into a region of size 0 overflows the
destination [-Wstringop-overflow=]
...
> 760 r = SR (DIFF_MAX - 2, DIFF_MAX - 1);
> 761 T (8, "012", a + r, a); /* { dg-warning "accessing 4 bytes at offsets \\\[\[0-9\]+, \[0-9\]+] and 0 overlaps" "strcpy" } */
> 762
Likewise, the warning triggers here:
...
gcc/testsuite/c-c++-common/Wrestrict.c:761:3: warning:
'__builtin_memcpy' writing 4 bytes into a region of size 0 overflows the
destination [-Wstringop-overflow=]
...
>>> * c-c++-common/Warray-bounds-4.c: New test.
> 66 TM ("0123", "", ma.a5 + i, ma.a5); /* { dg-warning "offset 6 from the object at .ma. is out of the bounds of referenced subobject .a5. with type .char\\\[5]. at offset 0" "strcpy" { xfail *-*-* } } */
> 67 TM ("", "012345", ma.a7 + i, ma.a7); /* { dg-warning "offset 13 from the object at .ma. is out of the bounds of referenced subobject .\(MA::\)?a7. with type .char ?\\\[7]. at offset 5" } */
And this warning fails to trigger:
...
FAIL: c-c++-common/Warray-bounds-4.c -Wc++-compat (test for warnings,
line 67)
...
Thanks,
- Tom
next prev parent reply other threads:[~2018-01-08 9:32 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-16 23:47 [PATCH] " Martin Sebor
2017-07-20 20:46 ` Martin Sebor
2017-07-25 3:13 ` [PING] " Martin Sebor
2017-08-01 2:27 ` [PING #2] " Martin Sebor
2017-08-01 9:23 ` Richard Biener
2017-08-01 9:25 ` Richard Biener
2017-08-02 17:10 ` Jeff Law
2017-08-03 8:46 ` Richard Biener
2017-08-06 23:08 ` Martin Sebor
2017-08-08 13:08 ` Richard Biener
2017-08-09 16:14 ` Jeff Law
2017-08-22 2:04 ` Martin Sebor
2017-08-22 9:17 ` Richard Biener
2017-08-24 22:36 ` Jeff Law
2017-08-29 3:42 ` Martin Sebor
2017-09-01 15:15 ` Jeff Law
2017-08-29 2:35 ` Martin Sebor
2017-08-29 11:32 ` Richard Biener
[not found] ` <40984eff-b156-3315-7bb5-558e9e83bf6c@gmail.com>
2017-10-24 6:40 ` Martin Sebor
2017-11-10 0:28 ` [PING][PATCH] " Martin Sebor
2017-11-16 22:24 ` [PING 2][PATCH] " Martin Sebor
2017-11-23 0:16 ` Jeff Law
2017-11-26 9:12 ` Martin Sebor
2017-11-30 0:56 ` Martin Sebor
2017-12-07 21:14 ` Jeff Law
2017-12-07 21:28 ` Martin Sebor
2017-12-07 21:48 ` Jeff Law
2017-12-07 22:23 ` Jeff Law
2017-12-08 0:44 ` Martin Sebor
2017-12-08 19:19 ` Martin Sebor
2017-12-11 22:27 ` Jeff Law
2017-12-17 0:02 ` Martin Sebor
2017-12-17 13:32 ` H.J. Lu
2018-01-08 9:56 ` Tom de Vries [this message]
2017-12-07 20:16 ` Jeff Law
2017-11-27 12:45 ` Richard Biener
2017-11-30 1:19 ` Martin Sebor
2017-12-07 20:20 ` Jeff Law
2017-08-09 16:09 ` [PING #2] [PATCH] " Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=38f3574a-b45c-12d2-c84a-b28b2f10696b@mentor.com \
--to=tom_devries@mentor.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=law@redhat.com \
--cc=msebor@gmail.com \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).