From: Richard Biener <richard.guenther@gmail.com>
To: Martin Sebor <msebor@gmail.com>
Cc: Jeff Law <law@redhat.com>, Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] handle sprintf(d, "%s", ...) in gimple-ssa-sprintf.c
Date: Wed, 03 May 2017 10:21:00 -0000 [thread overview]
Message-ID: <CAFiYyc1ODJRKk-WAo6sDdrkYq4zS-FZm9x4nAumanWD==2uFcA@mail.gmail.com> (raw)
In-Reply-To: <960a2d6c-e64e-daab-6852-77b3d382ad39@gmail.com>
On Tue, May 2, 2017 at 4:41 PM, Martin Sebor <msebor@gmail.com> wrote:
>>>> 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?
You can look at the lto_opts section (it's just a string) and see
that we seem to fail to pass through -Wall (or any warning option
I tried). This is because
/* Also drop all options that are handled by the driver as well,
which includes things like -o and -v or -fhelp for example.
We do not need those. The only exception is -foffload option, if we
write it in offload_lto section. Also drop all diagnostic options. */
if ((cl_options[option->opt_index].flags & (CL_DRIVER|CL_WARNING))
&& (!lto_stream_offload_p || option->opt_index != OPT_foffload_))
continue;
which means you have to explicitely enable diagnostics you want at
link time at the moment.
If you want to change that you have to do some changes to lto-wrapper.c
as for example only pass through warning options that are set on all
input files (warning options are not kept per function).
Richard.
>
> Thanks
> Martin
next prev parent reply other threads:[~2017-05-03 10:20 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
2017-05-03 10:21 ` Richard Biener [this message]
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='CAFiYyc1ODJRKk-WAo6sDdrkYq4zS-FZm9x4nAumanWD==2uFcA@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=law@redhat.com \
--cc=msebor@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).