public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108266] New: [13 Regression] ICE during cxx_eval_constant_expression on IMPLICIT_CONV_EXPR since r13-4564
@ 2023-01-02 16:32 jakub at gcc dot gnu.org
  2023-01-02 16:33 ` [Bug c++/108266] " jakub at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-02 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108266
           Summary: [13 Regression] ICE during
                    cxx_eval_constant_expression on IMPLICIT_CONV_EXPR
                    since r13-4564
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

#include <initializer_list>
#include <vector>

struct S { S (const char *); };
void bar (std::vector<S>);

template <int N>
void
foo ()
{
  bar ({"", ""});
}

void
baz ()
{
  foo<0> ();
}

ICEs with -std=c++20 starting with
r13-4564-gd081807d8d70e3e87eae41e1560e54d503f4d465
internal compiler error: unexpected expression '(S)""' of kind
implicit_conv_expr
   11 |   bar ({"", ""});
      |   ~~~~^~~~~~~~~~
In Fedora test mass rebuilds I saw 33 ICEs like that.
Instead of the includes one can use just
namespace std {
template <class T> struct initializer_list { const T *ptr; decltype (sizeof 0)
len; };
template <typename T> struct vector { vector (initializer_list<T>); };
}
to get the same ICE.

The problem is that maybe_init_list_as_range -> maybe_init_list_as_array ->
maybe_constant_init is called when processing_template_decl (from
build_user_type_conversion_1).  Wonder if the call shouldn't be skipped for
processing_template_decl, or whether say maybe_init_list_as_range shouldn't
always return NULL if processing_template_decl.

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

* [Bug c++/108266] [13 Regression] ICE during cxx_eval_constant_expression on IMPLICIT_CONV_EXPR since r13-4564
  2023-01-02 16:32 [Bug c++/108266] New: [13 Regression] ICE during cxx_eval_constant_expression on IMPLICIT_CONV_EXPR since r13-4564 jakub at gcc dot gnu.org
@ 2023-01-02 16:33 ` jakub at gcc dot gnu.org
  2023-01-02 16:41 ` pinskia at gcc dot gnu.org
  2023-01-09 22:41 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-02 16:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org
   Last reconfirmed|                            |2023-01-02
   Target Milestone|---                         |13.0
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P1
     Ever confirmed|0                           |1

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

* [Bug c++/108266] [13 Regression] ICE during cxx_eval_constant_expression on IMPLICIT_CONV_EXPR since r13-4564
  2023-01-02 16:32 [Bug c++/108266] New: [13 Regression] ICE during cxx_eval_constant_expression on IMPLICIT_CONV_EXPR since r13-4564 jakub at gcc dot gnu.org
  2023-01-02 16:33 ` [Bug c++/108266] " jakub at gcc dot gnu.org
@ 2023-01-02 16:41 ` pinskia at gcc dot gnu.org
  2023-01-09 22:41 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-02 16:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 108047

*** This bug has been marked as a duplicate of bug 108047 ***

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

* [Bug c++/108266] [13 Regression] ICE during cxx_eval_constant_expression on IMPLICIT_CONV_EXPR since r13-4564
  2023-01-02 16:32 [Bug c++/108266] New: [13 Regression] ICE during cxx_eval_constant_expression on IMPLICIT_CONV_EXPR since r13-4564 jakub at gcc dot gnu.org
  2023-01-02 16:33 ` [Bug c++/108266] " jakub at gcc dot gnu.org
  2023-01-02 16:41 ` pinskia at gcc dot gnu.org
@ 2023-01-09 22:41 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-09 22:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:01ea66a6c56e53163d9430f4d87615d570848aa8

commit r13-5075-g01ea66a6c56e53163d9430f4d87615d570848aa8
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Jan 9 23:41:20 2023 +0100

    c++: Only do maybe_init_list_as_range optimization if
!processing_template_decl [PR108047]

    The last testcase in this patch ICEs, because
    maybe_init_list_as_range -> maybe_init_list_as_array
    calls maybe_constant_init in:
      /* Don't do this if the conversion would be constant.  */
      first = maybe_constant_init (first);
      if (TREE_CONSTANT (first))
        return NULL_TREE;
    but maybe_constant_init shouldn't be called when processing_template_decl.
    While we could replace that call with fold_non_dependent_init, my limited
    understanding is that this is an optimization and even if we don't optimize
    it when processing_template_decl, build_user_type_conversion_1 will be
    called again during instantiation with !processing_template_decl if it is
    every instantiated and we can do the optimization only then.

    2023-01-09  Jakub Jelinek  <jakub@redhat.com>

            PR c++/105838
            PR c++/108047
            PR c++/108266
            * call.cc (maybe_init_list_as_range): Always return NULL_TREE if
            processing_template_decl.

            * g++.dg/tree-ssa/initlist-opt2.C: New test.
            * g++.dg/tree-ssa/initlist-opt3.C: New test.

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

end of thread, other threads:[~2023-01-09 22:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-02 16:32 [Bug c++/108266] New: [13 Regression] ICE during cxx_eval_constant_expression on IMPLICIT_CONV_EXPR since r13-4564 jakub at gcc dot gnu.org
2023-01-02 16:33 ` [Bug c++/108266] " jakub at gcc dot gnu.org
2023-01-02 16:41 ` pinskia at gcc dot gnu.org
2023-01-09 22:41 ` cvs-commit 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).