public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/106272] New: clang build: new warning ?
@ 2022-07-12 18:41 dcb314 at hotmail dot com
  2022-07-12 19:02 ` [Bug preprocessor/106272] " redi at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: dcb314 at hotmail dot com @ 2022-07-12 18:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106272
           Summary: clang build: new warning ?
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Recent gcc builds with clang say this:

libcpp/include/line-map.h:1882:12: warning: moving a temporary object prevents
copy elision [-Wpessimizing-move]

I have little idea what that means, but the line of code is

    return std::move (label_text (buffer, true));

This new warning appears about 700 times, so it might be important.

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

* [Bug preprocessor/106272] clang build: new warning ?
  2022-07-12 18:41 [Bug c/106272] New: clang build: new warning ? dcb314 at hotmail dot com
@ 2022-07-12 19:02 ` redi at gcc dot gnu.org
  2022-07-12 19:35 ` dcb314 at hotmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2022-07-12 19:02 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-07-12
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to David Binderman from comment #0)
> This new warning appears about 700 times, so it might be important.

It's not. But the move is useless and shouldn't be there.

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

* [Bug preprocessor/106272] clang build: new warning ?
  2022-07-12 18:41 [Bug c/106272] New: clang build: new warning ? dcb314 at hotmail dot com
  2022-07-12 19:02 ` [Bug preprocessor/106272] " redi at gcc dot gnu.org
@ 2022-07-12 19:35 ` dcb314 at hotmail dot com
  2022-07-12 20:26 ` egallager at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dcb314 at hotmail dot com @ 2022-07-12 19:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from David Binderman <dcb314 at hotmail dot com> ---
I just noticed similar four lines earlier:

libcpp/include/line-map.h:1876:12: warning: moving a temporary object prevents
copy elision [-Wpessimizing-move]

Source code is

    return std::move (label_text (const_cast <char *> (buffer), false));

About 700 mentions of this one, as well.

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

* [Bug preprocessor/106272] clang build: new warning ?
  2022-07-12 18:41 [Bug c/106272] New: clang build: new warning ? dcb314 at hotmail dot com
  2022-07-12 19:02 ` [Bug preprocessor/106272] " redi at gcc dot gnu.org
  2022-07-12 19:35 ` dcb314 at hotmail dot com
@ 2022-07-12 20:26 ` egallager at gcc dot gnu.org
  2022-07-13  0:09 ` mpolacek at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: egallager at gcc dot gnu.org @ 2022-07-12 20:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |build, diagnostic
                 CC|                            |egallager at gcc dot gnu.org

--- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> ---
Note that GCC has its own version of -Wpessimizing-move, too... any idea why
clang's version of the flag catches it, but gcc's doesn't?

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

* [Bug preprocessor/106272] clang build: new warning ?
  2022-07-12 18:41 [Bug c/106272] New: clang build: new warning ? dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2022-07-12 20:26 ` egallager at gcc dot gnu.org
@ 2022-07-13  0:09 ` mpolacek at gcc dot gnu.org
  2022-07-13  0:17 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-07-13  0:09 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #3)
> Note that GCC has its own version of -Wpessimizing-move, too... any idea why
> clang's version of the flag catches it, but gcc's doesn't?

No, but I'm going to reduce libcpp/line-map.ii to create a testcase and file a
bug and since it's my warning, maybe even fix it.

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

* [Bug preprocessor/106272] clang build: new warning ?
  2022-07-12 18:41 [Bug c/106272] New: clang build: new warning ? dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2022-07-13  0:09 ` mpolacek at gcc dot gnu.org
@ 2022-07-13  0:17 ` mpolacek at gcc dot gnu.org
  2022-07-13  0:52 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-07-13  0:17 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
And while at it, why don't I fix this one.

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

* [Bug preprocessor/106272] clang build: new warning ?
  2022-07-12 18:41 [Bug c/106272] New: clang build: new warning ? dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2022-07-13  0:17 ` mpolacek at gcc dot gnu.org
@ 2022-07-13  0:52 ` mpolacek at gcc dot gnu.org
  2022-07-13 18:23 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-07-13  0:52 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=106276

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #4)
> (In reply to Eric Gallager from comment #3)
> > Note that GCC has its own version of -Wpessimizing-move, too... any idea why
> > clang's version of the flag catches it, but gcc's doesn't?
> 
> No, but I'm going to reduce libcpp/line-map.ii to create a testcase and file
> a bug and since it's my warning, maybe even fix it.

Bug 106276.

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

* [Bug preprocessor/106272] clang build: new warning ?
  2022-07-12 18:41 [Bug c/106272] New: clang build: new warning ? dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2022-07-13  0:52 ` mpolacek at gcc dot gnu.org
@ 2022-07-13 18:23 ` cvs-commit at gcc dot gnu.org
  2022-07-13 18:25 ` mpolacek at gcc dot gnu.org
  2022-07-13 19:11 ` dmalcolm at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-13 18:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:86a15b266a7284f3aa1b12494a475f31416b981d

commit r13-1689-g86a15b266a7284f3aa1b12494a475f31416b981d
Author: Marek Polacek <polacek@redhat.com>
Date:   Tue Jul 12 20:18:56 2022 -0400

    libcpp: Avoid pessimizing std::move [PR106272]

    std::move in a return statement can prevent the NRVO:
   
<https://developers.redhat.com/blog/2019/04/12/understanding-when-not-to-stdmove-in-c>

    PR106272 reports that we have two such cases in class label_text's
    member functions.  We have -Wpessimizing-move that's supposed to detect
    problematic std::move uses, but in this case it didn't trigger.  I've filed
    PR106276 to track that.

            PR preprocessor/106272

    libcpp/ChangeLog:

            * include/line-map.h (class label_text): Don't std::move in a
return
            statement.

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

* [Bug preprocessor/106272] clang build: new warning ?
  2022-07-12 18:41 [Bug c/106272] New: clang build: new warning ? dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2022-07-13 18:23 ` cvs-commit at gcc dot gnu.org
@ 2022-07-13 18:25 ` mpolacek at gcc dot gnu.org
  2022-07-13 19:11 ` dmalcolm at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-07-13 18:25 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.

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

* [Bug preprocessor/106272] clang build: new warning ?
  2022-07-12 18:41 [Bug c/106272] New: clang build: new warning ? dcb314 at hotmail dot com
                   ` (7 preceding siblings ...)
  2022-07-13 18:25 ` mpolacek at gcc dot gnu.org
@ 2022-07-13 19:11 ` dmalcolm at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2022-07-13 19:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks!

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

end of thread, other threads:[~2022-07-13 19:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12 18:41 [Bug c/106272] New: clang build: new warning ? dcb314 at hotmail dot com
2022-07-12 19:02 ` [Bug preprocessor/106272] " redi at gcc dot gnu.org
2022-07-12 19:35 ` dcb314 at hotmail dot com
2022-07-12 20:26 ` egallager at gcc dot gnu.org
2022-07-13  0:09 ` mpolacek at gcc dot gnu.org
2022-07-13  0:17 ` mpolacek at gcc dot gnu.org
2022-07-13  0:52 ` mpolacek at gcc dot gnu.org
2022-07-13 18:23 ` cvs-commit at gcc dot gnu.org
2022-07-13 18:25 ` mpolacek at gcc dot gnu.org
2022-07-13 19:11 ` dmalcolm 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).