public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98690] New: unexpected "'removed_return.213' may be used uninitialized in this function" causes crash
@ 2021-01-14 19:48 savoiu at yahoo dot com
  2021-01-15  8:29 ` [Bug ipa/98690] [10/11 Regression] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: savoiu at yahoo dot com @ 2021-01-14 19:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98690
           Summary: unexpected "'removed_return.213' may be used
                    uninitialized in this function" causes crash
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: savoiu at yahoo dot com
  Target Milestone: ---

Created attachment 49968
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49968&action=edit
code exhibiting bug

When compiling the attached code I get:

error: 'removed_return.213' may be used uninitialized in this function
[-Werror=maybe-uninitialized]

and the error points to the 'endl' in that line.

If I downgrade the "maybe-uninitialized" to just a warning then it compiles but
the code crashes on that line.

The command line is:

  g++ -fnon-call-exceptions -Wmaybe-uninitialized -O2 gcc10bug.cpp
gcc10bug_main.cpp

If I remove -fnon-call-exceptions the the code compiles and runs as expected.
The code also runs just fine with GCC 9.1.0.

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

* [Bug ipa/98690] [10/11 Regression] unexpected "'removed_return.213' may be used uninitialized in this function" causes crash
  2021-01-14 19:48 [Bug c++/98690] New: unexpected "'removed_return.213' may be used uninitialized in this function" causes crash savoiu at yahoo dot com
@ 2021-01-15  8:29 ` rguenth at gcc dot gnu.org
  2021-01-15  8:40 ` [Bug ipa/98690] [10/11 Regression] unexpected "'removed_return.213' may be used uninitialized in this function" causes crash since r10-3311-gff6686d2e5f797d6 marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-15  8:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.3
   Last reconfirmed|                            |2021-01-15
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |wrong-code
           Priority|P3                          |P2
     Ever confirmed|0                           |1
            Summary|unexpected                  |[10/11 Regression]
                   |"'removed_return.213' may   |unexpected
                   |be used uninitialized in    |"'removed_return.213' may
                   |this function" causes crash |be used uninitialized in
                   |                            |this function" causes crash
          Component|middle-end                  |ipa
                 CC|                            |jamborm at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  -fno-ipa-sra fixes it.  Martin?

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

* [Bug ipa/98690] [10/11 Regression] unexpected "'removed_return.213' may be used uninitialized in this function" causes crash since r10-3311-gff6686d2e5f797d6
  2021-01-14 19:48 [Bug c++/98690] New: unexpected "'removed_return.213' may be used uninitialized in this function" causes crash savoiu at yahoo dot com
  2021-01-15  8:29 ` [Bug ipa/98690] [10/11 Regression] " rguenth at gcc dot gnu.org
@ 2021-01-15  8:40 ` marxin at gcc dot gnu.org
  2021-01-18 19:27 ` jamborm at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-01-15  8:40 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11 Regression]          |[10/11 Regression]
                   |unexpected                  |unexpected
                   |"'removed_return.213' may   |"'removed_return.213' may
                   |be used uninitialized in    |be used uninitialized in
                   |this function" causes crash |this function" causes crash
                   |                            |since
                   |                            |r10-3311-gff6686d2e5f797d6

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started when IPA SRA was added.

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

* [Bug ipa/98690] [10/11 Regression] unexpected "'removed_return.213' may be used uninitialized in this function" causes crash since r10-3311-gff6686d2e5f797d6
  2021-01-14 19:48 [Bug c++/98690] New: unexpected "'removed_return.213' may be used uninitialized in this function" causes crash savoiu at yahoo dot com
  2021-01-15  8:29 ` [Bug ipa/98690] [10/11 Regression] " rguenth at gcc dot gnu.org
  2021-01-15  8:40 ` [Bug ipa/98690] [10/11 Regression] unexpected "'removed_return.213' may be used uninitialized in this function" causes crash since r10-3311-gff6686d2e5f797d6 marxin at gcc dot gnu.org
@ 2021-01-18 19:27 ` jamborm at gcc dot gnu.org
  2021-01-19 10:34 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jamborm at gcc dot gnu.org @ 2021-01-18 19:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> ---
I have proposed a patch on the mailing list:
https://gcc.gnu.org/pipermail/gcc-patches/2021-January/563790.html

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

* [Bug ipa/98690] [10/11 Regression] unexpected "'removed_return.213' may be used uninitialized in this function" causes crash since r10-3311-gff6686d2e5f797d6
  2021-01-14 19:48 [Bug c++/98690] New: unexpected "'removed_return.213' may be used uninitialized in this function" causes crash savoiu at yahoo dot com
                   ` (2 preceding siblings ...)
  2021-01-18 19:27 ` jamborm at gcc dot gnu.org
@ 2021-01-19 10:34 ` cvs-commit at gcc dot gnu.org
  2021-01-19 14:54 ` cvs-commit at gcc dot gnu.org
  2021-01-21 11:58 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-19 10:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Jambor <jamborm@gcc.gnu.org>:

https://gcc.gnu.org/g:9b8741c98f2876a430c12c85b396d29a87c9c488

commit r11-6786-g9b8741c98f2876a430c12c85b396d29a87c9c488
Author: Martin Jambor <mjambor@suse.cz>
Date:   Tue Jan 19 11:28:48 2021 +0100

    ipa-sra: Do not remove return values needed because of non-call EH

    IPA-SRA already contains a check to figure out that an otherwise dead
    parameter is actually required because of non-call exceptions, but it
    is not present at the equivalent spot where SRA figures out whether
    the return statement is used for anything useful.  This patch adds
    that condition there.

    Unfortunately, even though this patch should be good enough for any
    normal (I'd even say reasonable) use of the compiler, it hints that
    when the user manually switches all sorts of DCE, IPA-SRA would
    probably leave behind problematic statements manipulating what
    originally were return values, just like it does for parameters (PR
    93385).  Fixing this properly might unfortunately be a separate issue
    from the mentioned bug because the LHS of a call is changed during
    call redirection and the caller often is not a clone.  But I'll see
    what I can do.

    Meanwhile, the patch below has been bootstrapped and tested on x86_64.

    gcc/ChangeLog:

    2021-01-18  Martin Jambor  <mjambor@suse.cz>

            PR ipa/98690
            * ipa-sra.c (ssa_name_only_returned_p): New parameter fun.  Check
            whether non-call exceptions allow removal of a statement.
            (isra_analyze_call): Pass the appropriate function to
            ssa_name_only_returned_p.

    gcc/testsuite/ChangeLog:

    2021-01-18  Martin Jambor  <mjambor@suse.cz>

            PR ipa/98690
            * g++.dg/ipa/pr98690.C: New test.

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

* [Bug ipa/98690] [10/11 Regression] unexpected "'removed_return.213' may be used uninitialized in this function" causes crash since r10-3311-gff6686d2e5f797d6
  2021-01-14 19:48 [Bug c++/98690] New: unexpected "'removed_return.213' may be used uninitialized in this function" causes crash savoiu at yahoo dot com
                   ` (3 preceding siblings ...)
  2021-01-19 10:34 ` cvs-commit at gcc dot gnu.org
@ 2021-01-19 14:54 ` cvs-commit at gcc dot gnu.org
  2021-01-21 11:58 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-19 14:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Martin Jambor
<jamborm@gcc.gnu.org>:

https://gcc.gnu.org/g:0a9e37150c448d7058550398ad98c74fcb33b595

commit r10-9280-g0a9e37150c448d7058550398ad98c74fcb33b595
Author: Martin Jambor <mjambor@suse.cz>
Date:   Tue Jan 19 15:50:49 2021 +0100

    ipa-sra: Do not remove return values needed because of non-call EH

    IPA-SRA already contains a check to figure out that an otherwise dead
    parameter is actually required because of non-call exceptions, but it
    is not present at the equivalent spot where SRA figures out whether
    the return statement is used for anything useful.  This patch adds
    that condition there.

    Unfortunately, even though this patch should be good enough for any
    normal (I'd even say reasonable) use of the compiler, it hints that
    when the user manually switches all sorts of DCE, IPA-SRA would
    probably leave behind problematic statements manipulating what
    originally were return values, just like it does for parameters (PR
    93385).  Fixing this properly might unfortunately be a separate issue
    from the mentioned bug because the LHS of a call is changed during
    call redirection and the caller often is not a clone.  But I'll see
    what I can do.

    Meanwhile, the patch below has been bootstrapped and tested on x86_64.

    gcc/ChangeLog:

    2021-01-18  Martin Jambor  <mjambor@suse.cz>

            PR ipa/98690
            * ipa-sra.c (ssa_name_only_returned_p): New parameter fun.  Check
            whether non-call exceptions allow removal of a statement.
            (isra_analyze_call): Pass the appropriate function to
            ssa_name_only_returned_p.

    gcc/testsuite/ChangeLog:

    2021-01-18  Martin Jambor  <mjambor@suse.cz>

            PR ipa/98690
            * g++.dg/ipa/pr98690.C: New test.

    (cherry picked from commit 9b8741c98f2876a430c12c85b396d29a87c9c488)

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

* [Bug ipa/98690] [10/11 Regression] unexpected "'removed_return.213' may be used uninitialized in this function" causes crash since r10-3311-gff6686d2e5f797d6
  2021-01-14 19:48 [Bug c++/98690] New: unexpected "'removed_return.213' may be used uninitialized in this function" causes crash savoiu at yahoo dot com
                   ` (4 preceding siblings ...)
  2021-01-19 14:54 ` cvs-commit at gcc dot gnu.org
@ 2021-01-21 11:58 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-21 11:58 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Assuming fixed.

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

end of thread, other threads:[~2021-01-21 11:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14 19:48 [Bug c++/98690] New: unexpected "'removed_return.213' may be used uninitialized in this function" causes crash savoiu at yahoo dot com
2021-01-15  8:29 ` [Bug ipa/98690] [10/11 Regression] " rguenth at gcc dot gnu.org
2021-01-15  8:40 ` [Bug ipa/98690] [10/11 Regression] unexpected "'removed_return.213' may be used uninitialized in this function" causes crash since r10-3311-gff6686d2e5f797d6 marxin at gcc dot gnu.org
2021-01-18 19:27 ` jamborm at gcc dot gnu.org
2021-01-19 10:34 ` cvs-commit at gcc dot gnu.org
2021-01-19 14:54 ` cvs-commit at gcc dot gnu.org
2021-01-21 11:58 ` jakub 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).