public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100489] New: [10.3/11 REGRESSION] ICE in cp/constexpr.c:3556
@ 2021-05-08 21:41 slyfox at gcc dot gnu.org
  2021-05-09  1:08 ` [Bug c++/100489] [10.3/11/12 " hjl.tools at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: slyfox at gcc dot gnu.org @ 2021-05-08 21:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100489
           Summary: [10.3/11 REGRESSION] ICE in cp/constexpr.c:3556
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

It's a forward of https://bugs.gentoo.org/788829 ICE report by Martin Kolleck.

ICE appeared in 10.3.0 and is present in 11.1.0 and 12.0.0. 10.2.0 seems to
work.

Here is a simple reproducer:

// cat ice.cpp
union U
{
  struct
  {
    unsigned char a;
  };

  unsigned char b[1];
};

void f(unsigned char a)
{
  union U u = { .a = a };
}

And the crash:

$ LANG=C g++ -c -o /dev/null ice.cpp
ice.cpp: In function 'void f(unsigned char)':
ice.cpp:14:24: internal compiler error: in get_or_insert_ctor_field, at
cp/constexpr.c:3556
   14 |   union U u = { .a = a };
      |                        ^
0x5fed0e get_or_insert_ctor_field
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/constexpr.c:3556
0x68f2a2 cxx_eval_bare_aggregate
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/constexpr.c:4455
0x685466 cxx_eval_constant_expression
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/constexpr.c:6675
0x688030 cxx_eval_outermost_constant_expr
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/constexpr.c:7251
0x68b592 maybe_constant_value(tree_node*, tree_node*, bool)
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/constexpr.c:7525
0x6ab92c cp_fully_fold(tree_node*)
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/cp-gimplify.c:2146
0x6ab92c cp_fully_fold(tree_node*)
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/cp-gimplify.c:2138
0x6ab9d4 cp_fully_fold_init(tree_node*)
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/cp-gimplify.c:2167
0x82219a store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/typeck2.c:816
0x6bd08d check_initializer
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/decl.c:7080
0x6d6a8f cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/decl.c:8014
0x796139 cp_parser_init_declarator
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/parser.c:21891
0x7730ae cp_parser_simple_declaration
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/parser.c:14457
0x77509d cp_parser_declaration_statement
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/parser.c:13592
0x7756ab cp_parser_statement
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/parser.c:11822
0x776eae cp_parser_statement_seq_opt
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/parser.c:12189
0x776f70 cp_parser_compound_statement
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/parser.c:12138
0x794117 cp_parser_function_body
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/parser.c:24080
0x794117 cp_parser_ctor_initializer_opt_and_function_body
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/parser.c:24131
0x79541a cp_parser_function_definition_after_declarator
       
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/gcc/cp/parser.c:30068

$ LANG=C h gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/tmp/portage-tmpdir/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/12.0.0
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/12.0.0
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/12.0.0/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/12.0.0/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include/g++-v12
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/12.0.0/python
--enable-languages=c,c++,d,go,jit,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--enable-checking=release --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo 12.0.0_pre9999 p1, commit
39671f87b2df6a1894cc11a161e4a7949d1ddccd' --disable-esp --enable-libstdcxx-time
--enable-host-shared --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-multilib
--with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all
--enable-libgomp --disable-libssp --disable-libada --enable-systemtap
--enable-valgrind-annotations --enable-vtable-verify --with-zstd --enable-lto
--with-isl --disable-isl-version-check --enable-default-pie
--enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20210420 (experimental) (Gentoo 12.0.0_pre9999 p1, commit
39671f87b2df6a1894cc11a161e4a7949d1ddccd)

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

* [Bug c++/100489] [10.3/11/12 REGRESSION] ICE in cp/constexpr.c:3556
  2021-05-08 21:41 [Bug c++/100489] New: [10.3/11 REGRESSION] ICE in cp/constexpr.c:3556 slyfox at gcc dot gnu.org
@ 2021-05-09  1:08 ` hjl.tools at gmail dot com
  2021-05-10  8:07 ` [Bug c++/100489] [10/11/12 Regression] " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2021-05-09  1:08 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at redhat dot com
   Last reconfirmed|                            |2021-05-09
            Summary|[10.3/11 REGRESSION] ICE in |[10.3/11/12 REGRESSION] ICE
                   |cp/constexpr.c:3556         |in cp/constexpr.c:3556
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
It is caused by r11-6895.

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

* [Bug c++/100489] [10/11/12 Regression] ICE in cp/constexpr.c:3556
  2021-05-08 21:41 [Bug c++/100489] New: [10.3/11 REGRESSION] ICE in cp/constexpr.c:3556 slyfox at gcc dot gnu.org
  2021-05-09  1:08 ` [Bug c++/100489] [10.3/11/12 " hjl.tools at gmail dot com
@ 2021-05-10  8:07 ` rguenth at gcc dot gnu.org
  2021-05-19 23:55 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-10  8:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.4
      Known to work|                            |10.2.0, 10.3.0
            Summary|[10.3/11/12 REGRESSION] ICE |[10/11/12 Regression] ICE
                   |in cp/constexpr.c:3556      |in cp/constexpr.c:3556
           Priority|P3                          |P2
           Keywords|                            |ice-on-valid-code

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

* [Bug c++/100489] [10/11/12 Regression] ICE in cp/constexpr.c:3556
  2021-05-08 21:41 [Bug c++/100489] New: [10.3/11 REGRESSION] ICE in cp/constexpr.c:3556 slyfox at gcc dot gnu.org
  2021-05-09  1:08 ` [Bug c++/100489] [10.3/11/12 " hjl.tools at gmail dot com
  2021-05-10  8:07 ` [Bug c++/100489] [10/11/12 Regression] " rguenth at gcc dot gnu.org
@ 2021-05-19 23:55 ` jason at gcc dot gnu.org
  2021-05-20 20:59 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2021-05-19 23:55 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

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

* [Bug c++/100489] [10/11/12 Regression] ICE in cp/constexpr.c:3556
  2021-05-08 21:41 [Bug c++/100489] New: [10.3/11 REGRESSION] ICE in cp/constexpr.c:3556 slyfox at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-05-19 23:55 ` jason at gcc dot gnu.org
@ 2021-05-20 20:59 ` cvs-commit at gcc dot gnu.org
  2021-05-20 20:59 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-20 20:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:84fd1b5dff70cd74aee7e8b18f66959d8b8e1ce7

commit r12-954-g84fd1b5dff70cd74aee7e8b18f66959d8b8e1ce7
Author: Jason Merrill <jason@redhat.com>
Date:   Wed May 19 21:12:45 2021 -0400

    c++: designated init with anonymous union [PR100489]

    My patch for PR98463 added an assert that tripped on this testcase, because
    we ended up with a U CONSTRUCTOR with an initializer for a, which is not a
    member of U.  We need to wrap the a initializer in another CONSTRUCTOR for
    the anonymous union.

    There was already support for this in process_init_constructor_record, but
    not in process_init_constructor_union.  But since this is about brace
    elision, it really belongs under reshape_init rather than digest_init, so
    this patch moves the handling to reshape_init_class, which also handles
    unions.

            PR c++/100489

    gcc/cp/ChangeLog:

            * decl.c (reshape_init_class): Handle designator for
            member of anonymous aggregate here.
            * typeck2.c (process_init_constructor_record): Not here.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/desig18.C: New test.

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

* [Bug c++/100489] [10/11/12 Regression] ICE in cp/constexpr.c:3556
  2021-05-08 21:41 [Bug c++/100489] New: [10.3/11 REGRESSION] ICE in cp/constexpr.c:3556 slyfox at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-05-20 20:59 ` cvs-commit at gcc dot gnu.org
@ 2021-05-20 20:59 ` cvs-commit at gcc dot gnu.org
  2021-05-20 21:36 ` cvs-commit at gcc dot gnu.org
  2021-05-20 21:36 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-20 20:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

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

commit r11-8449-g0a1010428b3861464eb319c629c68cb13b9ca01e
Author: Jason Merrill <jason@redhat.com>
Date:   Wed May 19 21:12:45 2021 -0400

    c++: designated init with anonymous union [PR100489]

    My patch for PR98463 added an assert that tripped on this testcase, because
    we ended up with a U CONSTRUCTOR with an initializer for a, which is not a
    member of U.  We need to wrap the a initializer in another CONSTRUCTOR for
    the anonymous union.

    There was already support for this in process_init_constructor_record, but
    not in process_init_constructor_union.  But since this is about brace
    elision, it really belongs under reshape_init rather than digest_init, so
    this patch moves the handling to reshape_init_class, which also handles
    unions.

            PR c++/100489

    gcc/cp/ChangeLog:

            * decl.c (reshape_init_class): Handle designator for
            member of anonymous aggregate here.
            * typeck2.c (process_init_constructor_record): Not here.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/desig18.C: New test.

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

* [Bug c++/100489] [10/11/12 Regression] ICE in cp/constexpr.c:3556
  2021-05-08 21:41 [Bug c++/100489] New: [10.3/11 REGRESSION] ICE in cp/constexpr.c:3556 slyfox at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-05-20 20:59 ` cvs-commit at gcc dot gnu.org
@ 2021-05-20 21:36 ` cvs-commit at gcc dot gnu.org
  2021-05-20 21:36 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-20 21:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:a335afe208cd27cf8ee4cb028fb7769700ab6245

commit r10-9857-ga335afe208cd27cf8ee4cb028fb7769700ab6245
Author: Jason Merrill <jason@redhat.com>
Date:   Wed May 19 21:12:45 2021 -0400

    c++: designated init with anonymous union [PR100489]

    My patch for PR98463 added an assert that tripped on this testcase, because
    we ended up with a U CONSTRUCTOR with an initializer for a, which is not a
    member of U.  We need to wrap the a initializer in another CONSTRUCTOR for
    the anonymous union.

    For the GCC 10 branch, just remove the assert.

            PR c++/100489

    gcc/cp/ChangeLog:

            * constexpr.c (get_or_insert_ctor_field): Remove assert.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/desig18.C: New test.

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

* [Bug c++/100489] [10/11/12 Regression] ICE in cp/constexpr.c:3556
  2021-05-08 21:41 [Bug c++/100489] New: [10.3/11 REGRESSION] ICE in cp/constexpr.c:3556 slyfox at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-05-20 21:36 ` cvs-commit at gcc dot gnu.org
@ 2021-05-20 21:36 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2021-05-20 21:36 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 10.4/11.2/12.

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

end of thread, other threads:[~2021-05-20 21:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-08 21:41 [Bug c++/100489] New: [10.3/11 REGRESSION] ICE in cp/constexpr.c:3556 slyfox at gcc dot gnu.org
2021-05-09  1:08 ` [Bug c++/100489] [10.3/11/12 " hjl.tools at gmail dot com
2021-05-10  8:07 ` [Bug c++/100489] [10/11/12 Regression] " rguenth at gcc dot gnu.org
2021-05-19 23:55 ` jason at gcc dot gnu.org
2021-05-20 20:59 ` cvs-commit at gcc dot gnu.org
2021-05-20 20:59 ` cvs-commit at gcc dot gnu.org
2021-05-20 21:36 ` cvs-commit at gcc dot gnu.org
2021-05-20 21:36 ` jason 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).