public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Richard Biener <richard.guenther@gmail.com>, Jeff Law <law@redhat.com>
Cc: Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] handle sprintf(d, "%s", ...) in gimple-ssa-sprintf.c
Date: Tue, 02 May 2017 14:44:00 -0000	[thread overview]
Message-ID: <960a2d6c-e64e-daab-6852-77b3d382ad39@gmail.com> (raw)
In-Reply-To: <CAFiYyc37fsOQ4t=OXnn9R-UCaiaEEbR4HGoOT1E3YqR8KO6NFg@mail.gmail.com>

>>> FWIW, my fix for bug 79062 is only partial (it gets the pass
>>> to run but the warnings are still not issued).  I don't quite
>>> understand what prevents the warning flag(s) from getting set
>>> when -flto is used.  This seems to be a bigger problem than
>>> just the sprintf pass not doing something just right.
>>
>> I've never dug deeply in the LTO stuff, but I believe we stream the compiler
>> flags, so it could be something there.
>
> We do.
>
>> Alternately you might be running into a case where in LTO mode we recreate
>> base types.  Look for a type equality tester that goes beyond just testing
>> pointer equality.
>>
>> ie, in LTO I think we'll create a type based on the streamed data, but I
>> also think we'll create various basic types.  Thus in LTO mode pointer
>> equality may not be sufficient.
>
> We make sure that for most basic types we end up re-using them where possible.
> char_type_node is an example where that generally doesn't work because it's
> value depends on a command-line flag.

That answers the first part of the question of why the sprintf
pass wouldn't run (or do anything) with -flto.   With it fixed
(as in fold-const.c or tree-ssa-strlen.c as you suggested in
bug 79602) it runs and the optimization does its job, but no
warnings are issued.  The wan_foo_flags for warnings that are
enabled implicitly (e.g., by -Wall or -Wextra on the command
line) are clear.  There seem to be dependencies between warnings
in c.opt that ignore LTO (as a language), but even with those
corrected (i.e., with LTO added as a language to -Wformat and
-Wall) the flags are still clear when LTO runs.  Does that ring
any bells for you?

Thanks
Martin

  reply	other threads:[~2017-05-02 14:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-22  0:51 Martin Sebor
2017-04-25 22:27 ` Jeff Law
2017-04-26  7:59   ` Martin Sebor
2017-04-28  6:07     ` Martin Sebor
2017-04-28 17:06       ` Jeff Law
2017-04-28 16:48     ` Jeff Law
2017-05-02 10:27       ` Richard Biener
2017-05-02 14:44         ` Martin Sebor [this message]
2017-05-03 10:21           ` Richard Biener
2017-05-03 14:48             ` Martin Sebor
2017-05-12 18:44               ` 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=960a2d6c-e64e-daab-6852-77b3d382ad39@gmail.com \
    --to=msebor@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.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).