public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/109409] New: [13 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777
@ 2023-04-04 16:09 gscfq@t-online.de
  2023-04-04 16:30 ` [Bug c/109409] " mpolacek at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gscfq@t-online.de @ 2023-04-04 16:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109409
           Summary: [13 Regression] ICE in check_format_arg, at
                    c-family/c-format.cc:1777
           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 -Wall :


$ cat z1.c
int g ();
void f (char *a)
{
  const char c[g()] = "1";
  __builtin_sprintf (a, c);
}


$ gcc-13-20230402 -c z1.c -Wall
z1.c: In function 'f':
z1.c:4:23: error: variable-sized object may not be initialized except with an
empty initializer
    4 |   const char c[g()] = "1";
      |                       ^~~
z1.c:5:3: internal compiler error: in check_format_arg, at
c-family/c-format.cc:1777
    5 |   __builtin_sprintf (a, c);
      |   ^~~~~~~~~~~~~~~~~
0x83216a check_format_arg
        ../../gcc/c-family/c-format.cc:1777
0x82d680 check_format_info
        ../../gcc/c-family/c-format.cc:1543
0x82d680 check_function_format(tree_node const*, tree_node*, int, tree_node**,
vec<unsigned int, va_heap, vl_ptr>*)
        ../../gcc/c-family/c-format.cc:1198
0x81a3e5 check_function_arguments(unsigned int, tree_node const*, tree_node
const*, int, tree_node**, vec<unsigned int, va_heap, vl_ptr>*)
        ../../gcc/c-family/c-common.cc:6093
0x775e4d build_function_call_vec(unsigned int, vec<unsigned int, va_heap,
vl_ptr>, tree_node*, vec<tree_node*, va_gc, vl_embed>*, vec<tree_node*, va_gc,
vl_embed>*, tree_node*)
        ../../gcc/c/c-typeck.cc:3309
0x7a6d01 c_parser_postfix_expression_after_primary
        ../../gcc/c/c-parser.cc:11239
0x79461d c_parser_postfix_expression
        ../../gcc/c/c-parser.cc:10846
0x7a17ba c_parser_unary_expression
        ../../gcc/c/c-parser.cc:8831
0x7a2b1f c_parser_cast_expression
        ../../gcc/c/c-parser.cc:8672
0x7a2e1b c_parser_binary_expression
        ../../gcc/c/c-parser.cc:8440
0x7a44eb c_parser_conditional_expression
        ../../gcc/c/c-parser.cc:8138
0x7a4d74 c_parser_expr_no_commas
        ../../gcc/c/c-parser.cc:8052
0x7a5022 c_parser_expression
        ../../gcc/c/c-parser.cc:11379
0x7a57db c_parser_expression_conv
        ../../gcc/c/c-parser.cc:11419
0x7c01f3 c_parser_statement_after_labels
        ../../gcc/c/c-parser.cc:6781
0x7c24db c_parser_compound_statement_nostart
        ../../gcc/c/c-parser.cc:6296
0x7c2d83 c_parser_compound_statement
        ../../gcc/c/c-parser.cc:6105
0x7c4d7f c_parser_declaration_or_fndef
        ../../gcc/c/c-parser.cc:2841
0x7cf0af c_parser_external_declaration
        ../../gcc/c/c-parser.cc:1925
0x7cf9ed c_parser_translation_unit
        ../../gcc/c/c-parser.cc:1779

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

* [Bug c/109409] [13 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777
  2023-04-04 16:09 [Bug c/109409] New: [13 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 gscfq@t-online.de
@ 2023-04-04 16:30 ` mpolacek at gcc dot gnu.org
  2023-04-04 20:45 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-04-04 16:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Priority|P3                          |P2
   Target Milestone|---                         |13.0
                 CC|                            |jsm28 at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2023-04-04
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r13-2205-g14cfa01755a66a:

commit 14cfa01755a66afbae2539f8b5796c960ddcecc6
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Thu Aug 25 21:02:57 2022 +0000

    c: Support C2x empty initializer braces

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

* [Bug c/109409] [13 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777
  2023-04-04 16:09 [Bug c/109409] New: [13 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 gscfq@t-online.de
  2023-04-04 16:30 ` [Bug c/109409] " mpolacek at gcc dot gnu.org
@ 2023-04-04 20:45 ` pinskia at gcc dot gnu.org
  2023-04-13 11:38 ` [Bug c/109409] [13 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 since r13-2205-g14cfa01755a66a jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-04 20:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
      /* Variable length arrays can't be initialized.  */
      gcc_assert (TREE_CODE (array_size) == INTEGER_CST);

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

* [Bug c/109409] [13 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 since r13-2205-g14cfa01755a66a
  2023-04-04 16:09 [Bug c/109409] New: [13 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 gscfq@t-online.de
  2023-04-04 16:30 ` [Bug c/109409] " mpolacek at gcc dot gnu.org
  2023-04-04 20:45 ` pinskia at gcc dot gnu.org
@ 2023-04-13 11:38 ` jakub at gcc dot gnu.org
  2023-04-26  6:58 ` [Bug c/109409] [13/14 " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-04-13 11:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

Untested fix.

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

* [Bug c/109409] [13/14 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 since r13-2205-g14cfa01755a66a
  2023-04-04 16:09 [Bug c/109409] New: [13 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2023-04-13 11:38 ` [Bug c/109409] [13 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 since r13-2205-g14cfa01755a66a jakub at gcc dot gnu.org
@ 2023-04-26  6:58 ` rguenth at gcc dot gnu.org
  2023-04-27  9:37 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-26  6:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.0                        |13.2

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.1 is being released, retargeting bugs to GCC 13.2.

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

* [Bug c/109409] [13/14 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 since r13-2205-g14cfa01755a66a
  2023-04-04 16:09 [Bug c/109409] New: [13 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2023-04-26  6:58 ` [Bug c/109409] [13/14 " rguenth at gcc dot gnu.org
@ 2023-04-27  9:37 ` cvs-commit at gcc dot gnu.org
  2023-04-27  9:42 ` cvs-commit at gcc dot gnu.org
  2023-04-27  9:43 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-27  9:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:d8842271ebf9a81128df9ae80e1d3b688749eac8

commit r14-288-gd8842271ebf9a81128df9ae80e1d3b688749eac8
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Apr 27 11:36:54 2023 +0200

    c: Fix up error-recovery on non-empty VLA initializers [PR109409]

    On the following testcase we ICE, because after we emit the
    variable-sized object may not be initialized except with an empty
initializer
    error we don't really reset the initializer to error_mark_node and then at
    -Wformat checking time we ICE on seeing STRING_CST initializer for a VLA.

    The following patch just arranges for error_mark_node to be returned after
    the error diagnostics.

    2023-04-27  Jakub Jelinek  <jakub@redhat.com>

            PR c/109409
            * c-parser.cc (c_parser_initializer): Move diagnostics about
            initialization of variable sized object with non-empty initializer
            after c_parser_expr_no_commas call and ret.set_error (); after it.

            * gcc.dg/pr109409.c: New test.

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

* [Bug c/109409] [13/14 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 since r13-2205-g14cfa01755a66a
  2023-04-04 16:09 [Bug c/109409] New: [13 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2023-04-27  9:37 ` cvs-commit at gcc dot gnu.org
@ 2023-04-27  9:42 ` cvs-commit at gcc dot gnu.org
  2023-04-27  9:43 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-27  9:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:297d0efc13d73d36371583c2d6d6e7a47f88cd02

commit r13-7258-g297d0efc13d73d36371583c2d6d6e7a47f88cd02
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Apr 27 11:36:54 2023 +0200

    c: Fix up error-recovery on non-empty VLA initializers [PR109409]

    On the following testcase we ICE, because after we emit the
    variable-sized object may not be initialized except with an empty
initializer
    error we don't really reset the initializer to error_mark_node and then at
    -Wformat checking time we ICE on seeing STRING_CST initializer for a VLA.

    The following patch just arranges for error_mark_node to be returned after
    the error diagnostics.

    2023-04-27  Jakub Jelinek  <jakub@redhat.com>

            PR c/109409
            * c-parser.cc (c_parser_initializer): Move diagnostics about
            initialization of variable sized object with non-empty initializer
            after c_parser_expr_no_commas call and ret.set_error (); after it.

            * gcc.dg/pr109409.c: New test.

    (cherry picked from commit d8842271ebf9a81128df9ae80e1d3b688749eac8)

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

* [Bug c/109409] [13/14 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 since r13-2205-g14cfa01755a66a
  2023-04-04 16:09 [Bug c/109409] New: [13 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2023-04-27  9:42 ` cvs-commit at gcc dot gnu.org
@ 2023-04-27  9:43 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-04-27  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2023-04-27  9:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-04 16:09 [Bug c/109409] New: [13 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 gscfq@t-online.de
2023-04-04 16:30 ` [Bug c/109409] " mpolacek at gcc dot gnu.org
2023-04-04 20:45 ` pinskia at gcc dot gnu.org
2023-04-13 11:38 ` [Bug c/109409] [13 Regression] ICE in check_format_arg, at c-family/c-format.cc:1777 since r13-2205-g14cfa01755a66a jakub at gcc dot gnu.org
2023-04-26  6:58 ` [Bug c/109409] [13/14 " rguenth at gcc dot gnu.org
2023-04-27  9:37 ` cvs-commit at gcc dot gnu.org
2023-04-27  9:42 ` cvs-commit at gcc dot gnu.org
2023-04-27  9:43 ` 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).