public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403
@ 2020-03-14  3:27 dtaubert at atmosic dot com
  2020-03-14  3:46 ` [Bug middle-end/94172] " pinskia at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: dtaubert at atmosic dot com @ 2020-03-14  3:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94172
           Summary: [arm-none-eabi] ICE in expand_debug_locations, at
                    cfgexpand.c:5403
           Product: gcc
           Version: 8.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dtaubert at atmosic dot com
  Target Milestone: ---

Created attachment 48032
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48032&action=edit
gcc -v output

extern enum my_enum_type extern_enum;
extern void bar(int a);

enum my_enum_type {
    my_entry
};

void foo(int a)
{
    int local_enum = extern_enum;

    if (a) {
        __asm volatile ("bkpt 0");
        local_enum = 0;
    }
    bar(local_enum);
}

arm/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gcc -o foo.o -c
-mcpu=cortex-m0 -mthumb -Os -g3 foo.c
during RTL pass: expand
foo.c: In function 'foo':
foo.c:8:6: internal compiler error: in expand_debug_locations, at
cfgexpand.c:5403
 void foo(int a)
      ^~~


Also seen with releases/gcc-9.2.0 from git://gcc.gnu.org/git/gcc.git
during RTL pass: expand
foo.c: In function ?foo?:
foo.c:8:6: internal compiler error: in expand_debug_locations, at
cfgexpand.c:5460
    8 | void foo(int a)
      |      ^~~
0x67cb6b expand_debug_locations
        ../../gcc/cfgexpand.c:5456
0x67cb6b execute
        ../../gcc/cfgexpand.c:6516

            gcc_assert (mode == GET_MODE (val)
                        || (GET_MODE (val) == VOIDmode
                            && (CONST_SCALAR_INT_P (val)
                                || GET_CODE (val) == CONST_FIXED
                                || GET_CODE (val) == LABEL_REF)));

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

* [Bug middle-end/94172] [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403
  2020-03-14  3:27 [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403 dtaubert at atmosic dot com
@ 2020-03-14  3:46 ` pinskia at gcc dot gnu.org
  2020-03-16 15:55 ` wilco at gcc dot gnu.org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-03-14  3:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>GNU Tools for Arm Embedded Processors 8-2019-q3-update

You should report this to ARM really.

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

* [Bug middle-end/94172] [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403
  2020-03-14  3:27 [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403 dtaubert at atmosic dot com
  2020-03-14  3:46 ` [Bug middle-end/94172] " pinskia at gcc dot gnu.org
@ 2020-03-16 15:55 ` wilco at gcc dot gnu.org
  2020-03-16 16:25 ` jakub at gcc dot gnu.org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: wilco at gcc dot gnu.org @ 2020-03-16 15:55 UTC (permalink / raw)
  To: gcc-bugs

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

Wilco <wilco at gcc dot gnu.org> changed:

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

--- Comment #2 from Wilco <wilco at gcc dot gnu.org> ---
It's a generic issue with -fshort-enums (which is the default in arm-none-eabi)
- it fails since GCC6 on every target.

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

* [Bug middle-end/94172] [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403
  2020-03-14  3:27 [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403 dtaubert at atmosic dot com
  2020-03-14  3:46 ` [Bug middle-end/94172] " pinskia at gcc dot gnu.org
  2020-03-16 15:55 ` wilco at gcc dot gnu.org
@ 2020-03-16 16:25 ` jakub at gcc dot gnu.org
  2020-03-16 16:30 ` rearnsha at gcc dot gnu.org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-16 16:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Can't reproduce on the trunk, neither on x86_64-linux with -Os -g3
-fshort-enums, nor on arm-linux-gnueabi with -Os -g3 -fshort-enums
-mcpu=cortex-m0 -mthumb

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

* [Bug middle-end/94172] [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403
  2020-03-14  3:27 [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403 dtaubert at atmosic dot com
                   ` (2 preceding siblings ...)
  2020-03-16 16:25 ` jakub at gcc dot gnu.org
@ 2020-03-16 16:30 ` rearnsha at gcc dot gnu.org
  2020-03-16 16:34 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2020-03-16 16:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #3)
> Can't reproduce on the trunk, neither on x86_64-linux with -Os -g3
> -fshort-enums, nor on arm-linux-gnueabi with -Os -g3 -fshort-enums
> -mcpu=cortex-m0 -mthumb

arm-linux doesn't use short enums, only arm-none-eabi

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

* [Bug middle-end/94172] [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403
  2020-03-14  3:27 [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403 dtaubert at atmosic dot com
                   ` (3 preceding siblings ...)
  2020-03-16 16:30 ` rearnsha at gcc dot gnu.org
@ 2020-03-16 16:34 ` jakub at gcc dot gnu.org
  2020-03-16 16:35 ` wilco at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-16 16:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Oops, sorry, I've used __asm volatile (""); so that it doesn't have an arm
specific instruction and in that case it doesn't ICE.  With __asm volatile
("nop"); it ICEs even on x86_64-linux.  Looking...

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

* [Bug middle-end/94172] [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403
  2020-03-14  3:27 [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403 dtaubert at atmosic dot com
                   ` (4 preceding siblings ...)
  2020-03-16 16:34 ` jakub at gcc dot gnu.org
@ 2020-03-16 16:35 ` wilco at gcc dot gnu.org
  2020-03-16 16:39 ` tnfchris at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: wilco at gcc dot gnu.org @ 2020-03-16 16:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #3)
> Can't reproduce on the trunk, neither on x86_64-linux with -Os -g3
> -fshort-enums, nor on arm-linux-gnueabi with -Os -g3 -fshort-enums
> -mcpu=cortex-m0 -mthumb

I tried -O2 -g -fshort-enums and this fails on AArch64:

extern enum my_enum_type extern_enum;
extern void bar(int a);

enum my_enum_type {
    my_entry
};

void g(void);
void foo(int a)
{
    int local_enum = extern_enum;

    if (a) {
        g();
        local_enum = 0;
    }
    bar(local_enum);
}

The issue is the placement of the extern enum declaration. Move it after the
enum type and all is well - the assert in cfgexpand seems to not allow SI/QI
combination.

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

* [Bug middle-end/94172] [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403
  2020-03-14  3:27 [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403 dtaubert at atmosic dot com
                   ` (5 preceding siblings ...)
  2020-03-16 16:35 ` wilco at gcc dot gnu.org
@ 2020-03-16 16:39 ` tnfchris at gcc dot gnu.org
  2020-03-16 16:46 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2020-03-16 16:39 UTC (permalink / raw)
  To: gcc-bugs

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

Tamar Christina <tnfchris at gcc dot gnu.org> changed:

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

--- Comment #7 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> >GNU Tools for Arm Embedded Processors 8-2019-q3-update
> 
> You should report this to ARM really.

Why? Report clearly said it's reproducible from a release built from git.

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

* [Bug middle-end/94172] [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403
  2020-03-14  3:27 [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403 dtaubert at atmosic dot com
                   ` (6 preceding siblings ...)
  2020-03-16 16:39 ` tnfchris at gcc dot gnu.org
@ 2020-03-16 16:46 ` jakub at gcc dot gnu.org
  2020-03-16 18:21 ` [Bug c/94172] " jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-16 16:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-03-16
     Ever confirmed|0                           |1

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I'd say this is a C FE bug.
Consider:
extern enum E e;
enum E { l = 0x100000000ULL };

unsigned long long
foo (void)
{
  return e;
}
which ICEs at -O2 on x86_64-linux.
I'd say we should use incomplete_vars not just for incomplete
RECORD/UNION_TYPEd vars, but also for incomplete ENUMERATION_TYPEd.

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

* [Bug c/94172] [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403
  2020-03-14  3:27 [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403 dtaubert at atmosic dot com
                   ` (7 preceding siblings ...)
  2020-03-16 16:46 ` jakub at gcc dot gnu.org
@ 2020-03-16 18:21 ` jakub at gcc dot gnu.org
  2020-03-17 21:33 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-16 18:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

Untested fix.

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

* [Bug c/94172] [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403
  2020-03-14  3:27 [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403 dtaubert at atmosic dot com
                   ` (8 preceding siblings ...)
  2020-03-16 18:21 ` [Bug c/94172] " jakub at gcc dot gnu.org
@ 2020-03-17 21:33 ` cvs-commit at gcc dot gnu.org
  2020-03-18  7:55 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-17 21:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 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:046c58907ec85884042d9937ea9c25ef9fe57b1d

commit r10-7230-g046c58907ec85884042d9937ea9c25ef9fe57b1d
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Mar 17 22:32:34 2020 +0100

    c: Handle C_TYPE_INCOMPLETE_VARS even for ENUMERAL_TYPEs [PR94172]

    The following testcases ICE, because they contain extern variable
    declarations with incomplete enum types that is later completed and after
    that those variables are accessed.  The ICEs are because the vars then may
have
    incorrect DECL_MODE etc., e.g. in the first case the var has SImode
    DECL_MODE (the guessed mode for the enum), but the enum then actually has
    DImode because its enumerators don't fit into unsigned int.

    The following patch fixes it by using C_TYPE_INCOMPLETE_VARS not just on
    incomplete struct/union types, but also incomplete enum types.
    TYPE_VFIELD can't be used as it is TYPE_MIN_VALUE on ENUMERAL_TYPE,
    thankfully TYPE_LANG_SLOT_1 has been used in the C FE only on
    FUNCTION_TYPEs.

    2020-03-17  Jakub Jelinek  <jakub@redhat.com>

            PR c/94172
            * c-tree.h (C_TYPE_INCOMPLETE_VARS): Define to TYPE_LANG_SLOT_1
            instead of TYPE_VFIELD, and support it on
{RECORD,UNION,ENUMERAL}_TYPE.
            (TYPE_ACTUAL_ARG_TYPES): Check that it is only used on
FUNCTION_TYPEs.
            * c-decl.c (pushdecl): Push C_TYPE_INCOMPLETE_VARS also to
            ENUMERAL_TYPEs.
            (finish_incomplete_vars): New function, moved from finish_struct. 
Use
            relayout_decl instead of layout_decl.
            (finish_struct): Remove obsolete comment about
C_TYPE_INCOMPLETE_VARS
            being TYPE_VFIELD.  Use finish_incomplete_vars.
            (finish_enum): Clear C_TYPE_INCOMPLETE_VARS.  Call
            finish_incomplete_vars.
            * c-typeck.c (c_build_qualified_type): Clear C_TYPE_INCOMPLETE_VARS
            also on ENUMERAL_TYPEs.

            * gcc.dg/pr94172-1.c: New test.
            * gcc.dg/pr94172-2.c: New test.

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

* [Bug c/94172] [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403
  2020-03-14  3:27 [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403 dtaubert at atmosic dot com
                   ` (9 preceding siblings ...)
  2020-03-17 21:33 ` cvs-commit at gcc dot gnu.org
@ 2020-03-18  7:55 ` jakub at gcc dot gnu.org
  2020-04-07 19:03 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-18  7:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.

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

* [Bug c/94172] [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403
  2020-03-14  3:27 [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403 dtaubert at atmosic dot com
                   ` (10 preceding siblings ...)
  2020-03-18  7:55 ` jakub at gcc dot gnu.org
@ 2020-04-07 19:03 ` cvs-commit at gcc dot gnu.org
  2020-09-17 14:25 ` cvs-commit at gcc dot gnu.org
  2020-09-17 17:19 ` jakub at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-07 19:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 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:87ce34fa00cd6b87452d747235da40dfe5b6e00f

commit r9-8463-g87ce34fa00cd6b87452d747235da40dfe5b6e00f
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Mar 17 22:32:34 2020 +0100

    c: Handle C_TYPE_INCOMPLETE_VARS even for ENUMERAL_TYPEs [PR94172]

    The following testcases ICE, because they contain extern variable
    declarations with incomplete enum types that is later completed and after
    that those variables are accessed.  The ICEs are because the vars then may
have
    incorrect DECL_MODE etc., e.g. in the first case the var has SImode
    DECL_MODE (the guessed mode for the enum), but the enum then actually has
    DImode because its enumerators don't fit into unsigned int.

    The following patch fixes it by using C_TYPE_INCOMPLETE_VARS not just on
    incomplete struct/union types, but also incomplete enum types.
    TYPE_VFIELD can't be used as it is TYPE_MIN_VALUE on ENUMERAL_TYPE,
    thankfully TYPE_LANG_SLOT_1 has been used in the C FE only on
    FUNCTION_TYPEs.

    2020-03-17  Jakub Jelinek  <jakub@redhat.com>

            PR c/94172
            * c-tree.h (C_TYPE_INCOMPLETE_VARS): Define to TYPE_LANG_SLOT_1
            instead of TYPE_VFIELD, and support it on
{RECORD,UNION,ENUMERAL}_TYPE.
            (TYPE_ACTUAL_ARG_TYPES): Check that it is only used on
FUNCTION_TYPEs.
            * c-decl.c (pushdecl): Push C_TYPE_INCOMPLETE_VARS also to
            ENUMERAL_TYPEs.
            (finish_incomplete_vars): New function, moved from finish_struct. 
Use
            relayout_decl instead of layout_decl.
            (finish_struct): Remove obsolete comment about
C_TYPE_INCOMPLETE_VARS
            being TYPE_VFIELD.  Use finish_incomplete_vars.
            (finish_enum): Clear C_TYPE_INCOMPLETE_VARS.  Call
            finish_incomplete_vars.
            * c-typeck.c (c_build_qualified_type): Clear C_TYPE_INCOMPLETE_VARS
            also on ENUMERAL_TYPEs.

            * gcc.dg/pr94172-1.c: New test.
            * gcc.dg/pr94172-2.c: New test.

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

* [Bug c/94172] [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403
  2020-03-14  3:27 [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403 dtaubert at atmosic dot com
                   ` (11 preceding siblings ...)
  2020-04-07 19:03 ` cvs-commit at gcc dot gnu.org
@ 2020-09-17 14:25 ` cvs-commit at gcc dot gnu.org
  2020-09-17 17:19 ` jakub at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-17 14:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r8-10470-gcac1949a51e25360a7fd7dc8f473997b7ca048a9
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Mar 17 22:32:34 2020 +0100

    c: Handle C_TYPE_INCOMPLETE_VARS even for ENUMERAL_TYPEs [PR94172]

    The following testcases ICE, because they contain extern variable
    declarations with incomplete enum types that is later completed and after
    that those variables are accessed.  The ICEs are because the vars then may
have
    incorrect DECL_MODE etc., e.g. in the first case the var has SImode
    DECL_MODE (the guessed mode for the enum), but the enum then actually has
    DImode because its enumerators don't fit into unsigned int.

    The following patch fixes it by using C_TYPE_INCOMPLETE_VARS not just on
    incomplete struct/union types, but also incomplete enum types.
    TYPE_VFIELD can't be used as it is TYPE_MIN_VALUE on ENUMERAL_TYPE,
    thankfully TYPE_LANG_SLOT_1 has been used in the C FE only on
    FUNCTION_TYPEs.

    2020-03-17  Jakub Jelinek  <jakub@redhat.com>

            PR c/94172
            * c-tree.h (C_TYPE_INCOMPLETE_VARS): Define to TYPE_LANG_SLOT_1
            instead of TYPE_VFIELD, and support it on
{RECORD,UNION,ENUMERAL}_TYPE.
            (TYPE_ACTUAL_ARG_TYPES): Check that it is only used on
FUNCTION_TYPEs.
            * c-decl.c (pushdecl): Push C_TYPE_INCOMPLETE_VARS also to
            ENUMERAL_TYPEs.
            (finish_incomplete_vars): New function, moved from finish_struct. 
Use
            relayout_decl instead of layout_decl.
            (finish_struct): Remove obsolete comment about
C_TYPE_INCOMPLETE_VARS
            being TYPE_VFIELD.  Use finish_incomplete_vars.
            (finish_enum): Clear C_TYPE_INCOMPLETE_VARS.  Call
            finish_incomplete_vars.
            * c-typeck.c (c_build_qualified_type): Clear C_TYPE_INCOMPLETE_VARS
            also on ENUMERAL_TYPEs.

            * gcc.dg/pr94172-1.c: New test.
            * gcc.dg/pr94172-2.c: New test.

    (cherry picked from commit 87ce34fa00cd6b87452d747235da40dfe5b6e00f)

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

* [Bug c/94172] [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403
  2020-03-14  3:27 [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403 dtaubert at atmosic dot com
                   ` (12 preceding siblings ...)
  2020-09-17 14:25 ` cvs-commit at gcc dot gnu.org
@ 2020-09-17 17:19 ` jakub at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-09-17 17:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 8.5 and 9.4+ too.

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

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

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-14  3:27 [Bug middle-end/94172] New: [arm-none-eabi] ICE in expand_debug_locations, at cfgexpand.c:5403 dtaubert at atmosic dot com
2020-03-14  3:46 ` [Bug middle-end/94172] " pinskia at gcc dot gnu.org
2020-03-16 15:55 ` wilco at gcc dot gnu.org
2020-03-16 16:25 ` jakub at gcc dot gnu.org
2020-03-16 16:30 ` rearnsha at gcc dot gnu.org
2020-03-16 16:34 ` jakub at gcc dot gnu.org
2020-03-16 16:35 ` wilco at gcc dot gnu.org
2020-03-16 16:39 ` tnfchris at gcc dot gnu.org
2020-03-16 16:46 ` jakub at gcc dot gnu.org
2020-03-16 18:21 ` [Bug c/94172] " jakub at gcc dot gnu.org
2020-03-17 21:33 ` cvs-commit at gcc dot gnu.org
2020-03-18  7:55 ` jakub at gcc dot gnu.org
2020-04-07 19:03 ` cvs-commit at gcc dot gnu.org
2020-09-17 14:25 ` cvs-commit at gcc dot gnu.org
2020-09-17 17:19 ` 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).