From: Jakub Jelinek <jakub@redhat.com>
To: Martin Sebor <msebor@gmail.com>
Cc: Richard Biener <rguenther@suse.de>, Jeff Law <law@redhat.com>,
gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix pdftex miscompilation due to get_range_strlen (PR tree-optimization/84478)
Date: Tue, 20 Feb 2018 20:49:00 -0000 [thread overview]
Message-ID: <20180220204948.GJ5867@tucnak> (raw)
In-Reply-To: <d959a1e4-5dfd-c9ce-8e3d-e77f3195faec@gmail.com>
On Tue, Feb 20, 2018 at 12:03:26PM -0700, Martin Sebor wrote:
> PR tree-optimization/84478 - [8 Regression] pdftex miscompilation on i386
>
> gcc/ChangeLog:
>
> PR tree-optimization/84478
> * gimple-fold.c (get_range_strlen): Set *MINLEN to zero.
> (get_range_strlen): Reset range on failure.
>
> gcc/testsuite/ChangeLog:
>
> PR tree-optimization/84478
> * gcc.c-torture/execute/pr84478.c: New test.
>
> Index: gcc/gimple-fold.c
> ===================================================================
> --- gcc/gimple-fold.c (revision 257796)
> +++ gcc/gimple-fold.c (working copy)
> @@ -1369,7 +1369,10 @@ get_range_strlen (tree arg, tree length[2], bitmap
> tree eltype = TREE_TYPE (type);
> if (TREE_CODE (type) != ARRAY_TYPE
> || !INTEGRAL_TYPE_P (eltype))
> - return false;
> + {
> + *minlen = ssize_int (0);
> + return false;
> + }
This is just one of the 13 spots where we return false, so this doesn't look
safe or sufficient to me, even when you actually honor the return value in
2 argument get_range_strlen. You'd really need to do
{
if (fuzzy)
- *maxlen = build_all_ones_cst (size_type_node);
+ {
+ *minlen = size_int (0);
+ *maxlen = build_all_ones_cst (size_type_node);
+ }
else
return false;
}
or just drop that if (fuzzy) stuff from there, but that breaks the warning
tests. It would help if you explained why you think it is a good idea
ignoring the other phi arguments if you have one (or more) where you can
determine length.
One variation of my patch could be instead of adding type 3 change
fuzzy from bool to int, and use fuzzy == 1 for the strlen value ranges and
fuzzy == 2 for the warning code (i.e. 2 operand get_range_strlen).
Note, my patch passed regtest on both x86_64-linux and i686-linux.
Jakub
next prev parent reply other threads:[~2018-02-20 20:49 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 17:49 Jakub Jelinek
2018-02-20 19:03 ` Martin Sebor
2018-02-20 20:13 ` Martin Sebor
2018-02-21 0:49 ` [PATCH] Fix pdftex miscompilation due to get_range_strlen (PR tree-optimization/84478, take 2 and 3) Jakub Jelinek
2018-02-20 22:49 ` Martin Sebor
2018-02-21 3:56 ` Jeff Law
2018-02-21 14:49 ` Jakub Jelinek
2018-02-21 3:56 ` Jeff Law
2018-02-21 3:36 ` [PATCH] Fix pdftex miscompilation due to get_range_strlen (PR tree-optimization/84478) Jeff Law
2018-02-20 20:49 ` Jakub Jelinek [this message]
2018-02-20 23:59 ` Martin Sebor
2018-02-21 3:25 ` Jeff Law
2018-02-21 15:49 ` Martin Sebor
2018-02-22 7:39 ` Richard Biener
2018-02-21 7:49 ` Jakub Jelinek
2018-02-21 1:00 ` Martin Sebor
2018-02-21 3:31 ` Jeff Law
2018-02-21 8:49 ` Jakub Jelinek
2018-02-21 3:42 ` 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=20180220204948.GJ5867@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=law@redhat.com \
--cc=msebor@gmail.com \
--cc=rguenther@suse.de \
/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).