public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95190] New: Documentation for -Wstringop-overflow
@ 2020-05-18 14:01 stayprivate at gmail dot com
  2020-05-18 17:05 ` [Bug lto/95190] " msebor at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: stayprivate at gmail dot com @ 2020-05-18 14:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95190
           Summary: Documentation for -Wstringop-overflow
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stayprivate at gmail dot com
  Target Milestone: ---

I'm compiling code with 10.1 for the first time. I'm getting a warning:

"writing 1 bytes into a region of size 0 -Wstringop-overflow=". Yet
-Wno-stringop-overflow is passed to the compiler.  I tried disabling the
warning with #pragma diagnostic, no luck there.

Then I realized the error came from the link stage. Surely related to lto. I
modified my cmake files to add the -Wno-stringop-overflow to the link command
line and the warning disappear.

I'm surprise by this behavior. I looked through the documentation and could not
find anything that mentionned this. Is this something that is worth improving
in  the documentation or do I just need to get smarter ;-)

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

* [Bug lto/95190] Documentation for -Wstringop-overflow
  2020-05-18 14:01 [Bug c++/95190] New: Documentation for -Wstringop-overflow stayprivate at gmail dot com
@ 2020-05-18 17:05 ` msebor at gcc dot gnu.org
  2020-05-19  6:32 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-05-18 17:05 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-05-18
             Status|UNCONFIRMED                 |WAITING
          Component|c++                         |lto
     Ever confirmed|0                           |1
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |msebor at gcc dot gnu.org
           Keywords|                            |documentation

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Which part do you find surprising?  That the warning is issued during the LTO
stage at all or that -Wno-stringop-overflow can be used during the LTO stage to
suppress it?

During LTO the same compiler options should be implicitly enabled as during
ordinary compilation, including warnings.  (This presents some challenges when
the compilation was done with different options for different files.)

It also means that all the same warnings should be expected to be implicitly
enabled during LTO that were explicitly enabled during the compilation stage. 
I'd expect to see only "late" warnings during LTO, i.e., those that depend on
optimization.  (I understand this doesn't work completely consistently yet but
I believe that's the goal.)

So this effect isn't specific to -Wstringop-overflow, but perhaps it would be
worth mentioning under -flto?

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

* [Bug lto/95190] Documentation for -Wstringop-overflow
  2020-05-18 14:01 [Bug c++/95190] New: Documentation for -Wstringop-overflow stayprivate at gmail dot com
  2020-05-18 17:05 ` [Bug lto/95190] " msebor at gcc dot gnu.org
@ 2020-05-19  6:32 ` rguenth at gcc dot gnu.org
  2020-05-19  7:04 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-19  6:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
This is new behavior for warnings in GCC 10 and now how all other optimization
options behave - the option state is fixed per function at compile-time and
carried over to link-time.

Indeed warning options are not mentioned in the docs, let me fix that.

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

* [Bug lto/95190] Documentation for -Wstringop-overflow
  2020-05-18 14:01 [Bug c++/95190] New: Documentation for -Wstringop-overflow stayprivate at gmail dot com
  2020-05-18 17:05 ` [Bug lto/95190] " msebor at gcc dot gnu.org
  2020-05-19  6:32 ` rguenth at gcc dot gnu.org
@ 2020-05-19  7:04 ` marxin at gcc dot gnu.org
  2020-05-19 16:29 ` stayprivate at gmail dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-05-19  7:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
> "writing 1 bytes into a region of size 0 -Wstringop-overflow=". Yet
> -Wno-stringop-overflow is passed to the compiler.  I tried disabling the
> warning with #pragma diagnostic, no luck there.

I must confirm that '#pragma diagnostic' is completely unsupported by LTO and I
spent some time tweaking into it. Eventually, I bailed out.

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

* [Bug lto/95190] Documentation for -Wstringop-overflow
  2020-05-18 14:01 [Bug c++/95190] New: Documentation for -Wstringop-overflow stayprivate at gmail dot com
                   ` (2 preceding siblings ...)
  2020-05-19  7:04 ` marxin at gcc dot gnu.org
@ 2020-05-19 16:29 ` stayprivate at gmail dot com
  2020-05-19 16:35 ` stayprivate at gmail dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: stayprivate at gmail dot com @ 2020-05-19 16:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Mario Charest <stayprivate at gmail dot com> ---
On Mon, May 18, 2020 at 1:09 PM msebor at gcc dot gnu.org <
gcc-bugzilla@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95190
>
> Martin Sebor <msebor at gcc dot gnu.org> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>    Last reconfirmed|                            |2020-05-18
>              Status|UNCONFIRMED                 |WAITING
>           Component|c++                         |lto
>      Ever confirmed|0                           |1
>                  CC|                            |marxin at gcc dot gnu.org
> ,
>                    |                            |msebor at gcc dot gnu.org
>            Keywords|                            |documentation
>
> --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
> Which part do you find surprising?  That the warning is issued during the
> LTO
> stage at all or that -Wno-stringop-overflow can be used during the LTO
> stage to
> suppress it?
>

Mostly the LTO stage. I got bitten because I assumed warning came from the
compiler. If the LTO stage would have handle #pragma diagnostic i would
have never noticed where it came from.


>
> During LTO the same compiler options should be implicitly enabled as during
> ordinary compilation, including warnings.  (This presents some challenges
> when
> the compilation was done with different options for different files.)
>

Most project with cmake using lto will required tweaking.  Typically
warning options are specified with add_compiler_options(). Now every
warning flags must also be passed to the linker, impossible to know which
flag has an effect on the LTO stage or not.


> It also means that all the same warnings should be expected to be
> implicitly
> enabled during LTO that were explicitly enabled during the compilation
> stage.
> I'd expect to see only "late" warnings during LTO, i.e., those that depend
> on
> optimization.  (I understand this doesn't work completely consistently yet
> but
> I believe that's the goal.)
>
> So this effect isn't specific to -Wstringop-overflow, but perhaps it would
> be
> worth mentioning under -flto?
>
> --
> You are receiving this mail because:
> You reported the bug.

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

* [Bug lto/95190] Documentation for -Wstringop-overflow
  2020-05-18 14:01 [Bug c++/95190] New: Documentation for -Wstringop-overflow stayprivate at gmail dot com
                   ` (3 preceding siblings ...)
  2020-05-19 16:29 ` stayprivate at gmail dot com
@ 2020-05-19 16:35 ` stayprivate at gmail dot com
  2020-05-22 10:28 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: stayprivate at gmail dot com @ 2020-05-19 16:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Mario Charest <stayprivate at gmail dot com> ---
On Tue, May 19, 2020 at 2:35 AM rguenth at gcc dot gnu.org <
gcc-bugzilla@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95190
>
> --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
> This is new behavior for warnings in GCC 10 and now how all other
> optimization
> options behave - the option state is fixed per function at compile-time and
> carried over to link-time.
>
> Indeed warning options are not mentioned in the docs, let me fix that.
>

Great! Thanks, may I suggest adding it the changes and portings web page.
This new behavior may required tweaking of build files.


> --
> You are receiving this mail because:
> You reported the bug.

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

* [Bug lto/95190] Documentation for -Wstringop-overflow
  2020-05-18 14:01 [Bug c++/95190] New: Documentation for -Wstringop-overflow stayprivate at gmail dot com
                   ` (4 preceding siblings ...)
  2020-05-19 16:35 ` stayprivate at gmail dot com
@ 2020-05-22 10:28 ` cvs-commit at gcc dot gnu.org
  2020-05-22 10:33 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-22 10:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:ab7eca92926fdc1da880120c116a1832fce56a29

commit r11-565-gab7eca92926fdc1da880120c116a1832fce56a29
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 19 08:36:13 2020 +0200

    lto/95190 - amend -flto docs for diagnostic option handling

    This documents new GCC 10 behavior on diagnostic options and -flto.

    2020-05-22  Richard Biener  <rguenther@suse.de>

            PR lto/95190
            * doc/invoke.texi (flto): Document behavior of diagnostic
            options.

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

* [Bug lto/95190] Documentation for -Wstringop-overflow
  2020-05-18 14:01 [Bug c++/95190] New: Documentation for -Wstringop-overflow stayprivate at gmail dot com
                   ` (5 preceding siblings ...)
  2020-05-22 10:28 ` cvs-commit at gcc dot gnu.org
@ 2020-05-22 10:33 ` cvs-commit at gcc dot gnu.org
  2020-12-07 23:13 ` egallager at gcc dot gnu.org
  2020-12-08  7:49 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-22 10:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:a24d9b5bbb6a298ff4e55d731d5e436b0da9e38a

commit r10-8169-ga24d9b5bbb6a298ff4e55d731d5e436b0da9e38a
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 19 08:36:13 2020 +0200

    lto/95190 - amend -flto docs for diagnostic option handling

    This documents new GCC 10 behavior on diagnostic options and -flto.

    2020-05-22  Richard Biener  <rguenther@suse.de>

            PR lto/95190
            * doc/invoke.texi (flto): Document behavior of diagnostic
            options.

    (cherry picked from commit ab7eca92926fdc1da880120c116a1832fce56a29)

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

* [Bug lto/95190] Documentation for -Wstringop-overflow
  2020-05-18 14:01 [Bug c++/95190] New: Documentation for -Wstringop-overflow stayprivate at gmail dot com
                   ` (6 preceding siblings ...)
  2020-05-22 10:33 ` cvs-commit at gcc dot gnu.org
@ 2020-12-07 23:13 ` egallager at gcc dot gnu.org
  2020-12-08  7:49 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: egallager at gcc dot gnu.org @ 2020-12-07 23:13 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Gallager <egallager at gcc dot gnu.org> changed:

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

--- Comment #8 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to CVS Commits from comment #7)
> The releases/gcc-10 branch has been updated by Richard Biener
> <rguenth@gcc.gnu.org>:
> 
> https://gcc.gnu.org/g:a24d9b5bbb6a298ff4e55d731d5e436b0da9e38a
> 
> commit r10-8169-ga24d9b5bbb6a298ff4e55d731d5e436b0da9e38a
> Author: Richard Biener <rguenther@suse.de>
> Date:   Tue May 19 08:36:13 2020 +0200
> 
>     lto/95190 - amend -flto docs for diagnostic option handling
>     
>     This documents new GCC 10 behavior on diagnostic options and -flto.
>     
>     2020-05-22  Richard Biener  <rguenther@suse.de>
>     
>             PR lto/95190
>             * doc/invoke.texi (flto): Document behavior of diagnostic
>             options.
>     
>     (cherry picked from commit ab7eca92926fdc1da880120c116a1832fce56a29)

so... FIXED now?

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

* [Bug lto/95190] Documentation for -Wstringop-overflow
  2020-05-18 14:01 [Bug c++/95190] New: Documentation for -Wstringop-overflow stayprivate at gmail dot com
                   ` (7 preceding siblings ...)
  2020-12-07 23:13 ` egallager at gcc dot gnu.org
@ 2020-12-08  7:49 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-12-08  7:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|WAITING                     |RESOLVED

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
I suppose so.

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

end of thread, other threads:[~2020-12-08  7:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-18 14:01 [Bug c++/95190] New: Documentation for -Wstringop-overflow stayprivate at gmail dot com
2020-05-18 17:05 ` [Bug lto/95190] " msebor at gcc dot gnu.org
2020-05-19  6:32 ` rguenth at gcc dot gnu.org
2020-05-19  7:04 ` marxin at gcc dot gnu.org
2020-05-19 16:29 ` stayprivate at gmail dot com
2020-05-19 16:35 ` stayprivate at gmail dot com
2020-05-22 10:28 ` cvs-commit at gcc dot gnu.org
2020-05-22 10:33 ` cvs-commit at gcc dot gnu.org
2020-12-07 23:13 ` egallager at gcc dot gnu.org
2020-12-08  7:49 ` rguenth 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).