public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/106421] New: ICE with computed goto from a nested functon
@ 2022-07-23 10:58 amonakov at gcc dot gnu.org
  2022-07-24 20:19 ` [Bug middle-end/106421] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: amonakov at gcc dot gnu.org @ 2022-07-23 10:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106421
           Summary: ICE with computed goto from a nested functon
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amonakov at gcc dot gnu.org
  Target Milestone: ---

int main(int argc, char **argv)
{
        __label__ loop, end;
        void jmp(int c) { goto *(c ? &&loop : &&end); }
loop:
        jmp(argc < 0);
end:{}
}


makes gcc -O2 segfault in find_edge during RTL cprop.

The documentation might want to specify that goto from a nested function to a
containing function cannot be a 'computed goto' (must refer to the target label
directly by name).

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

* [Bug middle-end/106421] ICE with computed goto from a nested functon
  2022-07-23 10:58 [Bug middle-end/106421] New: ICE with computed goto from a nested functon amonakov at gcc dot gnu.org
@ 2022-07-24 20:19 ` pinskia at gcc dot gnu.org
  2022-07-24 20:22 ` [Bug rtl-optimization/106421] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-07-24 20:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> The documentation might want to specify that goto from a nested function

It already does.
from
https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gcc/Labels-as-Values.html#Labels-as-Values
:
"You may not use this mechanism to jump to code in a different function."

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

* [Bug rtl-optimization/106421] [10/11/12/13 Regression] ICE with computed goto from a nested functon
  2022-07-23 10:58 [Bug middle-end/106421] New: ICE with computed goto from a nested functon amonakov at gcc dot gnu.org
  2022-07-24 20:19 ` [Bug middle-end/106421] " pinskia at gcc dot gnu.org
@ 2022-07-24 20:22 ` pinskia at gcc dot gnu.org
  2022-07-24 20:23 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-07-24 20:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is undefined but still valid.

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

* [Bug rtl-optimization/106421] [10/11/12/13 Regression] ICE with computed goto from a nested functon
  2022-07-23 10:58 [Bug middle-end/106421] New: ICE with computed goto from a nested functon amonakov at gcc dot gnu.org
  2022-07-24 20:19 ` [Bug middle-end/106421] " pinskia at gcc dot gnu.org
  2022-07-24 20:22 ` [Bug rtl-optimization/106421] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
@ 2022-07-24 20:23 ` pinskia at gcc dot gnu.org
  2022-07-25  7:07 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-07-24 20:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.5

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

* [Bug rtl-optimization/106421] [10/11/12/13 Regression] ICE with computed goto from a nested functon
  2022-07-23 10:58 [Bug middle-end/106421] New: ICE with computed goto from a nested functon amonakov at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-07-24 20:23 ` pinskia at gcc dot gnu.org
@ 2022-07-25  7:07 ` marxin at gcc dot gnu.org
  2022-07-25  9:27 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-07-25  7:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-07-25
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

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

* [Bug rtl-optimization/106421] [10/11/12/13 Regression] ICE with computed goto from a nested functon
  2022-07-23 10:58 [Bug middle-end/106421] New: ICE with computed goto from a nested functon amonakov at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-07-25  7:07 ` marxin at gcc dot gnu.org
@ 2022-07-25  9:27 ` rguenth at gcc dot gnu.org
  2022-07-25 14:57 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-25  9:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think bypass_block has to be just resilent tho this case, guarding against
dest == NULL

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

* [Bug rtl-optimization/106421] [10/11/12/13 Regression] ICE with computed goto from a nested functon
  2022-07-23 10:58 [Bug middle-end/106421] New: ICE with computed goto from a nested functon amonakov at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-07-25  9:27 ` rguenth at gcc dot gnu.org
@ 2022-07-25 14:57 ` rguenth at gcc dot gnu.org
  2023-01-10 14:07 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-25 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug rtl-optimization/106421] [10/11/12/13 Regression] ICE with computed goto from a nested functon
  2022-07-23 10:58 [Bug middle-end/106421] New: ICE with computed goto from a nested functon amonakov at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-07-25 14:57 ` rguenth at gcc dot gnu.org
@ 2023-01-10 14:07 ` cvs-commit at gcc dot gnu.org
  2023-04-27 13:19 ` [Bug rtl-optimization/106421] [10/11/12 " cvs-commit at gcc dot gnu.org
  2023-07-07 10:43 ` [Bug rtl-optimization/106421] [11 " rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-10 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:851e1ba03f9de699a754dd8648fc151c3e26d697

commit r13-5091-g851e1ba03f9de699a754dd8648fc151c3e26d697
Author: Roger Sayle <roger@nextmovesoftware.com>
Date:   Tue Jan 10 14:05:46 2023 +0000

    PR rtl-optimization/106421: ICE in bypass_block from non-local goto.

    This patch fixes PR rtl-optimization/106421, an ICE-on-valid (but
    undefined) regression.  The fix, as proposed by Richard Biener, is to
    defend against BLOCK_FOR_INSN returning NULL in cprop's bypass_block.

    2023-01-10  Roger Sayle  <roger@nextmovesoftware.com>

    gcc/ChangeLog
            PR rtl-optimization/106421
            * cprop.cc (bypass_block): Check that DEST is local to this
            function (non-NULL) before calling find_edge.

    gcc/testsuite/ChangeLog
            PR rtl-optimization/106421
            * gcc.dg/pr106421.c: New test case.

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

* [Bug rtl-optimization/106421] [10/11/12 Regression] ICE with computed goto from a nested functon
  2022-07-23 10:58 [Bug middle-end/106421] New: ICE with computed goto from a nested functon amonakov at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-01-10 14:07 ` cvs-commit at gcc dot gnu.org
@ 2023-04-27 13:19 ` cvs-commit at gcc dot gnu.org
  2023-07-07 10:43 ` [Bug rtl-optimization/106421] [11 " rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-27 13:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r12-9480-g0a5fb0ee337b824224a2c13b76fd682b62e6d314
Author: Roger Sayle <roger@nextmovesoftware.com>
Date:   Tue Jan 10 14:05:46 2023 +0000

    PR rtl-optimization/106421: ICE in bypass_block from non-local goto.

    This patch fixes PR rtl-optimization/106421, an ICE-on-valid (but
    undefined) regression.  The fix, as proposed by Richard Biener, is to
    defend against BLOCK_FOR_INSN returning NULL in cprop's bypass_block.

    2023-01-10  Roger Sayle  <roger@nextmovesoftware.com>

    gcc/ChangeLog
            PR rtl-optimization/106421
            * cprop.cc (bypass_block): Check that DEST is local to this
            function (non-NULL) before calling find_edge.

    gcc/testsuite/ChangeLog
            PR rtl-optimization/106421
            * gcc.dg/pr106421.c: New test case.

    (cherry picked from commit 851e1ba03f9de699a754dd8648fc151c3e26d697)

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

* [Bug rtl-optimization/106421] [11 Regression] ICE with computed goto from a nested functon
  2022-07-23 10:58 [Bug middle-end/106421] New: ICE with computed goto from a nested functon amonakov at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2023-04-27 13:19 ` [Bug rtl-optimization/106421] [10/11/12 " cvs-commit at gcc dot gnu.org
@ 2023-07-07 10:43 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

end of thread, other threads:[~2023-07-07 10:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-23 10:58 [Bug middle-end/106421] New: ICE with computed goto from a nested functon amonakov at gcc dot gnu.org
2022-07-24 20:19 ` [Bug middle-end/106421] " pinskia at gcc dot gnu.org
2022-07-24 20:22 ` [Bug rtl-optimization/106421] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
2022-07-24 20:23 ` pinskia at gcc dot gnu.org
2022-07-25  7:07 ` marxin at gcc dot gnu.org
2022-07-25  9:27 ` rguenth at gcc dot gnu.org
2022-07-25 14:57 ` rguenth at gcc dot gnu.org
2023-01-10 14:07 ` cvs-commit at gcc dot gnu.org
2023-04-27 13:19 ` [Bug rtl-optimization/106421] [10/11/12 " cvs-commit at gcc dot gnu.org
2023-07-07 10:43 ` [Bug rtl-optimization/106421] [11 " 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).