public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/94842] New: [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573
@ 2020-04-29  6:51 anbu1024.me at gmail dot com
  2020-04-29  7:18 ` [Bug c/94842] " rguenth at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: anbu1024.me at gmail dot com @ 2020-04-29  6:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94842
           Summary: [8/9/10 Regression] internal compiler error: in
                    gimplify_label_expr, at gimplify.c:2573
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anbu1024.me at gmail dot com
  Target Milestone: ---

$ cat test.c 

_Atomic float x = 5 ;

void foo ( int arg_0 ) 
{ 
        void bar ( float arg_0 [ ( int ) ( x += 2 ) ] ) { } 
}

--------------------------------------------------------------------------------

$ gcc-10 --version
gcc (GCC) 10.0.1 20200419 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

--------------------------------------------------------------------------------

$ gcc-10 test.c 
test.c: In function ‘bar’:
test.c:6:27: internal compiler error: in gimplify_label_expr, at
gimplify.c:2573
    6 |  void bar ( float arg_0 [ ( int ) ( x += 2 ) ] ) { }
      |                           ^~~~~~~~~~~~~~~~~~
0x66df8d gimplify_label_expr
        ../../gcc-10-20200419/gcc/gimplify.c:2573
0xafd7d2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-10-20200419/gcc/gimplify.c:13847
0xb00bd6 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-10-20200419/gcc/gimplify.c:6825
0xafe48b gimplify_statement_list
        ../../gcc-10-20200419/gcc/gimplify.c:1869
0xafe48b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-10-20200419/gcc/gimplify.c:14052
0xb12883 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-10-20200419/gcc/gimplify.c:6825
0xb12883 gimplify_compound_expr
        ../../gcc-10-20200419/gcc/gimplify.c:6025
0xafdb30 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-10-20200419/gcc/gimplify.c:13598
0xb031b0 internal_get_tmp_var
        ../../gcc-10-20200419/gcc/gimplify.c:619
0xb057ca get_initialized_tmp_var(tree_node*, gimple**, gimple**, bool)
        ../../gcc-10-20200419/gcc/gimplify.c:674
0xb057ca gimplify_save_expr
        ../../gcc-10-20200419/gcc/gimplify.c:6073
0xafdeb6 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-10-20200419/gcc/gimplify.c:13908
0xb00bd6 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-10-20200419/gcc/gimplify.c:6825
0xafe48b gimplify_statement_list
        ../../gcc-10-20200419/gcc/gimplify.c:1869
0xafe48b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-10-20200419/gcc/gimplify.c:14052
0xb15927 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-10-20200419/gcc/gimplify.c:6825
0xb15927 gimplify_body(tree_node*, bool)
        ../../gcc-10-20200419/gcc/gimplify.c:14857
0xb15e53 gimplify_function_tree(tree_node*)
        ../../gcc-10-20200419/gcc/gimplify.c:15030
0xe49ee0 gimplify_all_functions
        ../../gcc-10-20200419/gcc/tree-nested.c:3521
0xe49ecf gimplify_all_functions
        ../../gcc-10-20200419/gcc/tree-nested.c:3524
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

--------------------------------------------------------------------------------

$ gcc-9 --version
gcc (GCC) 9.3.1 20200425
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

--------------------------------------------------------------------------------

$ gcc-9 test.c 
test.c: In function ‘bar’:
test.c:6:27: internal compiler error: in gimplify_label_expr, at
gimplify.c:2498
    6 |  void bar ( float arg_0 [ ( int ) ( x += 2 ) ] ) { }
      |                           ^~~~~~~~~~~~~~~~~~
0x5b6fa9 gimplify_label_expr
        ../../gcc-9-20200425/gcc/gimplify.c:2498
0x5b6fa9 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-9-20200425/gcc/gimplify.c:12750
0x86a736 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-9-20200425/gcc/gimplify.c:6721
0x86897b gimplify_statement_list
        ../../gcc-9-20200425/gcc/gimplify.c:1794
0x86897b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-9-20200425/gcc/gimplify.c:12940
0x86a736 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-9-20200425/gcc/gimplify.c:6721
0x86ae1b gimplify_compound_expr
        ../../gcc-9-20200425/gcc/gimplify.c:5930
0x868546 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-9-20200425/gcc/gimplify.c:12501
0x86c1b0 internal_get_tmp_var
        ../../gcc-9-20200425/gcc/gimplify.c:599
0x868327 get_initialized_tmp_var(tree_node*, gimple**, gimple**, bool)
        ../../gcc-9-20200425/gcc/gimplify.c:653
0x868327 gimplify_save_expr
        ../../gcc-9-20200425/gcc/gimplify.c:5978
0x868327 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-9-20200425/gcc/gimplify.c:12811
0x86a736 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-9-20200425/gcc/gimplify.c:6721
0x86897b gimplify_statement_list
        ../../gcc-9-20200425/gcc/gimplify.c:1794
0x86897b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-9-20200425/gcc/gimplify.c:12940
0x86a736 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-9-20200425/gcc/gimplify.c:6721
0x86ba16 gimplify_body(tree_node*, bool)
        ../../gcc-9-20200425/gcc/gimplify.c:13721
0x86bcc5 gimplify_function_tree(tree_node*)
        ../../gcc-9-20200425/gcc/gimplify.c:13865
0xb127bf gimplify_all_functions
        ../../gcc-9-20200425/gcc/tree-nested.c:3500
0xb127af gimplify_all_functions
        ../../gcc-9-20200425/gcc/tree-nested.c:3503
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

--------------------------------------------------------------------------------

$ gcc-8 --version
gcc (GCC) 8.4.1 20200424
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

--------------------------------------------------------------------------------

$ gcc-8 test.c 
test.c: In function ‘bar’:
test.c:6:27: internal compiler error: in gimplify_label_expr, at
gimplify.c:2455
  void bar ( float arg_0 [ ( int ) ( x += 2 ) ] ) { }
                           ^~~~~~~~~~~~~~~~~~
0x5b8fc1 gimplify_label_expr
        ../../gcc-8-20200424/gcc/gimplify.c:2454
0x5b8fc1 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-8-20200424/gcc/gimplify.c:11804
0x856106 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-8-20200424/gcc/gimplify.c:6708
0x85456b gimplify_statement_list
        ../../gcc-8-20200424/gcc/gimplify.c:1770
0x85456b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-8-20200424/gcc/gimplify.c:11994
0x856106 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-8-20200424/gcc/gimplify.c:6708
0x8567eb gimplify_compound_expr
        ../../gcc-8-20200424/gcc/gimplify.c:5917
0x853e37 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-8-20200424/gcc/gimplify.c:11555
0x857cbf internal_get_tmp_var
        ../../gcc-8-20200424/gcc/gimplify.c:575
0x855299 get_initialized_tmp_var(tree_node*, gimple**, gimple**, bool)
        ../../gcc-8-20200424/gcc/gimplify.c:629
0x855299 gimplify_save_expr
        ../../gcc-8-20200424/gcc/gimplify.c:5965
0x855299 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-8-20200424/gcc/gimplify.c:11865
0x856106 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-8-20200424/gcc/gimplify.c:6708
0x85456b gimplify_statement_list
        ../../gcc-8-20200424/gcc/gimplify.c:1770
0x85456b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-8-20200424/gcc/gimplify.c:11994
0x856106 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-8-20200424/gcc/gimplify.c:6708
0x85741e gimplify_body(tree_node*, bool)
        ../../gcc-8-20200424/gcc/gimplify.c:12767
0x8577c5 gimplify_function_tree(tree_node*)
        ../../gcc-8-20200424/gcc/gimplify.c:12932
0xae969f gimplify_all_functions
        ../../gcc-8-20200424/gcc/tree-nested.c:3316
0xae9681 gimplify_all_functions
        ../../gcc-8-20200424/gcc/tree-nested.c:3318
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug c/94842] [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573
  2020-04-29  6:51 [Bug c/94842] New: [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573 anbu1024.me at gmail dot com
@ 2020-04-29  7:18 ` rguenth at gcc dot gnu.org
  2020-04-29 13:28 ` jakub at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-29  7:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |jsm28 at gcc dot gnu.org
   Target Milestone|---                         |8.5
   Last reconfirmed|                            |2020-04-29
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  Not sure if the testcase is valid (side-effect in a nested function
definition?).

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

* [Bug c/94842] [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573
  2020-04-29  6:51 [Bug c/94842] New: [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573 anbu1024.me at gmail dot com
  2020-04-29  7:18 ` [Bug c/94842] " rguenth at gcc dot gnu.org
@ 2020-04-29 13:28 ` jakub at gcc dot gnu.org
  2020-04-29 21:27 ` joseph at codesourcery dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-29 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
ICEs since r0-126350-g267bac1078ce623767a9effa063d5b63fbbeb6ca

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

* [Bug c/94842] [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573
  2020-04-29  6:51 [Bug c/94842] New: [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573 anbu1024.me at gmail dot com
  2020-04-29  7:18 ` [Bug c/94842] " rguenth at gcc dot gnu.org
  2020-04-29 13:28 ` jakub at gcc dot gnu.org
@ 2020-04-29 21:27 ` joseph at codesourcery dot com
  2020-04-30 10:32 ` jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: joseph at codesourcery dot com @ 2020-04-29 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
Side-effects in the array sizes of variably modified parameters are valid 
and occur on entry to the function.  I don't think being a nested function 
should make any difference there.  (gcc.dg/atomic/pr65345-4.c has 
corresponding tests to this bug for the case of arguments to non-nested 
functions.)

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

* [Bug c/94842] [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573
  2020-04-29  6:51 [Bug c/94842] New: [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573 anbu1024.me at gmail dot com
                   ` (2 preceding siblings ...)
  2020-04-29 21:27 ` joseph at codesourcery dot com
@ 2020-04-30 10:32 ` jakub at gcc dot gnu.org
  2020-04-30 10:33 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-30 10:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Indeed:
_Atomic float x = 5;

void
bar (float y[(int) (x += 2)])
{
}
is accepted while
_Atomic float x = 5;

void
foo (void)
{
  void bar (float y[(int) (x += 2)]) {}
}
ICEs.  The problem is that create_artificial_label called from
build_atomic_assign from the nested function parameter declaration parsing sets
LABEL_DECL to current_function_decl

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

* [Bug c/94842] [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573
  2020-04-29  6:51 [Bug c/94842] New: [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573 anbu1024.me at gmail dot com
                   ` (3 preceding siblings ...)
  2020-04-30 10:32 ` jakub at gcc dot gnu.org
@ 2020-04-30 10:33 ` jakub at gcc dot gnu.org
  2020-04-30 19:49 ` [Bug c/94842] [8/9/10/11 " cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-30 10:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48415
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48415&action=edit
gcc10-pr94842.patch

Untested fix.

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

* [Bug c/94842] [8/9/10/11 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573
  2020-04-29  6:51 [Bug c/94842] New: [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573 anbu1024.me at gmail dot com
                   ` (4 preceding siblings ...)
  2020-04-30 10:33 ` jakub at gcc dot gnu.org
@ 2020-04-30 19:49 ` cvs-commit at gcc dot gnu.org
  2020-04-30 19:49 ` [Bug c/94842] [8/9/10 " jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-30 19:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

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

commit r11-5-gbf9155914f0c2dac62c6abf1e45abb52a5a56e5b
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Apr 30 21:48:30 2020 +0200

    c: Fix ICE with _Atomic side-effect in nested fn param decls [PR94842]

    If there are _Atomic side-effects in the parameter declarations
    of non-nested function, when they are parsed, current_function_decl is
    NULL, the create_artificial_label created labels during build_atomic* are
    then adjusted by store_parm_decls through set_labels_context_r callback.
    Unfortunately, if such thing happens in nested function parameter
    declarations, while those decls are parsed current_function_decl is the
    parent function (and am not sure it is a good idea to temporarily clear it,
    some code perhaps should be aware it is in a nested function, or it can
    refer to variables from the parent function etc.) and that means
    store_param_decls through set_labels_context_r doesn't adjust anything.
    As those labels are emitted in the nested function body rather than in the
    parent, I think it is ok to override the context in those cases.

    2020-04-30  Jakub Jelinek  <jakub@redhat.com>

            PR c/94842
            * c-decl.c (set_labels_context_r): In addition to context-less
            LABEL_DECLs adjust also LABEL_DECLs with context equal to
            parent function if any.
            (store_parm_decls): Adjust comment.

            * gcc.dg/pr94842.c: New test.

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

* [Bug c/94842] [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573
  2020-04-29  6:51 [Bug c/94842] New: [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573 anbu1024.me at gmail dot com
                   ` (5 preceding siblings ...)
  2020-04-30 19:49 ` [Bug c/94842] [8/9/10/11 " cvs-commit at gcc dot gnu.org
@ 2020-04-30 19:49 ` jakub at gcc dot gnu.org
  2020-05-07 13:27 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-30 19:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[8/9/10/11 Regression]      |[8/9/10 Regression]
                   |internal compiler error: in |internal compiler error: in
                   |gimplify_label_expr, at     |gimplify_label_expr, at
                   |gimplify.c:2573             |gimplify.c:2573

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 11+ so far.

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

* [Bug c/94842] [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573
  2020-04-29  6:51 [Bug c/94842] New: [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573 anbu1024.me at gmail dot com
                   ` (6 preceding siblings ...)
  2020-04-30 19:49 ` [Bug c/94842] [8/9/10 " jakub at gcc dot gnu.org
@ 2020-05-07 13:27 ` cvs-commit at gcc dot gnu.org
  2020-05-07 13:33 ` [Bug c/94842] [8/9 " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-07 13:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:61fb8963c22d91152a9c46a3512307bef3b3d7f7

commit r10-8109-g61fb8963c22d91152a9c46a3512307bef3b3d7f7
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Apr 30 21:48:30 2020 +0200

    c: Fix ICE with _Atomic side-effect in nested fn param decls [PR94842]

    If there are _Atomic side-effects in the parameter declarations
    of non-nested function, when they are parsed, current_function_decl is
    NULL, the create_artificial_label created labels during build_atomic* are
    then adjusted by store_parm_decls through set_labels_context_r callback.
    Unfortunately, if such thing happens in nested function parameter
    declarations, while those decls are parsed current_function_decl is the
    parent function (and am not sure it is a good idea to temporarily clear it,
    some code perhaps should be aware it is in a nested function, or it can
    refer to variables from the parent function etc.) and that means
    store_param_decls through set_labels_context_r doesn't adjust anything.
    As those labels are emitted in the nested function body rather than in the
    parent, I think it is ok to override the context in those cases.

    2020-04-30  Jakub Jelinek  <jakub@redhat.com>

            PR c/94842
            * c-decl.c (set_labels_context_r): In addition to context-less
            LABEL_DECLs adjust also LABEL_DECLs with context equal to
            parent function if any.
            (store_parm_decls): Adjust comment.

            * gcc.dg/pr94842.c: New test.

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

* [Bug c/94842] [8/9 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573
  2020-04-29  6:51 [Bug c/94842] New: [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573 anbu1024.me at gmail dot com
                   ` (7 preceding siblings ...)
  2020-05-07 13:27 ` cvs-commit at gcc dot gnu.org
@ 2020-05-07 13:33 ` jakub at gcc dot gnu.org
  2020-05-08  3:02 ` paul.hua.gm at gmail dot com
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-05-07 13:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[8/9/10 Regression]         |[8/9 Regression] internal
                   |internal compiler error: in |compiler error: in
                   |gimplify_label_expr, at     |gimplify_label_expr, at
                   |gimplify.c:2573             |gimplify.c:2573

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 10.2+ too.

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

* [Bug c/94842] [8/9 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573
  2020-04-29  6:51 [Bug c/94842] New: [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573 anbu1024.me at gmail dot com
                   ` (8 preceding siblings ...)
  2020-05-07 13:33 ` [Bug c/94842] [8/9 " jakub at gcc dot gnu.org
@ 2020-05-08  3:02 ` paul.hua.gm at gmail dot com
  2020-09-16 19:21 ` cvs-commit at gcc dot gnu.org
  2020-09-17 17:48 ` jakub at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: paul.hua.gm at gmail dot com @ 2020-05-08  3:02 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Hua <paul.hua.gm at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paul.hua.gm at gmail dot com

--- Comment #10 from Paul Hua <paul.hua.gm at gmail dot com> ---
ICEed on mips64el.

gcc_git_trunk/gcc/testsuite/gcc.dg/pr94842.c:8:1: internal compiler error:
Segmentation fault^M
0x1209b7233 crash_signal^M
        ../../../gcc_git_trunk/gcc/toplev.c:328^M
0x120a9eb85 tree_check(tree_node*, char const*, int, char const*, tree_code)^M
        ../../../gcc_git_trunk/gcc/tree.h:3293^M
0x120a9eb85 convert_nonlocal_reference_op^M
        ../../../gcc_git_trunk/gcc/tree-nested.c:1064^M
0x120d7f81f walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))^M
        ../../../gcc_git_trunk/gcc/tree.c:12001^M
0x1205e5adb walk_gimple_op(gimple*, tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)^M
        ../../../gcc_git_trunk/gcc/gimple-walk.c:268^M
0x1205e5da7 walk_gimple_stmt(gimple_stmt_iterator*, tree_node*
(*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**,
int*, void*), walk_stmt_info*)^M
        ../../../gcc_git_trunk/gcc/gimple-walk.c:596^M
0x1205e610b walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*,
bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)^M
        ../../../gcc_git_trunk/gcc/gimple-walk.c:51^M
0x1205e5f17 walk_gimple_stmt(gimple_stmt_iterator*, tree_node*
(*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**,
int*, void*), walk_stmt_info*)^M
        ../../../gcc_git_trunk/gcc/gimple-walk.c:605^M
0x1205e610b walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*,
bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)^M
        ../../../gcc_git_trunk/gcc/gimple-walk.c:51^M
0x120a972ff walk_body^M
        ../../../gcc_git_trunk/gcc/tree-nested.c:713^M
0x120a972ff walk_function^M
        ../../../gcc_git_trunk/gcc/tree-nested.c:724^M
0x120a972ff walk_all_functions^M
        ../../../gcc_git_trunk/gcc/tree-nested.c:789^M
0x120aa206b lower_nested_functions(tree_node*)^M
        ../../../gcc_git_trunk/gcc/tree-nested.c:3551^M
0x1203c55db cgraph_node::analyze()^M
        ../../../gcc_git_trunk/gcc/cgraphunit.c:676^M
0x1203c995f analyze_functions^M
        ../../../gcc_git_trunk/gcc/cgraphunit.c:1227^M
0x1203caaf3 symbol_table::finalize_compilation_unit()^M
        ../../../gcc_git_trunk/gcc/cgraphunit.c:2974^M
Please submit a full bug report,^M
with preprocessed source if appropriate.^M
Please include the complete backtrace with any bug report.^M
See <https://gcc.gnu.org/bugs/> for instructions.^M
compiler exited with status 1

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

* [Bug c/94842] [8/9 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573
  2020-04-29  6:51 [Bug c/94842] New: [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573 anbu1024.me at gmail dot com
                   ` (9 preceding siblings ...)
  2020-05-08  3:02 ` paul.hua.gm at gmail dot com
@ 2020-09-16 19:21 ` cvs-commit at gcc dot gnu.org
  2020-09-17 17:48 ` jakub at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-16 19:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

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

commit r9-8894-gb66139a3ba159473432edabb983c62219a28590d
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Apr 30 21:48:30 2020 +0200

    c: Fix ICE with _Atomic side-effect in nested fn param decls [PR94842]

    If there are _Atomic side-effects in the parameter declarations
    of non-nested function, when they are parsed, current_function_decl is
    NULL, the create_artificial_label created labels during build_atomic* are
    then adjusted by store_parm_decls through set_labels_context_r callback.
    Unfortunately, if such thing happens in nested function parameter
    declarations, while those decls are parsed current_function_decl is the
    parent function (and am not sure it is a good idea to temporarily clear it,
    some code perhaps should be aware it is in a nested function, or it can
    refer to variables from the parent function etc.) and that means
    store_param_decls through set_labels_context_r doesn't adjust anything.
    As those labels are emitted in the nested function body rather than in the
    parent, I think it is ok to override the context in those cases.

    2020-04-30  Jakub Jelinek  <jakub@redhat.com>

            PR c/94842
            * c-decl.c (set_labels_context_r): In addition to context-less
            LABEL_DECLs adjust also LABEL_DECLs with context equal to
            parent function if any.
            (store_parm_decls): Adjust comment.

            * gcc.dg/pr94842.c: New test.

    (cherry picked from commit 61fb8963c22d91152a9c46a3512307bef3b3d7f7)

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

* [Bug c/94842] [8/9 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573
  2020-04-29  6:51 [Bug c/94842] New: [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573 anbu1024.me at gmail dot com
                   ` (10 preceding siblings ...)
  2020-09-16 19:21 ` cvs-commit at gcc dot gnu.org
@ 2020-09-17 17:48 ` jakub at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-09-17 17:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 8.5 in r8-10500-gb79f3e1e67ca0c5e14b677e3fc847a3c79881b5f and for
9.4+ by the above commit.

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

end of thread, other threads:[~2020-09-17 17:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29  6:51 [Bug c/94842] New: [8/9/10 Regression] internal compiler error: in gimplify_label_expr, at gimplify.c:2573 anbu1024.me at gmail dot com
2020-04-29  7:18 ` [Bug c/94842] " rguenth at gcc dot gnu.org
2020-04-29 13:28 ` jakub at gcc dot gnu.org
2020-04-29 21:27 ` joseph at codesourcery dot com
2020-04-30 10:32 ` jakub at gcc dot gnu.org
2020-04-30 10:33 ` jakub at gcc dot gnu.org
2020-04-30 19:49 ` [Bug c/94842] [8/9/10/11 " cvs-commit at gcc dot gnu.org
2020-04-30 19:49 ` [Bug c/94842] [8/9/10 " jakub at gcc dot gnu.org
2020-05-07 13:27 ` cvs-commit at gcc dot gnu.org
2020-05-07 13:33 ` [Bug c/94842] [8/9 " jakub at gcc dot gnu.org
2020-05-08  3:02 ` paul.hua.gm at gmail dot com
2020-09-16 19:21 ` cvs-commit at gcc dot gnu.org
2020-09-17 17:48 ` 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).