public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110434] New: tree-nrv introduces incorrect CLOBBER(eol)
@ 2023-06-27 10:48 kristerw at gcc dot gnu.org
  2023-06-28  9:32 ` [Bug tree-optimization/110434] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: kristerw at gcc dot gnu.org @ 2023-06-27 10:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110434
           Summary: tree-nrv introduces incorrect CLOBBER(eol)
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kristerw at gcc dot gnu.org
  Target Milestone: ---

The tree-nrv pass may introduce incorrect CLOBBER(eol) of the form
  <retval> ={v} {CLOBBER(eol)};
  return <retval>;

One example of this can be seen by compiling gcc.c-torture/execute/921204-1.c
for x86 using the flags "-O -m32", where it changes the IR

  union bu o;
  ...
  o = i;
  MEM[(union  *)&o].b18 = _11;
  MEM[(union  *)&o].b20 = _11;
  <retval> = o;
  o ={v} {CLOBBER(eol)};
  return <retval>;

to just use <retval> instead of o

  union bu o [value-expr: <retval>];
  ...
  <retval> = i;
  MEM[(union  *)&<retval>].b18 = _11;
  MEM[(union  *)&<retval>].b20 = _11;
  <retval> ={v} {CLOBBER(eol)};
  return <retval>;

so the CLOBBER(eol) now refers to <retval>.

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

* [Bug tree-optimization/110434] tree-nrv introduces incorrect CLOBBER(eol)
  2023-06-27 10:48 [Bug tree-optimization/110434] New: tree-nrv introduces incorrect CLOBBER(eol) kristerw at gcc dot gnu.org
@ 2023-06-28  9:32 ` rguenth at gcc dot gnu.org
  2023-06-28 13:55 ` cvs-commit at gcc dot gnu.org
  2023-06-28 13:56 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-28  9:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-06-28

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

* [Bug tree-optimization/110434] tree-nrv introduces incorrect CLOBBER(eol)
  2023-06-27 10:48 [Bug tree-optimization/110434] New: tree-nrv introduces incorrect CLOBBER(eol) kristerw at gcc dot gnu.org
  2023-06-28  9:32 ` [Bug tree-optimization/110434] " rguenth at gcc dot gnu.org
@ 2023-06-28 13:55 ` cvs-commit at gcc dot gnu.org
  2023-06-28 13:56 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-28 13:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 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:4bf76b5b6db8e68755788ec91012c5a686440720

commit r14-2164-g4bf76b5b6db8e68755788ec91012c5a686440720
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jun 28 11:27:45 2023 +0200

    tree-optimization/110434 - avoid <retval> ={v} {CLOBBER} from NRV

    When NRV replaces a local variable with <retval> it also replaces
    occurences in clobbers.  This leads to <retval> being clobbered
    before the return of it which is strictly invalid but harmless in
    practice since there's no pass after NRV which would remove
    earlier stores.

    The following fixes this nevertheless.

            PR tree-optimization/110434
            * tree-nrv.cc (pass_nrv::execute): Remove CLOBBERs of
            VAR we replace with <retval>.

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

* [Bug tree-optimization/110434] tree-nrv introduces incorrect CLOBBER(eol)
  2023-06-27 10:48 [Bug tree-optimization/110434] New: tree-nrv introduces incorrect CLOBBER(eol) kristerw at gcc dot gnu.org
  2023-06-28  9:32 ` [Bug tree-optimization/110434] " rguenth at gcc dot gnu.org
  2023-06-28 13:55 ` cvs-commit at gcc dot gnu.org
@ 2023-06-28 13:56 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-28 13:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.  Thanks for reporting.

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

end of thread, other threads:[~2023-06-28 13:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27 10:48 [Bug tree-optimization/110434] New: tree-nrv introduces incorrect CLOBBER(eol) kristerw at gcc dot gnu.org
2023-06-28  9:32 ` [Bug tree-optimization/110434] " rguenth at gcc dot gnu.org
2023-06-28 13:55 ` cvs-commit at gcc dot gnu.org
2023-06-28 13:56 ` 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).