public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/98198] New: [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs
@ 2020-12-08 12:28 anbu1024.me at gmail dot com
  2020-12-08 12:31 ` [Bug c/98198] " rguenth at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: anbu1024.me at gmail dot com @ 2020-12-08 12:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98198
           Summary: [11 Regression] internal compiler error: tree check:
                    expected class ‘type’, have ‘exceptional’ (error_mark)
                    in decl_or_type_attrs
           Product: gcc
           Version: 11.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-6951.c 

static inline void sub_1 ( ) { 
        struct struct_1 var_9 , var_10
}

static int var_9[1] __attribute__ ( ( section ( ".data" ) ) ) ; 

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

$ gcc-11 --version
gcc (GCC) 11.0.0 20201129 (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-11 test-6951.c 
test-6951.c: In function ‘sub_1’:
test-6951.c:3:25: error: storage size of ‘var_9’ isn’t known
    3 |         struct struct_1 var_9 , var_10
      |                         ^~~~~
test-6951.c:4:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
‘}’ token
    4 | }
      | ^
test-6951.c:6:1: internal compiler error: tree check: expected class ‘type’,
have ‘exceptional’ (error_mark) in decl_or_type_attrs, at
c-family/c-attribs.c:775
    6 | static int var_9[1] __attribute__ ( ( section ( ".data" ) ) ) ;
      | ^~~~~~
0x753c11 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc-11-20201129/gcc/tree.c:9860
0x642f30 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        ../../gcc-11-20201129/gcc/tree.h:3454
0x642f30 decl_or_type_attrs
        ../../gcc-11-20201129/gcc/c-family/c-attribs.c:775
0x642f30 validate_attr_args
        ../../gcc-11-20201129/gcc/c-family/c-attribs.c:803
0x90691d validate_attr_arg
        ../../gcc-11-20201129/gcc/c-family/c-attribs.c:889
0x90691d handle_section_attribute
        ../../gcc-11-20201129/gcc/c-family/c-attribs.c:2132
0x80d0dc decl_attributes(tree_node**, tree_node*, int, tree_node*)
        ../../gcc-11-20201129/gcc/attribs.c:723
0x8295f2 start_decl(c_declarator*, c_declspecs*, bool, tree_node*, unsigned
int*)
        ../../gcc-11-20201129/gcc/c/c-decl.c:5188
0x884e32 c_parser_declaration_or_fndef
        ../../gcc-11-20201129/gcc/c/c-parser.c:2302
0x867ef0 c_parser_compound_statement_nostart
        ../../gcc-11-20201129/gcc/c/c-parser.c:5700
0x8848f5 c_parser_compound_statement
        ../../gcc-11-20201129/gcc/c/c-parser.c:5597
0x886378 c_parser_declaration_or_fndef
        ../../gcc-11-20201129/gcc/c/c-parser.c:2539
0x88dbe3 c_parser_external_declaration
        ../../gcc-11-20201129/gcc/c/c-parser.c:1777
0x88e629 c_parser_translation_unit
        ../../gcc-11-20201129/gcc/c/c-parser.c:1650
0x88e629 c_parse_file()
        ../../gcc-11-20201129/gcc/c/c-parser.c:21877
0x8ebdfd c_common_parse_file()
        ../../gcc-11-20201129/gcc/c-family/c-opts.c:1198
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-10 --version
gcc (GCC) 10.2.1 20201128
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-6951.c 
test-6951.c: In function ‘sub_1’:
test-6951.c:3:18: error: storage size of ‘var_9’ isn’t known
    3 |  struct struct_1 var_9 , var_10
      |                  ^~~~~
test-6951.c:4:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
‘}’ token
    4 | }
      | ^
test-6951.c:6:1: error: expected declaration or statement at end of input
    6 | static int var_9[1] __attribute__ ( ( section ( ".data" ) ) ) ;
      | ^~~~~~

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

* [Bug c/98198] [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs
  2020-12-08 12:28 [Bug c/98198] New: [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs anbu1024.me at gmail dot com
@ 2020-12-08 12:31 ` rguenth at gcc dot gnu.org
  2020-12-08 19:57 ` marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-12-08 12:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery,
                   |                            |ice-on-invalid-code
   Target Milestone|---                         |11.0

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

* [Bug c/98198] [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs
  2020-12-08 12:28 [Bug c/98198] New: [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs anbu1024.me at gmail dot com
  2020-12-08 12:31 ` [Bug c/98198] " rguenth at gcc dot gnu.org
@ 2020-12-08 19:57 ` marxin at gcc dot gnu.org
  2020-12-08 20:28 ` clyon at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-12-08 19:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-12-08
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |clyon at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r10-2526-gf0033821c1c9ba38.

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

* [Bug c/98198] [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs
  2020-12-08 12:28 [Bug c/98198] New: [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs anbu1024.me at gmail dot com
  2020-12-08 12:31 ` [Bug c/98198] " rguenth at gcc dot gnu.org
  2020-12-08 19:57 ` marxin at gcc dot gnu.org
@ 2020-12-08 20:28 ` clyon at gcc dot gnu.org
  2020-12-08 20:31 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: clyon at gcc dot gnu.org @ 2020-12-08 20:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Christophe Lyon <clyon at gcc dot gnu.org> ---
Can you check with gcc trunk?
There were recent fixes in the handling of noinit/persistent attribute:
g:762ca20364a590be2cb9c79c0101ccbff74b5de1

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

* [Bug c/98198] [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs
  2020-12-08 12:28 [Bug c/98198] New: [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs anbu1024.me at gmail dot com
                   ` (2 preceding siblings ...)
  2020-12-08 20:28 ` clyon at gcc dot gnu.org
@ 2020-12-08 20:31 ` marxin at gcc dot gnu.org
  2020-12-08 23:13 ` clyon at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-12-08 20:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
The current master is still affected.

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

* [Bug c/98198] [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs
  2020-12-08 12:28 [Bug c/98198] New: [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs anbu1024.me at gmail dot com
                   ` (3 preceding siblings ...)
  2020-12-08 20:31 ` marxin at gcc dot gnu.org
@ 2020-12-08 23:13 ` clyon at gcc dot gnu.org
  2021-01-14 11:02 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: clyon at gcc dot gnu.org @ 2020-12-08 23:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Christophe Lyon <clyon at gcc dot gnu.org> ---
This simple patch avoids the ICE:

diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index 1d2ab7c..8847932 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -767,6 +767,10 @@ decl_or_type_attrs (tree node)
        return attrs;

       tree type = TREE_TYPE (node);
+
+      if (type == error_mark_node)
+       return NULL_TREE;
+
       return TYPE_ATTRIBUTES (type);
     }

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

* [Bug c/98198] [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs
  2020-12-08 12:28 [Bug c/98198] New: [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs anbu1024.me at gmail dot com
                   ` (4 preceding siblings ...)
  2020-12-08 23:13 ` clyon at gcc dot gnu.org
@ 2021-01-14 11:02 ` rguenth at gcc dot gnu.org
  2021-04-27 11:39 ` [Bug c/98198] [11/12 " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-14 11:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4

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

* [Bug c/98198] [11/12 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs
  2020-12-08 12:28 [Bug c/98198] New: [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs anbu1024.me at gmail dot com
                   ` (5 preceding siblings ...)
  2021-01-14 11:02 ` rguenth at gcc dot gnu.org
@ 2021-04-27 11:39 ` jakub at gcc dot gnu.org
  2021-07-28  7:05 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-27 11:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.0                        |11.2

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.1 has been released, retargeting bugs to GCC 11.2.

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

* [Bug c/98198] [11/12 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs
  2020-12-08 12:28 [Bug c/98198] New: [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs anbu1024.me at gmail dot com
                   ` (6 preceding siblings ...)
  2021-04-27 11:39 ` [Bug c/98198] [11/12 " jakub at gcc dot gnu.org
@ 2021-07-28  7:05 ` rguenth at gcc dot gnu.org
  2022-03-16 23:21 ` cvs-commit at gcc dot gnu.org
  2022-03-17 15:15 ` roger at nextmovesoftware dot com
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-28  7:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.2                        |11.3

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.2 is being released, retargeting bugs to GCC 11.3

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

* [Bug c/98198] [11/12 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs
  2020-12-08 12:28 [Bug c/98198] New: [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs anbu1024.me at gmail dot com
                   ` (7 preceding siblings ...)
  2021-07-28  7:05 ` rguenth at gcc dot gnu.org
@ 2022-03-16 23:21 ` cvs-commit at gcc dot gnu.org
  2022-03-17 15:15 ` roger at nextmovesoftware dot com
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-16 23:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 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:4565a07a646949e6ce30a08c60484afe1fed0ac1

commit r12-7681-g4565a07a646949e6ce30a08c60484afe1fed0ac1
Author: Roger Sayle <roger@nextmovesoftware.com>
Date:   Wed Mar 16 23:20:34 2022 +0000

    PR c/98198: ICE-on-invalid-code error recovery.

    This is Christophe Lyon's fix to PR c/98198, an ICE-on-invalid-code
    regression affecting mainline, and a suitable testcase.
    Tested on x86_64-pc-linux-gnu with make bootstrap and make -k check
    with no new failures.  Ok for mainline?

    2022-03-16  Christophe Lyon  <christophe.lyon@arm.com>
                Roger Sayle  <roger@nextmovesoftware.com>

    gcc/c-family/ChangeLog
            PR c/98198
            * c-attribs.cc (decl_or_type_attrs): Add error_mark_node check.

    gcc/testsuite/ChangeLog
            PR c/98198
            * gcc.dg/pr98198.c: New test case.

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

* [Bug c/98198] [11/12 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs
  2020-12-08 12:28 [Bug c/98198] New: [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs anbu1024.me at gmail dot com
                   ` (8 preceding siblings ...)
  2022-03-16 23:21 ` cvs-commit at gcc dot gnu.org
@ 2022-03-17 15:15 ` roger at nextmovesoftware dot com
  9 siblings, 0 replies; 11+ messages in thread
From: roger at nextmovesoftware dot com @ 2022-03-17 15:15 UTC (permalink / raw)
  To: gcc-bugs

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

Roger Sayle <roger at nextmovesoftware dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.3                        |12.0
                 CC|                            |roger at nextmovesoftware dot com
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #8 from Roger Sayle <roger at nextmovesoftware dot com> ---
This has now been fixed on mainline.

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

end of thread, other threads:[~2022-03-17 15:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 12:28 [Bug c/98198] New: [11 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs anbu1024.me at gmail dot com
2020-12-08 12:31 ` [Bug c/98198] " rguenth at gcc dot gnu.org
2020-12-08 19:57 ` marxin at gcc dot gnu.org
2020-12-08 20:28 ` clyon at gcc dot gnu.org
2020-12-08 20:31 ` marxin at gcc dot gnu.org
2020-12-08 23:13 ` clyon at gcc dot gnu.org
2021-01-14 11:02 ` rguenth at gcc dot gnu.org
2021-04-27 11:39 ` [Bug c/98198] [11/12 " jakub at gcc dot gnu.org
2021-07-28  7:05 ` rguenth at gcc dot gnu.org
2022-03-16 23:21 ` cvs-commit at gcc dot gnu.org
2022-03-17 15:15 ` roger at nextmovesoftware dot com

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).