public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95241] New: internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900
@ 2020-05-20 17:13 tab.debugteam at gmail dot com
  2020-05-20 17:25 ` [Bug c++/95241] [10/11 Regression] " mpolacek at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: tab.debugteam at gmail dot com @ 2020-05-20 17:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95241
           Summary: internal compiler error: tree check: expected
                    integer_cst, have range_expr in to_wide, at
                    tree.h:5900
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tab.debugteam at gmail dot com
  Target Milestone: ---

Following c++ code:

```
struct Fragment
{
        int offset;
        int length;

        constexpr Fragment(
                        int _offset,
                        int _length)
                : offset(_offset), length(_length)
        {
        }
        constexpr Fragment() :
                Fragment(0, 1) { }
};

struct Field {
        Fragment fragments[3];

        constexpr
                Field(int offset, int length)
                  : fragments{Fragment(offset, length)}
        {
        }
};

int main()
{
    auto field = Field(0, 1);
    return 0;
}
```

fails to compile with gcc 10.1 (https://godbolt.org/z/tyPB6V) and later with
error message:

```
<source>: In function 'int main()':

<source>:28:28:   in 'constexpr' expansion of 'Field(0, 1)'

<source>:28:28: internal compiler error: tree check: expected integer_cst, have
range_expr in to_wide, at tree.h:5900

   28 |     auto field = Field(0, 1);

      |                            ^
```

First spotted on gcc 10.1: https://godbolt.org/z/tyPB6V, but it's also
reproducible on latest gcc available on compiler explorer (version 11.0.0
20200511): https://godbolt.org/z/qWivJC.
I'm unable to reproduce it on gcc 9.3: https://godbolt.org/z/C2QqxA.

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

* [Bug c++/95241] [10/11 Regression] internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900
  2020-05-20 17:13 [Bug c++/95241] New: internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900 tab.debugteam at gmail dot com
@ 2020-05-20 17:25 ` mpolacek at gcc dot gnu.org
  2020-05-20 18:14 ` ppalka at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-20 17:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Target Milestone|---                         |10.2
            Summary|internal compiler error:    |[10/11 Regression] internal
                   |tree check: expected        |compiler error: tree check:
                   |integer_cst, have           |expected integer_cst, have
                   |range_expr in to_wide, at   |range_expr in to_wide, at
                   |tree.h:5900                 |tree.h:5900
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-05-20
                 CC|                            |mpolacek at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
           Keywords|                            |ice-on-valid-code

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed, started with r10-7556-g37244b217a7329792f4ec48027f63cf5010b0ea8

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

* [Bug c++/95241] [10/11 Regression] internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900
  2020-05-20 17:13 [Bug c++/95241] New: internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900 tab.debugteam at gmail dot com
  2020-05-20 17:25 ` [Bug c++/95241] [10/11 Regression] " mpolacek at gcc dot gnu.org
@ 2020-05-20 18:14 ` ppalka at gcc dot gnu.org
  2020-05-22  6:08 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-05-20 18:14 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

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

* [Bug c++/95241] [10/11 Regression] internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900
  2020-05-20 17:13 [Bug c++/95241] New: internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900 tab.debugteam at gmail dot com
  2020-05-20 17:25 ` [Bug c++/95241] [10/11 Regression] " mpolacek at gcc dot gnu.org
  2020-05-20 18:14 ` ppalka at gcc dot gnu.org
@ 2020-05-22  6:08 ` rguenth at gcc dot gnu.org
  2020-05-29 13:44 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-22  6:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c++/95241] [10/11 Regression] internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900
  2020-05-20 17:13 [Bug c++/95241] New: internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900 tab.debugteam at gmail dot com
                   ` (2 preceding siblings ...)
  2020-05-22  6:08 ` rguenth at gcc dot gnu.org
@ 2020-05-29 13:44 ` cvs-commit at gcc dot gnu.org
  2020-05-29 13:45 ` [Bug c++/95241] [10 " ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-29 13:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r11-722-ge069285cdf457cc85070e522380c4e25b0d2ed25
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri May 29 09:44:09 2020 -0400

    c++: constexpr ctor with RANGE_EXPR index [PR95241]

    In the testcase below, the CONSTRUCTOR for 'field' contains a RANGE_EXPR
    index:

      {{aggr_init_expr<...>, [1...2]={.off=1}}}

    but get_or_insert_ctor_field isn't prepared to handle looking up a
    RANGE_EXPR index.

    This patch adds limited support to get_or_insert_ctor_field for looking
    up a RANGE_EXPR index.  The limited scope of this patch should make it
    more suitable for backporting, and more extensive support would be
    needed only to handle self-modifying CONSTRUCTORs that contain a
    RANGE_EXPR index, but I haven't yet been able to come up with a testcase
    that actually creates such a CONSTRUCTOR.

    gcc/cp/ChangeLog:

            PR c++/95241
            * constexpr.c (get_or_insert_ctor_field): Add limited support
            for RANGE_EXPR index lookups.

    gcc/testsuite/ChangeLog:

            PR c++/95241
            * g++.dg/cpp0x/constexpr-array25.C: New test.

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

* [Bug c++/95241] [10 Regression] internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900
  2020-05-20 17:13 [Bug c++/95241] New: internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900 tab.debugteam at gmail dot com
                   ` (3 preceding siblings ...)
  2020-05-29 13:44 ` cvs-commit at gcc dot gnu.org
@ 2020-05-29 13:45 ` ppalka at gcc dot gnu.org
  2020-05-30  4:20 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-05-29 13:45 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11 Regression] internal |[10 Regression] internal
                   |compiler error: tree check: |compiler error: tree check:
                   |expected integer_cst, have  |expected integer_cst, have
                   |range_expr in to_wide, at   |range_expr in to_wide, at
                   |tree.h:5900                 |tree.h:5900

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed on master so far.

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

* [Bug c++/95241] [10 Regression] internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900
  2020-05-20 17:13 [Bug c++/95241] New: internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900 tab.debugteam at gmail dot com
                   ` (4 preceding siblings ...)
  2020-05-29 13:45 ` [Bug c++/95241] [10 " ppalka at gcc dot gnu.org
@ 2020-05-30  4:20 ` cvs-commit at gcc dot gnu.org
  2020-05-30  4:22 ` ppalka at gcc dot gnu.org
  2020-05-30  7:30 ` tab.debugteam at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-30  4:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:798a9da416bbfd8996da9a5d53955b082d5b94fe

commit r10-8213-g798a9da416bbfd8996da9a5d53955b082d5b94fe
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri May 29 09:44:09 2020 -0400

    c++: constexpr ctor with RANGE_EXPR index [PR95241]

    In the testcase below, the CONSTRUCTOR for 'field' contains a RANGE_EXPR
    index:

      {{aggr_init_expr<...>, [1...2]={.off=1}}}

    but get_or_insert_ctor_field isn't prepared to handle looking up a
    RANGE_EXPR index.

    This patch adds limited support to get_or_insert_ctor_field for looking
    up a RANGE_EXPR index.  The limited scope of this patch should make it
    more suitable for backporting, and more extensive support would be
    needed only to handle self-modifying CONSTRUCTORs that contain a
    RANGE_EXPR index, but I haven't yet been able to come up with a testcase
    that actually creates such a CONSTRUCTOR.

    gcc/cp/ChangeLog:

            PR c++/95241
            * constexpr.c (get_or_insert_ctor_field): Add limited support
            for RANGE_EXPR index lookups.

    gcc/testsuite/ChangeLog:

            PR c++/95241
            * g++.dg/cpp0x/constexpr-array25.C: New test.

    (cherry picked from commit e069285cdf457cc85070e522380c4e25b0d2ed25)

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

* [Bug c++/95241] [10 Regression] internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900
  2020-05-20 17:13 [Bug c++/95241] New: internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900 tab.debugteam at gmail dot com
                   ` (5 preceding siblings ...)
  2020-05-30  4:20 ` cvs-commit at gcc dot gnu.org
@ 2020-05-30  4:22 ` ppalka at gcc dot gnu.org
  2020-05-30  7:30 ` tab.debugteam at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-05-30  4:22 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 10.2+.

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

* [Bug c++/95241] [10 Regression] internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900
  2020-05-20 17:13 [Bug c++/95241] New: internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900 tab.debugteam at gmail dot com
                   ` (6 preceding siblings ...)
  2020-05-30  4:22 ` ppalka at gcc dot gnu.org
@ 2020-05-30  7:30 ` tab.debugteam at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: tab.debugteam at gmail dot com @ 2020-05-30  7:30 UTC (permalink / raw)
  To: gcc-bugs

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

Mateusz Tabaka <tab.debugteam at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |VERIFIED

--- Comment #6 from Mateusz Tabaka <tab.debugteam at gmail dot com> ---
Verified.

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

end of thread, other threads:[~2020-05-30  7:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 17:13 [Bug c++/95241] New: internal compiler error: tree check: expected integer_cst, have range_expr in to_wide, at tree.h:5900 tab.debugteam at gmail dot com
2020-05-20 17:25 ` [Bug c++/95241] [10/11 Regression] " mpolacek at gcc dot gnu.org
2020-05-20 18:14 ` ppalka at gcc dot gnu.org
2020-05-22  6:08 ` rguenth at gcc dot gnu.org
2020-05-29 13:44 ` cvs-commit at gcc dot gnu.org
2020-05-29 13:45 ` [Bug c++/95241] [10 " ppalka at gcc dot gnu.org
2020-05-30  4:20 ` cvs-commit at gcc dot gnu.org
2020-05-30  4:22 ` ppalka at gcc dot gnu.org
2020-05-30  7:30 ` tab.debugteam at gmail dot com

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).