public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115624] New: '-Wnrvo' is not an option that controls warnings
@ 2024-06-25  0:41 albrecht.guendel at web dot de
  2024-06-25  0:46 ` [Bug c++/115624] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: albrecht.guendel at web dot de @ 2024-06-25  0:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115624
           Summary: '-Wnrvo' is not an option that controls warnings
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: albrecht.guendel at web dot de
  Target Milestone: ---

Hi, 
the new -Wnrvo warning is an amazing diagnostic.
However it does not play well with the #pragma GCC diagnostic directive. Yet.

Test-Case: https://godbolt.org/z/Tq8e8zPx8  

For the sake of completeness, here is the code:

using GCC 14.1 with "-Wnrvo" option

#include <string>
#pragma GCC diagnostic ignored "-Wnrvo"

std::string no_nrvo(int i)
{
    std::string ret{};
    if (i % 2)
        return {};
    return ret;
}


Current behavior:
warning: '-Wnrvo' is not an option that controls warnings [-Wpragmas]
warning: not eliding copy on return in 'std::string no_nrvo(int)' [-Wnrvo]

Expected behavior:
accept the "#pragma GCC diagnostic ignored" and do not diagnose the missed
optimization.

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

* [Bug c++/115624] '-Wnrvo' is not an option that controls warnings
  2024-06-25  0:41 [Bug c++/115624] New: '-Wnrvo' is not an option that controls warnings albrecht.guendel at web dot de
@ 2024-06-25  0:46 ` pinskia at gcc dot gnu.org
  2024-06-25  4:57 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-25  0:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
     Ever confirmed|0                           |1
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=58487
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2024-06-25

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I know the obvious patch which should fix this.

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

* [Bug c++/115624] '-Wnrvo' is not an option that controls warnings
  2024-06-25  0:41 [Bug c++/115624] New: '-Wnrvo' is not an option that controls warnings albrecht.guendel at web dot de
  2024-06-25  0:46 ` [Bug c++/115624] " pinskia at gcc dot gnu.org
@ 2024-06-25  4:57 ` cvs-commit at gcc dot gnu.org
  2024-06-25  4:58 ` cvs-commit at gcc dot gnu.org
  2024-06-25  4:58 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-25  4:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

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

commit r15-1590-gf7747210947a7c66e865c6ac571cce39e2b87caf
Author: Andrew Pinski <quic_apinski@quicinc.com>
Date:   Mon Jun 24 18:16:13 2024 -0700

    c-family: Add Warning property to Wnrvo option [PR115624]

    This was missing when Wnrvo was added in
    r14-1594-g2ae5384d457b9c67586de012816dfc71a6943164 .

    Pushed after a bootstrap/test on x86_64-linux-gnu.

    gcc/c-family/ChangeLog:

            PR c++/115624
            * c.opt (Wnrvo): Add Warning property.

    Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>

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

* [Bug c++/115624] '-Wnrvo' is not an option that controls warnings
  2024-06-25  0:41 [Bug c++/115624] New: '-Wnrvo' is not an option that controls warnings albrecht.guendel at web dot de
  2024-06-25  0:46 ` [Bug c++/115624] " pinskia at gcc dot gnu.org
  2024-06-25  4:57 ` cvs-commit at gcc dot gnu.org
@ 2024-06-25  4:58 ` cvs-commit at gcc dot gnu.org
  2024-06-25  4:58 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-25  4:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Andrew Pinski
<pinskia@gcc.gnu.org>:

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

commit r14-10344-gb7157f3930762097210aa24a3f24ed5cafee6672
Author: Andrew Pinski <quic_apinski@quicinc.com>
Date:   Mon Jun 24 18:16:13 2024 -0700

    c-family: Add Warning property to Wnrvo option [PR115624]

    This was missing when Wnrvo was added in
    r14-1594-g2ae5384d457b9c67586de012816dfc71a6943164 .

    Pushed after a bootstrap/test on x86_64-linux-gnu.

    gcc/c-family/ChangeLog:

            PR c++/115624
            * c.opt (Wnrvo): Add Warning property.

    Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
    (cherry picked from commit f7747210947a7c66e865c6ac571cce39e2b87caf)

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

* [Bug c++/115624] '-Wnrvo' is not an option that controls warnings
  2024-06-25  0:41 [Bug c++/115624] New: '-Wnrvo' is not an option that controls warnings albrecht.guendel at web dot de
                   ` (2 preceding siblings ...)
  2024-06-25  4:58 ` cvs-commit at gcc dot gnu.org
@ 2024-06-25  4:58 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-25  4:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.2
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2024-06-25  4:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-25  0:41 [Bug c++/115624] New: '-Wnrvo' is not an option that controls warnings albrecht.guendel at web dot de
2024-06-25  0:46 ` [Bug c++/115624] " pinskia at gcc dot gnu.org
2024-06-25  4:57 ` cvs-commit at gcc dot gnu.org
2024-06-25  4:58 ` cvs-commit at gcc dot gnu.org
2024-06-25  4:58 ` 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).