public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106026] New: ICE: error reporting routines re-entered.
@ 2022-06-19  4:11 ldalessandro at gmail dot com
  2022-06-19  4:12 ` [Bug c++/106026] " ldalessandro at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ldalessandro at gmail dot com @ 2022-06-19  4:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106026
           Summary: ICE: error reporting routines re-entered.
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldalessandro at gmail dot com
  Target Milestone: ---

Created attachment 53163
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53163&action=edit
Eric's tag_invoke implementation.

Triggered with complicated tag_invoke + concepts. This code is erroneous (the
friend function with "requires requires" in cpos::extent and the free function
with "concepts::has_static_extent" should not both be possible.

This requires Eric Niebler's tag_invoke gist, which is somewhat complex, so I
left it in as an #include. I attached an actual copy as tag_invoke.hpp to this
PR as well.

https://godbolt.org/z/fzqEG6bnW

    #include
<https://gist.githubusercontent.com/ericniebler/056f5459cf259da526d9ea2279c386bb/raw/6c63fa81442e811fea8bd6920a95c0b8229dca6c/tag_invoke.hpp>
    #include <array>
    #include <concepts>

    #define FWD(x) static_cast<decltype(x)&&>(x)

    namespace traits {
        template <class T>
        inline constexpr auto extents_v = not defined(extents_v<T>);
    }

    namespace cpos {
        struct extents
        {
            template <class T>
            requires requires {
                { traits::extents_v<std::remove_cvref_t<T>> };
            }
            constexpr friend auto tag_invoke(extents, T&&) {
                return traits::extents_v<std::remove_cvref_t<T>>;
            }

            constexpr auto operator()(auto&& x) const {
                return tag_invoke(*this, FWD(x));
            }
        };
    }

    constexpr cpos::extents extents;

    namespace concepts {
        template <class T>
        concept has_extents = requires (T t) {
            { extents(t) };
        };

        template <class T>
        concept has_static_extents = has_extents<T> and requires {
            { traits::extents_v<std::remove_cvref_t<T>> };
        };
    }

    template <concepts::has_static_extents T>
    constexpr auto tag_invoke(cpos::extents, T&&) {
        return traits::extents_v<std::remove_cvref_t<T>>;
    }

    template <auto _shape>
    struct static_tensor {
    };

    namespace traits {
        template <auto _shape>
        inline constexpr auto extents_v<static_tensor<_shape>> = _shape;
    }

    constexpr std::array matrix_shape = { 3, 3 };
    auto x = static_tensor<matrix_shape>{};

    static_assert(concepts::has_static_extents<decltype(x)>);

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

* [Bug c++/106026] ICE: error reporting routines re-entered.
  2022-06-19  4:11 [Bug c++/106026] New: ICE: error reporting routines re-entered ldalessandro at gmail dot com
@ 2022-06-19  4:12 ` ldalessandro at gmail dot com
  2023-05-18  0:06 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ldalessandro at gmail dot com @ 2022-06-19  4:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Luke Dalessandro <ldalessandro at gmail dot com> ---
Actually, I take back the part about it being invalid code, I'm not sure it's
invalid. The godbolt link compiles on clang-14 without error.

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

* [Bug c++/106026] ICE: error reporting routines re-entered.
  2022-06-19  4:11 [Bug c++/106026] New: ICE: error reporting routines re-entered ldalessandro at gmail dot com
  2022-06-19  4:12 ` [Bug c++/106026] " ldalessandro at gmail dot com
@ 2023-05-18  0:06 ` pinskia at gcc dot gnu.org
  2023-05-18  1:29 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-18  0:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reducing ...

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

* [Bug c++/106026] ICE: error reporting routines re-entered.
  2022-06-19  4:11 [Bug c++/106026] New: ICE: error reporting routines re-entered ldalessandro at gmail dot com
  2022-06-19  4:12 ` [Bug c++/106026] " ldalessandro at gmail dot com
  2023-05-18  0:06 ` pinskia at gcc dot gnu.org
@ 2023-05-18  1:29 ` pinskia at gcc dot gnu.org
  2023-05-18  1:33 ` [Bug c++/106026] [11/12/13 Regression] " pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-18  1:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced to:
```
struct k {
  template <typename CPO, typename... Args>
    auto operator()(CPO cpo, Args &&...args) const
      -> decltype(tag_invoke(cpo, args...))
    {
      return tag_invoke(cpo, args...);
    }
};
k j{};
struct nn {
  template <class T>
    friend void tag_invoke(nn, T &&) {  }
  auto operator()(auto x) const {
    return j(*this, x);
  }
};
constexpr nn h;
template <class T> concept has_extents = requires(T t) { h(t); };
template <has_extents T> constexpr void tag_invoke(nn, T &&) {}
static_assert(has_extents<int>);
```

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

* [Bug c++/106026] [11/12/13 Regression] ICE: error reporting routines re-entered.
  2022-06-19  4:11 [Bug c++/106026] New: ICE: error reporting routines re-entered ldalessandro at gmail dot com
                   ` (2 preceding siblings ...)
  2023-05-18  1:29 ` pinskia at gcc dot gnu.org
@ 2023-05-18  1:33 ` pinskia at gcc dot gnu.org
  2023-05-18  1:34 ` pinskia at gcc dot gnu.org
  2023-05-29 10:07 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-18  1:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-05-18
     Ever confirmed|0                           |1
           Keywords|rejects-valid               |ice-on-valid-code
            Summary|ICE: error reporting        |[11/12/13 Regression] ICE:
                   |routines re-entered.        |error reporting routines
                   |                            |re-entered.

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

* [Bug c++/106026] [11/12/13 Regression] ICE: error reporting routines re-entered.
  2022-06-19  4:11 [Bug c++/106026] New: ICE: error reporting routines re-entered ldalessandro at gmail dot com
                   ` (3 preceding siblings ...)
  2023-05-18  1:33 ` [Bug c++/106026] [11/12/13 Regression] " pinskia at gcc dot gnu.org
@ 2023-05-18  1:34 ` pinskia at gcc dot gnu.org
  2023-05-29 10:07 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-18  1:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection
   Target Milestone|---                         |11.4

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I am suspecting this and PR 100557 were caused by the same revision.
Note clang does not reject the reduced testcase .

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

* [Bug c++/106026] [11/12/13 Regression] ICE: error reporting routines re-entered.
  2022-06-19  4:11 [Bug c++/106026] New: ICE: error reporting routines re-entered ldalessandro at gmail dot com
                   ` (4 preceding siblings ...)
  2023-05-18  1:34 ` pinskia at gcc dot gnu.org
@ 2023-05-29 10:07 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-29 10:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.4                        |11.5

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.4 is being released, retargeting bugs to GCC 11.5.

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

end of thread, other threads:[~2023-05-29 10:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-19  4:11 [Bug c++/106026] New: ICE: error reporting routines re-entered ldalessandro at gmail dot com
2022-06-19  4:12 ` [Bug c++/106026] " ldalessandro at gmail dot com
2023-05-18  0:06 ` pinskia at gcc dot gnu.org
2023-05-18  1:29 ` pinskia at gcc dot gnu.org
2023-05-18  1:33 ` [Bug c++/106026] [11/12/13 Regression] " pinskia at gcc dot gnu.org
2023-05-18  1:34 ` pinskia at gcc dot gnu.org
2023-05-29 10:07 ` 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).