public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108424] New: [13 Regression] ICE in perform_integral_promotions, at c/c-typeck.cc:2277
@ 2023-01-16 17:52 gscfq@t-online.de
  2023-01-16 18:13 ` [Bug c/108424] ICE in perform_integral_promotions with nullptr case and switch on int type pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gscfq@t-online.de @ 2023-01-16 17:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108424
           Summary: [13 Regression] ICE in perform_integral_promotions, at
                    c/c-typeck.cc:2277
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started between 20220821 and 20220828, with -std=c2x :


$ cat z1.c
void f (int n)
{
  switch (n) {
  case nullptr:
  default:
  }
}


$ cat z2.c
void f (int n)
{
  switch (n) {
  case nullptr:
  case 1:
  }
  return;
}


$ gcc-13-20230115 -c z1.c -std=c2x
z1.c: In function 'f':
z1.c:4:3: internal compiler error: in perform_integral_promotions, at
c/c-typeck.cc:2277
    4 |   case nullptr:
      |   ^~~~
0x795f60 perform_integral_promotions(tree_node*)
        ../../gcc/c/c-typeck.cc:2277
0x7f1987 check_case_value
        ../../gcc/c-family/c-common.cc:2243
0x8269fd c_add_case_label(unsigned int, splay_tree_s*, tree_node*, tree_node*,
tree_node*, tree_node*)
        ../../gcc/c-family/c-common.cc:5092
0x798436 do_case(unsigned int, tree_node*, tree_node*, tree_node*)
        ../../gcc/c/c-typeck.cc:11561
0x7d3ab6 c_parser_label
        ../../gcc/c/c-parser.cc:6394
0x7de9f5 c_parser_compound_statement_nostart
        ../../gcc/c/c-parser.cc:6207
0x7def03 c_parser_compound_statement
        ../../gcc/c/c-parser.cc:6117
0x7dc522 c_parser_statement_after_labels
        ../../gcc/c/c-parser.cc:6628
0x7e28e2 c_parser_statement
        ../../gcc/c/c-parser.cc:6599
0x7e28e2 c_parser_c99_block_statement
        ../../gcc/c/c-parser.cc:6858
0x7dca53 c_parser_switch_statement
        ../../gcc/c/c-parser.cc:7120
0x7dca53 c_parser_statement_after_labels
        ../../gcc/c/c-parser.cc:6637
0x7de68a c_parser_compound_statement_nostart
        ../../gcc/c/c-parser.cc:6308
0x7def03 c_parser_compound_statement
        ../../gcc/c/c-parser.cc:6117
0x7e0f13 c_parser_declaration_or_fndef
        ../../gcc/c/c-parser.cc:2853
0x7e869f c_parser_external_declaration
        ../../gcc/c/c-parser.cc:1925
0x7e8fdd c_parser_translation_unit
        ../../gcc/c/c-parser.cc:1779
0x7e8fdd c_parse_file()
        ../../gcc/c/c-parser.cc:24602
0x847651 c_common_parse_file()
        ../../gcc/c-family/c-opts.cc:1248

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

* [Bug c/108424] ICE in perform_integral_promotions with nullptr case and switch on int type
  2023-01-16 17:52 [Bug c/108424] New: [13 Regression] ICE in perform_integral_promotions, at c/c-typeck.cc:2277 gscfq@t-online.de
@ 2023-01-16 18:13 ` pinskia at gcc dot gnu.org
  2023-01-16 18:18 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-16 18:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |ice-on-invalid-code
     Ever confirmed|0                           |1
            Summary|[13 Regression] ICE in      |ICE in
                   |perform_integral_promotions |perform_integral_promotions
                   |, at c/c-typeck.cc:2277     |with nullptr case and
                   |                            |switch on int type
   Last reconfirmed|                            |2023-01-16

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The ICE showed up when nullptr support was added in r13-2206-g60d84e82639e25 .

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

* [Bug c/108424] ICE in perform_integral_promotions with nullptr case and switch on int type
  2023-01-16 17:52 [Bug c/108424] New: [13 Regression] ICE in perform_integral_promotions, at c/c-typeck.cc:2277 gscfq@t-online.de
  2023-01-16 18:13 ` [Bug c/108424] ICE in perform_integral_promotions with nullptr case and switch on int type pinskia at gcc dot gnu.org
@ 2023-01-16 18:18 ` mpolacek at gcc dot gnu.org
  2023-01-18 21:50 ` cvs-commit at gcc dot gnu.org
  2023-01-18 21:51 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-01-16 18:18 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Mine then.

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

* [Bug c/108424] ICE in perform_integral_promotions with nullptr case and switch on int type
  2023-01-16 17:52 [Bug c/108424] New: [13 Regression] ICE in perform_integral_promotions, at c/c-typeck.cc:2277 gscfq@t-online.de
  2023-01-16 18:13 ` [Bug c/108424] ICE in perform_integral_promotions with nullptr case and switch on int type pinskia at gcc dot gnu.org
  2023-01-16 18:18 ` mpolacek at gcc dot gnu.org
@ 2023-01-18 21:50 ` cvs-commit at gcc dot gnu.org
  2023-01-18 21:51 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-18 21:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

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

commit r13-5249-g0f85ae6591c92b161693073c0931c7ca1d5d0c5a
Author: Marek Polacek <polacek@redhat.com>
Date:   Wed Jan 18 14:51:59 2023 -0500

    c: ICE with nullptr as case expression [PR108424]

    In this ICE-on-invalid, we crash on

      gcc_assert (INTEGRAL_TYPE_P (type));

    in perform_integral_promotions, because a nullptr is an INTEGER_CST,
    but not INTEGRAL_TYPE_P, and check_case_value is only checking the
    former.  In the test I'm testing other "shall be an integral constant
    expression" contexts as well.

            PR c/108424

    gcc/c-family/ChangeLog:

            * c-common.cc (check_case_value): Check INTEGRAL_TYPE_P.

    gcc/testsuite/ChangeLog:

            * gcc.dg/c2x-nullptr-6.c: New test.

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

* [Bug c/108424] ICE in perform_integral_promotions with nullptr case and switch on int type
  2023-01-16 17:52 [Bug c/108424] New: [13 Regression] ICE in perform_integral_promotions, at c/c-typeck.cc:2277 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2023-01-18 21:50 ` cvs-commit at gcc dot gnu.org
@ 2023-01-18 21:51 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-01-18 21:51 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2023-01-18 21:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-16 17:52 [Bug c/108424] New: [13 Regression] ICE in perform_integral_promotions, at c/c-typeck.cc:2277 gscfq@t-online.de
2023-01-16 18:13 ` [Bug c/108424] ICE in perform_integral_promotions with nullptr case and switch on int type pinskia at gcc dot gnu.org
2023-01-16 18:18 ` mpolacek at gcc dot gnu.org
2023-01-18 21:50 ` cvs-commit at gcc dot gnu.org
2023-01-18 21:51 ` mpolacek 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).