public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/52399] New: With `-flto', `-Wno-clobbered' does not suppress the "might be clobbered" warning
@ 2012-02-27 10:12 d.g.gorbachev at gmail dot com
  2012-02-27 11:19 ` [Bug lto/52399] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: d.g.gorbachev at gmail dot com @ 2012-02-27 10:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52399

             Bug #: 52399
           Summary: With `-flto', `-Wno-clobbered' does not suppress the
                    "might be clobbered" warning
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: d.g.gorbachev@gmail.com


Created attachment 26761
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26761
Invalid code

$ gcc -flto -O -Wall -Wno-clobbered pr52399.c
In file included from pr52399.c:3:0,
                 from :6:
pr52399.c: In function 'main':
pr52399.c:8:7: warning: variable 'i' might be clobbered by 'longjmp' or 'vfork'
[-Wclobbered]


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug lto/52399] With `-flto', `-Wno-clobbered' does not suppress the "might be clobbered" warning
  2012-02-27 10:12 [Bug lto/52399] New: With `-flto', `-Wno-clobbered' does not suppress the "might be clobbered" warning d.g.gorbachev at gmail dot com
@ 2012-02-27 11:19 ` rguenth at gcc dot gnu.org
  2012-02-27 14:09 ` manu at gcc dot gnu.org
  2021-08-25 23:36 ` [Bug middle-end/52399] -Wclobbered should be a common option rather than a C family specific option pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-27 11:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52399

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-02-27
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-27 11:16:47 UTC ---
Confirmed.  This is because Wclobbered is a C family option but the warning
is generated by middle-end code.  lto1 would simply ignore -Wno-clobbered.
-Wall is also a C family option and so ignored by lto1 btw. -Wall would need
to be split up in parts for lto option processing.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug lto/52399] With `-flto', `-Wno-clobbered' does not suppress the "might be clobbered" warning
  2012-02-27 10:12 [Bug lto/52399] New: With `-flto', `-Wno-clobbered' does not suppress the "might be clobbered" warning d.g.gorbachev at gmail dot com
  2012-02-27 11:19 ` [Bug lto/52399] " rguenth at gcc dot gnu.org
@ 2012-02-27 14:09 ` manu at gcc dot gnu.org
  2021-08-25 23:36 ` [Bug middle-end/52399] -Wclobbered should be a common option rather than a C family specific option pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2012-02-27 14:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52399

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-02-27 14:03:06 UTC ---
(In reply to comment #1)
> Confirmed.  This is because Wclobbered is a C family option but the warning
> is generated by middle-end code.  lto1 would simply ignore -Wno-clobbered.
> -Wall is also a C family option and so ignored by lto1 btw. -Wall would need
> to be split up in parts for lto option processing.

In this testcase, -Wall is a red-herring, it doesn't affect -Wclobbered.

You get the same warning with:
$ gcc -flto -O pr52399.c

the reason is that -Wclobbered is initialized to -1, but only set to its
default value in c_common_post_options, which I guess lto1 does not call.

I guess the simplest fix is to make it a Common option and move the
initialization to finish_options. I am not sure whether it is possible to make
an option C/C++/LTO only.

In an ideal world, GCC options would have some kind of namespace, so one could
not use an option in the middle-end without specifying that it is handled by
LTO.

Ideally, GCC should also initialize options to their default value, instead of
using the -1 trick to check whether the option was set by the user. I am not
sure there is a mechanism yet to do this. This will have avoided this bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/52399] -Wclobbered should be a common option rather than a C family specific option
  2012-02-27 10:12 [Bug lto/52399] New: With `-flto', `-Wno-clobbered' does not suppress the "might be clobbered" warning d.g.gorbachev at gmail dot com
  2012-02-27 11:19 ` [Bug lto/52399] " rguenth at gcc dot gnu.org
  2012-02-27 14:09 ` manu at gcc dot gnu.org
@ 2021-08-25 23:36 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-25 23:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52399

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|lto                         |middle-end
            Summary|With `-flto',               |-Wclobbered should be a
                   |`-Wno-clobbered' does not   |common option rather than a
                   |suppress the "might be      |C family specific option
                   |clobbered" warning          |

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So the warning does not happen any more with -flto but does -W does not enable
it either.

c-family/c.opt has:
Wclobbered
C ObjC C++ ObjC++ Var(warn_clobbered) Warning EnabledBy(Wextra)
Warn about variables that might be changed by \"longjmp\" or \"vfork\".

Maybe this should move to common.opt like the other middle-end warnings.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-25 23:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-27 10:12 [Bug lto/52399] New: With `-flto', `-Wno-clobbered' does not suppress the "might be clobbered" warning d.g.gorbachev at gmail dot com
2012-02-27 11:19 ` [Bug lto/52399] " rguenth at gcc dot gnu.org
2012-02-27 14:09 ` manu at gcc dot gnu.org
2021-08-25 23:36 ` [Bug middle-end/52399] -Wclobbered should be a common option rather than a C family specific option pinskia 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).