public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108043] New: [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer
@ 2022-12-10  3:54 zsojka at seznam dot cz
  2022-12-10  7:08 ` [Bug c/108043] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: zsojka at seznam dot cz @ 2022-12-10  3:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108043
           Summary: [13 Regression] ICE: in fold_convert_loc, at
                    fold-const.cc:2618 on invalid function braced
                    initializer
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu

Created attachment 54058
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54058&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc testcase.c 
testcase.c: In function 'foo':
testcase.c:6:3: internal compiler error: in fold_convert_loc, at
fold-const.cc:2618
    6 |   (F){};
      |   ^
0x6ef305 fold_convert_loc(unsigned int, tree_node*, tree_node*)
        /repo/gcc-trunk/gcc/fold-const.cc:2618
0xd58d59 pop_init_level(unsigned int, int, obstack*, unsigned int)
        /repo/gcc-trunk/gcc/c/c-typeck.cc:9371
0xd7d018 c_parser_braced_init
        /repo/gcc-trunk/gcc/c/c-parser.cc:5784
0xd7d383 c_parser_postfix_expression_after_paren_type
        /repo/gcc-trunk/gcc/c/c-parser.cc:10945
0xd77f70 c_parser_cast_expression
        /repo/gcc-trunk/gcc/c/c-parser.cc:8659
0xd77fef c_parser_binary_expression
        /repo/gcc-trunk/gcc/c/c-parser.cc:8449
0xd7944b c_parser_conditional_expression
        /repo/gcc-trunk/gcc/c/c-parser.cc:8147
0xd79c64 c_parser_expr_no_commas
        /repo/gcc-trunk/gcc/c/c-parser.cc:8061
0xd79f11 c_parser_expression
        /repo/gcc-trunk/gcc/c/c-parser.cc:11385
0xd7a657 c_parser_expression_conv
        /repo/gcc-trunk/gcc/c/c-parser.cc:11425
0xd6f1cf c_parser_statement_after_labels
        /repo/gcc-trunk/gcc/c/c-parser.cc:6790
0xd71714 c_parser_compound_statement_nostart
        /repo/gcc-trunk/gcc/c/c-parser.cc:6305
0xd96ec4 c_parser_compound_statement
        /repo/gcc-trunk/gcc/c/c-parser.cc:6114
0xd98ef8 c_parser_declaration_or_fndef
        /repo/gcc-trunk/gcc/c/c-parser.cc:2850
0xda07c3 c_parser_external_declaration
        /repo/gcc-trunk/gcc/c/c-parser.cc:1925
0xda11f3 c_parser_translation_unit
        /repo/gcc-trunk/gcc/c/c-parser.cc:1779
0xda11f3 c_parse_file()
        /repo/gcc-trunk/gcc/c/c-parser.cc:24596
0xe0d2b1 c_common_parse_file()
        /repo/gcc-trunk/gcc/c-family/c-opts.cc:1248
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r13-4583-20221209191939-g71b31d13757-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r13-4583-20221209191939-g71b31d13757-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20221209 (experimental) (GCC)

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

* [Bug c/108043] [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer
  2022-12-10  3:54 [Bug c/108043] New: [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer zsojka at seznam dot cz
@ 2022-12-10  7:08 ` pinskia at gcc dot gnu.org
  2022-12-10  7:13 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-10  7:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu.org
   Target Milestone|---                         |13.0

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

* [Bug c/108043] [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer
  2022-12-10  3:54 [Bug c/108043] New: [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer zsojka at seznam dot cz
  2022-12-10  7:08 ` [Bug c/108043] " pinskia at gcc dot gnu.org
@ 2022-12-10  7:13 ` pinskia at gcc dot gnu.org
  2022-12-11 13:12 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-10  7:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-12-10
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
Either introduced by:
r13-2205-g14cfa01755a66a
or
r13-3930-gb556d1773db717

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

* [Bug c/108043] [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer
  2022-12-10  3:54 [Bug c/108043] New: [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer zsojka at seznam dot cz
  2022-12-10  7:08 ` [Bug c/108043] " pinskia at gcc dot gnu.org
  2022-12-10  7:13 ` pinskia at gcc dot gnu.org
@ 2022-12-11 13:12 ` rguenth at gcc dot gnu.org
  2022-12-12 13:19 ` [Bug c/108043] [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer since r13-2205-g14cfa01755a66afb marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-12-11 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug c/108043] [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer since r13-2205-g14cfa01755a66afb
  2022-12-10  3:54 [Bug c/108043] New: [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2022-12-11 13:12 ` rguenth at gcc dot gnu.org
@ 2022-12-12 13:19 ` marxin at gcc dot gnu.org
  2022-12-13  1:37 ` joseph at codesourcery dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-12 13:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
            Summary|[13 Regression] ICE: in     |[13 Regression] ICE: in
                   |fold_convert_loc, at        |fold_convert_loc, at
                   |fold-const.cc:2618 on       |fold-const.cc:2618 on
                   |invalid function braced     |invalid function braced
                   |initializer                 |initializer since
                   |                            |r13-2205-g14cfa01755a66afb

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r13-2205-g14cfa01755a66afb.

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

* [Bug c/108043] [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer since r13-2205-g14cfa01755a66afb
  2022-12-10  3:54 [Bug c/108043] New: [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2022-12-12 13:19 ` [Bug c/108043] [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer since r13-2205-g14cfa01755a66afb marxin at gcc dot gnu.org
@ 2022-12-13  1:37 ` joseph at codesourcery dot com
  2022-12-16 12:23 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: joseph at codesourcery dot com @ 2022-12-13  1:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
Probably the same as bug 107682.

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

* [Bug c/108043] [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer since r13-2205-g14cfa01755a66afb
  2022-12-10  3:54 [Bug c/108043] New: [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2022-12-13  1:37 ` joseph at codesourcery dot com
@ 2022-12-16 12:23 ` jakub at gcc dot gnu.org
  2022-12-19 19:56 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-12-16 12:23 UTC (permalink / raw)
  To: gcc-bugs

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

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 #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54110
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54110&action=edit
gcc13-pr108043.patch

Untested fix.
Both C99 and C2X say for compound literals:
The type name shall specify an object type or an array of unknown size, but not
a variable length array type.
resp.
The type name shall specify a complete object type or an array of unknown size,
but not a variable length array type.
Before the recent changes it actually wasn't that important to diagnose
non-object type because the initializer had to be non-empty in that case and
there was no way to specify initializer expression of function type as it would
promote to function pointer type, so we'd error differently.
But when empty initializers are allowed, there is nothing to diagnose that.

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

* [Bug c/108043] [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer since r13-2205-g14cfa01755a66afb
  2022-12-10  3:54 [Bug c/108043] New: [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2022-12-16 12:23 ` jakub at gcc dot gnu.org
@ 2022-12-19 19:56 ` cvs-commit at gcc dot gnu.org
  2022-12-20 13:06 ` jakub at gcc dot gnu.org
  2022-12-20 16:50 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-19 19:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:4e4620d8c796af482b57b94932618d1f9d9af9f7

commit r13-4797-g4e4620d8c796af482b57b94932618d1f9d9af9f7
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Dec 19 20:55:56 2022 +0100

    c: Diagnose compound literals with function type [PR108043]

    Both C99 and latest C2X say that compound literal shall have an object type
    (complete object type in the latter case) or array of unknown bound,
    so complit with function type is invalid.  When the initializer had to be
    non-empty for such case, we used to diagnose it as incorrect initializer,
    but with (fntype){} now allowed we just ICE on it.

    The following patch diagnoses that.

    2022-12-19  Jakub Jelinek  <jakub@redhat.com>

            PR c/108043
            * c-parser.cc (c_parser_postfix_expression_after_paren_type):
Diagnose
            compound literals with function type.

            * gcc.dg/pr108043.c: New test.
            * gcc.dg/c99-complit-2.c (foo): Adjust expected diagnostics for
            complit with function type.

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

* [Bug c/108043] [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer since r13-2205-g14cfa01755a66afb
  2022-12-10  3:54 [Bug c/108043] New: [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2022-12-19 19:56 ` cvs-commit at gcc dot gnu.org
@ 2022-12-20 13:06 ` jakub at gcc dot gnu.org
  2022-12-20 16:50 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-12-20 13:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.  PR107682 is not though.

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

* [Bug c/108043] [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer since r13-2205-g14cfa01755a66afb
  2022-12-10  3:54 [Bug c/108043] New: [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer zsojka at seznam dot cz
                   ` (7 preceding siblings ...)
  2022-12-20 13:06 ` jakub at gcc dot gnu.org
@ 2022-12-20 16:50 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-12-20 16:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
.

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

end of thread, other threads:[~2022-12-20 16:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-10  3:54 [Bug c/108043] New: [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer zsojka at seznam dot cz
2022-12-10  7:08 ` [Bug c/108043] " pinskia at gcc dot gnu.org
2022-12-10  7:13 ` pinskia at gcc dot gnu.org
2022-12-11 13:12 ` rguenth at gcc dot gnu.org
2022-12-12 13:19 ` [Bug c/108043] [13 Regression] ICE: in fold_convert_loc, at fold-const.cc:2618 on invalid function braced initializer since r13-2205-g14cfa01755a66afb marxin at gcc dot gnu.org
2022-12-13  1:37 ` joseph at codesourcery dot com
2022-12-16 12:23 ` jakub at gcc dot gnu.org
2022-12-19 19:56 ` cvs-commit at gcc dot gnu.org
2022-12-20 13:06 ` jakub at gcc dot gnu.org
2022-12-20 16:50 ` 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).