public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/101364] New: [12 Regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278
@ 2021-07-07 14:08 anbu1024.me at gmail dot com
  2021-07-07 21:45 ` [Bug c/101364] " msebor at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: anbu1024.me at gmail dot com @ 2021-07-07 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101364
           Summary: [12 Regression] ICE: tree check: expected class
                    ‘type’, have ‘exceptional’ (error_mark) in
                    c_type_promotes_to, at c/c-typeck.c:278
           Product: gcc
           Version: 12.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 

void fruit();

struct Apple{
  int apple[4];
};

void fruit(
    struct Apple a,
    int b[x],
    unsigned char c)
{
  return 0;
}

================================

$ gcc-sp12 --version 
gcc (GCC) 12.0.0 20210704 (experimental)
Copyright (C) 2021 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-sp12 test.c 
test.c:10:11: error: ‘x’ undeclared here (not in a function)
   10 |     int b[x],
      |           ^
test.c:8:6: error: conflicting types for ‘fruit’; have ‘void(struct Apple, 
<type-error>,  unsigned char)’
    8 | void fruit(
      |      ^~~~~
test.c:12:1: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278
   12 | {
      | ^
0x7ad81c tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc-12-20210704/gcc/tree.c:8734
0x668e82 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        ../../gcc-12-20210704/gcc/tree.h:3496
0x668e82 c_type_promotes_to(tree_node*)
        ../../gcc-12-20210704/gcc/c/c-typeck.c:278
0x874d07 diagnose_arglist_conflict
        ../../gcc-12-20210704/gcc/c/c-decl.c:1826
0x874d07 diagnose_mismatched_decls
        ../../gcc-12-20210704/gcc/c/c-decl.c:2134
0x8767e4 duplicate_decls
        ../../gcc-12-20210704/gcc/c/c-decl.c:2956
0x8791a9 pushdecl(tree_node*)
        ../../gcc-12-20210704/gcc/c/c-decl.c:3149
0x88c359 start_function(c_declspecs*, c_declarator*, tree_node*)
        ../../gcc-12-20210704/gcc/c/c-decl.c:9642
0x8ea09e c_parser_declaration_or_fndef
        ../../gcc-12-20210704/gcc/c/c-parser.c:2440
0x8f2983 c_parser_external_declaration
        ../../gcc-12-20210704/gcc/c/c-parser.c:1777
0x8f33c9 c_parser_translation_unit
        ../../gcc-12-20210704/gcc/c/c-parser.c:1650
0x8f33c9 c_parse_file()
        ../../gcc-12-20210704/gcc/c/c-parser.c:22121
0x952ead c_common_parse_file()
        ../../gcc-12-20210704/gcc/c-family/c-opts.c:1219
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-sp11 --version
gcc (GCC) 11.1.1 20210703
Copyright (C) 2021 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-sp11 test.c 
test.c:10:11: error: ‘x’ undeclared here (not in a function)
   10 |     int b[x],
      |           ^
test.c:8:6: error: conflicting types for ‘fruit’; have ‘void(struct Apple, 
<type-error>,  unsigned char)’
    8 | void fruit(
      |      ^~~~~
test.c:12:1: note: an argument type that has a default promotion cannot match
an empty parameter name list declaration
   12 | {
      | ^
test.c:2:6: note: previous declaration of ‘fruit’ with type ‘void()’
    2 | void fruit();
      |      ^~~~~
test.c: In function ‘fruit’:
test.c:13:10: warning: ‘return’ with a value, in function returning void
   13 |   return 0;
      |          ^
test.c:8:6: note: declared here
    8 | void fruit(
      |      ^~~~~

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

* [Bug c/101364] [12 Regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278
  2021-07-07 14:08 [Bug c/101364] New: [12 Regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278 anbu1024.me at gmail dot com
@ 2021-07-07 21:45 ` msebor at gcc dot gnu.org
  2022-11-15 19:39 ` [Bug c/101364] " pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-07-07 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-07-07
     Ever confirmed|0                           |1
           Keywords|                            |error-recovery,
                   |                            |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.  Doesn't appear to be a regression (ICEs all the way to 4.1).

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

* [Bug c/101364] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278
  2021-07-07 14:08 [Bug c/101364] New: [12 Regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278 anbu1024.me at gmail dot com
  2021-07-07 21:45 ` [Bug c/101364] " msebor at gcc dot gnu.org
@ 2022-11-15 19:39 ` pinskia at gcc dot gnu.org
  2023-10-14 20:30 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-15 19:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
             Status|NEW                         |ASSIGNED
           Keywords|                            |ice-checking

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

* [Bug c/101364] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278
  2021-07-07 14:08 [Bug c/101364] New: [12 Regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278 anbu1024.me at gmail dot com
  2021-07-07 21:45 ` [Bug c/101364] " msebor at gcc dot gnu.org
  2022-11-15 19:39 ` [Bug c/101364] " pinskia at gcc dot gnu.org
@ 2023-10-14 20:30 ` pinskia at gcc dot gnu.org
  2023-10-14 21:24 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-14 20:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
void fruit();
void fruit(
    int b[x],
    short c)
{}
```

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

* [Bug c/101364] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278
  2021-07-07 14:08 [Bug c/101364] New: [12 Regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278 anbu1024.me at gmail dot com
                   ` (2 preceding siblings ...)
  2023-10-14 20:30 ` pinskia at gcc dot gnu.org
@ 2023-10-14 21:24 ` pinskia at gcc dot gnu.org
  2023-10-15  1:17 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-14 21:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 56112
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56112&action=edit
Patch which I am testing

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

* [Bug c/101364] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278
  2021-07-07 14:08 [Bug c/101364] New: [12 Regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278 anbu1024.me at gmail dot com
                   ` (3 preceding siblings ...)
  2023-10-14 21:24 ` pinskia at gcc dot gnu.org
@ 2023-10-15  1:17 ` pinskia at gcc dot gnu.org
  2023-10-18 22:35 ` cvs-commit at gcc dot gnu.org
  2023-10-18 22:36 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-15  1:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2023-October
                   |                            |/633012.html
           Keywords|                            |patch

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2023-October/633012.html

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

* [Bug c/101364] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278
  2021-07-07 14:08 [Bug c/101364] New: [12 Regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278 anbu1024.me at gmail dot com
                   ` (4 preceding siblings ...)
  2023-10-15  1:17 ` pinskia at gcc dot gnu.org
@ 2023-10-18 22:35 ` cvs-commit at gcc dot gnu.org
  2023-10-18 22:36 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-18 22:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:879c91fcccf93681bd7e13290bfbb384cadcd268

commit r14-4728-g879c91fcccf93681bd7e13290bfbb384cadcd268
Author: Andrew Pinski <pinskia@gmail.com>
Date:   Sat Oct 14 13:40:05 2023 -0700

    [c] Fix PR 101364: ICE after error due to diagnose_arglist_conflict not
checking for error

    When checking to see if we have a function declaration has a conflict due
to
    promotations, there is no test to see if the type was an error mark and
then calls
    c_type_promotes_to. c_type_promotes_to is not ready for error_mark and
causes an
    ICE.

    This adds a check for error before the call of c_type_promotes_to.

    OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

            PR c/101364

    gcc/c/ChangeLog:

            * c-decl.cc (diagnose_arglist_conflict): Test for
            error mark before calling of c_type_promotes_to.

    gcc/testsuite/ChangeLog:

            * gcc.dg/pr101364-1.c: New test.

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

* [Bug c/101364] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278
  2021-07-07 14:08 [Bug c/101364] New: [12 Regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278 anbu1024.me at gmail dot com
                   ` (5 preceding siblings ...)
  2023-10-18 22:35 ` cvs-commit at gcc dot gnu.org
@ 2023-10-18 22:36 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-18 22:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|---                         |14.0
         Resolution|---                         |FIXED

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2023-10-18 22:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 14:08 [Bug c/101364] New: [12 Regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278 anbu1024.me at gmail dot com
2021-07-07 21:45 ` [Bug c/101364] " msebor at gcc dot gnu.org
2022-11-15 19:39 ` [Bug c/101364] " pinskia at gcc dot gnu.org
2023-10-14 20:30 ` pinskia at gcc dot gnu.org
2023-10-14 21:24 ` pinskia at gcc dot gnu.org
2023-10-15  1:17 ` pinskia at gcc dot gnu.org
2023-10-18 22:35 ` cvs-commit at gcc dot gnu.org
2023-10-18 22:36 ` pinskia 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).