public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/109412] New: [13 Regression] ICE in fold_convert_loc, at fold-const.cc:2627
@ 2023-04-04 16:12 gscfq@t-online.de
  2023-04-04 16:39 ` [Bug c/109412] " mpolacek at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: gscfq@t-online.de @ 2023-04-04 16:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109412
           Summary: [13 Regression] ICE in fold_convert_loc, at
                    fold-const.cc:2627
           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 :
(derived from c-c++-common/ubsan/bounds-21.c)


$ cat z1.c
int i;
int foo (void) { return ++i; }
int
main ()
{
  char a() = {};
  a[foo ()] = a[foo()] | 'a';
  if (i != 2)
    __builtin_abort ();
  a[foo()] |= 'a';
  if (i != 3)
    __builtin_abort ();
}


$ gcc-13-20230402 -c z1.c
z1.c: In function 'main':
z1.c:6:3: error: function 'a' is initialized like a variable
    6 |   char a() = {};
      |   ^~~~
z1.c:6:3: internal compiler error: in fold_convert_loc, at fold-const.cc:2627
0xa76ede fold_convert_loc(unsigned int, tree_node*, tree_node*)
        ../../gcc/fold-const.cc:2627
0x7741de pop_init_level(unsigned int, int, obstack*, unsigned int)
        ../../gcc/c/c-typeck.cc:9382
0x7a7f8e c_parser_braced_init
        ../../gcc/c/c-parser.cc:5775
0x7a9651 c_parser_initializer
        ../../gcc/c/c-parser.cc:5675
0x7c3ec8 c_parser_declaration_or_fndef
        ../../gcc/c/c-parser.cc:2564
0x7c293b c_parser_compound_statement_nostart
        ../../gcc/c/c-parser.cc:6208
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
0x7cf9ed c_parse_file()
        ../../gcc/c/c-parser.cc:24632
0x84a4e1 c_common_parse_file()
        ../../gcc/c-family/c-opts.cc:1248

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

* [Bug c/109412] [13 Regression] ICE in fold_convert_loc, at fold-const.cc:2627
  2023-04-04 16:12 [Bug c/109412] New: [13 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 gscfq@t-online.de
@ 2023-04-04 16:39 ` mpolacek at gcc dot gnu.org
  2023-04-04 17:19 ` joseph at codesourcery dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-04-04 16:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- 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] 9+ messages in thread

* [Bug c/109412] [13 Regression] ICE in fold_convert_loc, at fold-const.cc:2627
  2023-04-04 16:12 [Bug c/109412] New: [13 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 gscfq@t-online.de
  2023-04-04 16:39 ` [Bug c/109412] " mpolacek at gcc dot gnu.org
@ 2023-04-04 17:19 ` joseph at codesourcery dot com
  2023-04-13 10:29 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: joseph at codesourcery dot com @ 2023-04-04 17:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
May be related to bug 107682.

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

* [Bug c/109412] [13 Regression] ICE in fold_convert_loc, at fold-const.cc:2627
  2023-04-04 16:12 [Bug c/109412] New: [13 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 gscfq@t-online.de
  2023-04-04 16:39 ` [Bug c/109412] " mpolacek at gcc dot gnu.org
  2023-04-04 17:19 ` joseph at codesourcery dot com
@ 2023-04-13 10:29 ` jakub at gcc dot gnu.org
  2023-04-26  6:58 ` [Bug c/109412] [13/14 " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-04-13 10:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54848
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54848&action=edit
gcc13-pr109412.patch

Untested fix.

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

* [Bug c/109412] [13/14 Regression] ICE in fold_convert_loc, at fold-const.cc:2627
  2023-04-04 16:12 [Bug c/109412] New: [13 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2023-04-13 10:29 ` jakub at gcc dot gnu.org
@ 2023-04-26  6:58 ` rguenth at gcc dot gnu.org
  2023-04-27  2:05 ` [Bug c/109412] [13/14 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 since r13-2205-g14cfa01755a66a sjames at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ 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=109412

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] 9+ messages in thread

* [Bug c/109412] [13/14 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 since r13-2205-g14cfa01755a66a
  2023-04-04 16:12 [Bug c/109412] New: [13 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2023-04-26  6:58 ` [Bug c/109412] [13/14 " rguenth at gcc dot gnu.org
@ 2023-04-27  2:05 ` sjames at gcc dot gnu.org
  2023-04-27  9:36 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-04-27  2:05 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sjames at gcc dot gnu.org
            Summary|[13/14 Regression] ICE in   |[13/14 Regression] ICE in
                   |fold_convert_loc, at        |fold_convert_loc, at
                   |fold-const.cc:2627          |fold-const.cc:2627 since
                   |                            |r13-2205-g14cfa01755a66a

--- Comment #5 from Sam James <sjames at gcc dot gnu.org> ---
When trying to reduce another bug, I accidentally reduced to something invalid
which seems to hti this bug:
```
int bfd_elf_final_link() = {}
```

w/
```
$ gcc -O2 /tmp/foo.c -c
/tmp/foo.c:1:1: error: function ‘bfd_elf_final_link’ is initialized like a
variable
    1 | int bfd_elf_final_link() = {}
      | ^~~
/tmp/foo.c:1:1: internal compiler error: in fold_convert_loc, at
fold-const.cc:2627
0x62ce64 fold_convert_loc(unsigned int, tree_node*, tree_node*)
       
/usr/src/debug/sys-devel/gcc-13.1.0-r1/gcc-13.1.0/gcc/fold-const.cc:2627
0x6e5753 pop_init_level(unsigned int, int, obstack*, unsigned int)
       
/usr/src/debug/sys-devel/gcc-13.1.0-r1/gcc-13.1.0/gcc/c/c-typeck.cc:9382
0x1f0d141 c_parser_braced_init
       
/usr/src/debug/sys-devel/gcc-13.1.0-r1/gcc-13.1.0/gcc/c/c-parser.cc:5775
0x1ef2857 c_parser_initializer
       
/usr/src/debug/sys-devel/gcc-13.1.0-r1/gcc-13.1.0/gcc/c/c-parser.cc:5675
0x1edc23a c_parser_declaration_or_fndef
       
/usr/src/debug/sys-devel/gcc-13.1.0-r1/gcc-13.1.0/gcc/c/c-parser.cc:2564
0x1edb817 c_parser_external_declaration
       
/usr/src/debug/sys-devel/gcc-13.1.0-r1/gcc-13.1.0/gcc/c/c-parser.cc:1925
0x1ed7028 c_parser_translation_unit
       
/usr/src/debug/sys-devel/gcc-13.1.0-r1/gcc-13.1.0/gcc/c/c-parser.cc:1779
0x1ed7028 c_parse_file()
       
/usr/src/debug/sys-devel/gcc-13.1.0-r1/gcc-13.1.0/gcc/c/c-parser.cc:24632
0x1ecf431 c_common_parse_file()
       
/usr/src/debug/sys-devel/gcc-13.1.0-r1/gcc-13.1.0/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://bugs.gentoo.org/> for instructions.
```

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

* [Bug c/109412] [13/14 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 since r13-2205-g14cfa01755a66a
  2023-04-04 16:12 [Bug c/109412] New: [13 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2023-04-27  2:05 ` [Bug c/109412] [13/14 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 since r13-2205-g14cfa01755a66a sjames at gcc dot gnu.org
@ 2023-04-27  9:36 ` cvs-commit at gcc dot gnu.org
  2023-04-27  9:41 ` cvs-commit at gcc dot gnu.org
  2023-04-27  9:42 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-27  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:a1030fbf70eef5b635e4fbb904ec7209ebd137ca

commit r14-287-ga1030fbf70eef5b635e4fbb904ec7209ebd137ca
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Apr 27 11:35:55 2023 +0200

    c: Fix up error-recovery on functions initialized as variables [PR109412]

    The change to allow empty initializers in C broke error-recovery on the
    following testcase.  We are emitting function %qD is initialized like a
    variable error early; if the initializer is non-empty, we just emit
    another error that the initializer is invalid.  Previously if it was empty,
    we'd emit another error that scalar is being initialized by empty
    initializer (not really correct), but now we instead just try to
    build_zero_cst for the FUNCTION_TYPE and ICE on it.

    The following patch just emits the same diagnostics for the empty
    initializers as we emit for the non-empty ones.

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

            PR c/107682
            PR c/109412
            * c-typeck.cc (pop_init_level): If constructor_type is
FUNCTION_TYPE,
            reject empty initializer as invalid.

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

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

* [Bug c/109412] [13/14 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 since r13-2205-g14cfa01755a66a
  2023-04-04 16:12 [Bug c/109412] New: [13 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2023-04-27  9:36 ` cvs-commit at gcc dot gnu.org
@ 2023-04-27  9:41 ` cvs-commit at gcc dot gnu.org
  2023-04-27  9:42 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-27  9:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 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:7e312adcb70ca7d67f0c2cf238cddec9b3243ff9

commit r13-7257-g7e312adcb70ca7d67f0c2cf238cddec9b3243ff9
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Apr 27 11:35:55 2023 +0200

    c: Fix up error-recovery on functions initialized as variables [PR109412]

    The change to allow empty initializers in C broke error-recovery on the
    following testcase.  We are emitting function %qD is initialized like a
    variable error early; if the initializer is non-empty, we just emit
    another error that the initializer is invalid.  Previously if it was empty,
    we'd emit another error that scalar is being initialized by empty
    initializer (not really correct), but now we instead just try to
    build_zero_cst for the FUNCTION_TYPE and ICE on it.

    The following patch just emits the same diagnostics for the empty
    initializers as we emit for the non-empty ones.

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

            PR c/107682
            PR c/109412
            * c-typeck.cc (pop_init_level): If constructor_type is
FUNCTION_TYPE,
            reject empty initializer as invalid.

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

    (cherry picked from commit a1030fbf70eef5b635e4fbb904ec7209ebd137ca)

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

* [Bug c/109412] [13/14 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 since r13-2205-g14cfa01755a66a
  2023-04-04 16:12 [Bug c/109412] New: [13 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2023-04-27  9:41 ` cvs-commit at gcc dot gnu.org
@ 2023-04-27  9:42 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub 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=109412

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

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

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

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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-04 16:12 [Bug c/109412] New: [13 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 gscfq@t-online.de
2023-04-04 16:39 ` [Bug c/109412] " mpolacek at gcc dot gnu.org
2023-04-04 17:19 ` joseph at codesourcery dot com
2023-04-13 10:29 ` jakub at gcc dot gnu.org
2023-04-26  6:58 ` [Bug c/109412] [13/14 " rguenth at gcc dot gnu.org
2023-04-27  2:05 ` [Bug c/109412] [13/14 Regression] ICE in fold_convert_loc, at fold-const.cc:2627 since r13-2205-g14cfa01755a66a sjames at gcc dot gnu.org
2023-04-27  9:36 ` cvs-commit at gcc dot gnu.org
2023-04-27  9:41 ` cvs-commit at gcc dot gnu.org
2023-04-27  9:42 ` 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).