public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109752] New: [ICE] in check_complete_insertion, at hash-table.h:578
@ 2023-05-05 17:50 ldalessandro at gmail dot com
  2023-05-05 17:52 ` [Bug c++/109752] " pinskia at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: ldalessandro at gmail dot com @ 2023-05-05 17:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109752
           Summary: [ICE] in check_complete_insertion, at hash-table.h:578
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldalessandro at gmail dot com
  Target Milestone: ---

The following example is reduced from
https://github.com/boostorg/stl_interfaces/blob/boost-1.82.0/example/node_iterator.cpp.
It causes the ICE on trunk (gcc-14).

  #include <boost/stl_interfaces/iterator_interface.hpp>

  template<typename T>
  struct iterator : boost::stl_interfaces::iterator_interface<iterator<T>, 
  std::forward_iterator_tag, T>
  {
    using base_type = boost::stl_interfaces::iterator_interface<iterator<T>,
std::forward_iterator_tag, T>;
    using base_type::operator++;

    T& operator*() const;
    iterator& operator++();
    bool operator==(iterator) const;
  };

  static_assert(std::incrementable<iterator<int>>);

Live: https://godbolt.org/z/n9hMW4a4b

PR: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108451 fails the same assert
but I don't know if it's the same cause.

PR: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109751 same example may
trigger gcc-13 bug (I'm not sure)

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

* [Bug c++/109752] [ICE] in check_complete_insertion, at hash-table.h:578
  2023-05-05 17:50 [Bug c++/109752] New: [ICE] in check_complete_insertion, at hash-table.h:578 ldalessandro at gmail dot com
@ 2023-05-05 17:52 ` pinskia at gcc dot gnu.org
  2023-05-05 17:52 ` pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-05 17:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you provide the preprocessed source?

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

* [Bug c++/109752] [ICE] in check_complete_insertion, at hash-table.h:578
  2023-05-05 17:50 [Bug c++/109752] New: [ICE] in check_complete_insertion, at hash-table.h:578 ldalessandro at gmail dot com
  2023-05-05 17:52 ` [Bug c++/109752] " pinskia at gcc dot gnu.org
@ 2023-05-05 17:52 ` pinskia at gcc dot gnu.org
  2023-05-05 18:00 ` ldalessandro at gmail dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-05 17:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|https://gcc.gnu.org/bugzill |
                   |a/show_bug.cgi?id=108451    |

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Luke Dalessandro from comment #0)
> 
> PR: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108451 fails the same
> assert but I don't know if it's the same cause.

That bug was in the fortran front-end and has not relationship to the C++
front-end issues.

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

* [Bug c++/109752] [ICE] in check_complete_insertion, at hash-table.h:578
  2023-05-05 17:50 [Bug c++/109752] New: [ICE] in check_complete_insertion, at hash-table.h:578 ldalessandro at gmail dot com
  2023-05-05 17:52 ` [Bug c++/109752] " pinskia at gcc dot gnu.org
  2023-05-05 17:52 ` pinskia at gcc dot gnu.org
@ 2023-05-05 18:00 ` ldalessandro at gmail dot com
  2023-05-05 18:08 ` ldalessandro at gmail dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ldalessandro at gmail dot com @ 2023-05-05 18:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Luke Dalessandro <ldalessandro at gmail dot com> ---
Created attachment 55010
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55010&action=edit
Preprocessed source copied from the godbolt live link.

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

* [Bug c++/109752] [ICE] in check_complete_insertion, at hash-table.h:578
  2023-05-05 17:50 [Bug c++/109752] New: [ICE] in check_complete_insertion, at hash-table.h:578 ldalessandro at gmail dot com
                   ` (2 preceding siblings ...)
  2023-05-05 18:00 ` ldalessandro at gmail dot com
@ 2023-05-05 18:08 ` ldalessandro at gmail dot com
  2023-05-05 19:35 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ldalessandro at gmail dot com @ 2023-05-05 18:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Luke Dalessandro <ldalessandro at gmail dot com> ---
(In reply to Andrew Pinski from comment #2)
> (In reply to Luke Dalessandro from comment #0)
> > 
> > PR: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108451 fails the same
> > assert but I don't know if it's the same cause.
> 
> That bug was in the fortran front-end and has not relationship to the C++
> front-end issues.

Thanks for checking.

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

* [Bug c++/109752] [ICE] in check_complete_insertion, at hash-table.h:578
  2023-05-05 17:50 [Bug c++/109752] New: [ICE] in check_complete_insertion, at hash-table.h:578 ldalessandro at gmail dot com
                   ` (3 preceding siblings ...)
  2023-05-05 18:08 ` ldalessandro at gmail dot com
@ 2023-05-05 19:35 ` pinskia at gcc dot gnu.org
  2023-05-06 22:08 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-05 19:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 55011
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55011&action=edit
Reduced testcase as far as I can get it

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

* [Bug c++/109752] [ICE] in check_complete_insertion, at hash-table.h:578
  2023-05-05 17:50 [Bug c++/109752] New: [ICE] in check_complete_insertion, at hash-table.h:578 ldalessandro at gmail dot com
                   ` (4 preceding siblings ...)
  2023-05-05 19:35 ` pinskia at gcc dot gnu.org
@ 2023-05-06 22:08 ` redi at gcc dot gnu.org
  2023-05-06 22:10 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2023-05-06 22:08 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aoliva at gcc dot gnu.org

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Bisection using the original preprocessed code shows it started to ICE with
r13-4937 although maybe that just added an assertion to catch a latent bug.

check hash table insertions

I've noticed a number of potential problems in hash tables, of three
kinds: insertion of entries that seem empty, dangling insertions, and
lookups during insertions.

These problems may all have the effect of replacing a deleted entry
with one that seems empty, which may disconnect double-hashing chains
involving that entry, and thus cause entries to go missing.

This patch detects such problems by recording a pending insertion and
checking that it's completed before other potentially-conflicting
operations.  The additional field is only introduced when checking is
enabled.

for  gcc/ChnageLog

* hash-table.h (check_complete_insertion, check_insert_slot):
New hash_table methods.
(m_inserting_slot): New hash_table field.
(begin, hash_table ctors, ~hash_table): Check previous insert.
(expand, empty_slow, clear_slot, find_with_hash): Likewise.
(remote_elt_with_hash, traverse_noresize): Likewise.
(gt_pch_nx): Likewise.
(find_slot_with_hash): Likewise.  Record requested insert.

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

* [Bug c++/109752] [ICE] in check_complete_insertion, at hash-table.h:578
  2023-05-05 17:50 [Bug c++/109752] New: [ICE] in check_complete_insertion, at hash-table.h:578 ldalessandro at gmail dot com
                   ` (5 preceding siblings ...)
  2023-05-06 22:08 ` redi at gcc dot gnu.org
@ 2023-05-06 22:10 ` redi at gcc dot gnu.org
  2023-05-08 14:40 ` [Bug c++/109752] [13/14 regression] ICE in check_complete_insertion, at hash-table.h:578 since r13-4937 ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2023-05-06 22:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #6)
> Bisection using the original preprocessed code shows it started to ICE with
> r13-4937 although maybe that just added an assertion to catch a latent bug.

And bisection with Andrew's reduced version in comment 5 also finds r13-4937 so
it's a good reduction.

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

* [Bug c++/109752] [13/14 regression] ICE in check_complete_insertion, at hash-table.h:578 since r13-4937
  2023-05-05 17:50 [Bug c++/109752] New: [ICE] in check_complete_insertion, at hash-table.h:578 ldalessandro at gmail dot com
                   ` (6 preceding siblings ...)
  2023-05-06 22:10 ` redi at gcc dot gnu.org
@ 2023-05-08 14:40 ` ppalka at gcc dot gnu.org
  2023-05-09 19:08 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-05-08 14:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
   Last reconfirmed|                            |2023-05-08

--- Comment #8 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Seems like a latent bug indeed, but one that only happens in an error recovery
situation.

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

* [Bug c++/109752] [13/14 regression] ICE in check_complete_insertion, at hash-table.h:578 since r13-4937
  2023-05-05 17:50 [Bug c++/109752] New: [ICE] in check_complete_insertion, at hash-table.h:578 ldalessandro at gmail dot com
                   ` (7 preceding siblings ...)
  2023-05-08 14:40 ` [Bug c++/109752] [13/14 regression] ICE in check_complete_insertion, at hash-table.h:578 since r13-4937 ppalka at gcc dot gnu.org
@ 2023-05-09 19:08 ` cvs-commit at gcc dot gnu.org
  2023-05-09 19:10 ` [Bug c++/109752] [13 " ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-09 19:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 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:bbb6cf926f1732559b3a8aaf2796d34e8651c066

commit r14-640-gbbb6cf926f1732559b3a8aaf2796d34e8651c066
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue May 9 15:07:00 2023 -0400

    c++: error-recovery ICE with unstable satisfaction [PR109752]

    After diagnosing and recovering from unstable satisfaction, it's
    possible to evaluate an atom for the first time noisily rather than
    quietly.  The satisfaction cache tries to handle this situation
    gracefully, but apparently not gracefully enough: we inserted an empty
    slot into the cache, and left it empty, which later makes
    hash_table::check_complete_insertion unhappy.  This patch fixes this by
    removing the empty slot in this case.

            PR c++/109752

    gcc/cp/ChangeLog:

            * constraint.cc (satisfaction_cache::satisfaction_cache): In the
            unexpected case of evaluating an atom for the first time noisily,
            remove the cache slot that we inserted.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-pr109752.C: New test.

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

* [Bug c++/109752] [13 regression] ICE in check_complete_insertion, at hash-table.h:578 since r13-4937
  2023-05-05 17:50 [Bug c++/109752] New: [ICE] in check_complete_insertion, at hash-table.h:578 ldalessandro at gmail dot com
                   ` (8 preceding siblings ...)
  2023-05-09 19:08 ` cvs-commit at gcc dot gnu.org
@ 2023-05-09 19:10 ` ppalka at gcc dot gnu.org
  2023-05-12 12:38 ` cvs-commit at gcc dot gnu.org
  2023-05-12 12:47 ` ppalka at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-05-09 19:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery
   Target Milestone|---                         |13.2
            Summary|[13/14 regression] ICE in   |[13 regression] ICE in
                   |check_complete_insertion,   |check_complete_insertion,
                   |at hash-table.h:578 since   |at hash-table.h:578 since
                   |r13-4937                    |r13-4937

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

* [Bug c++/109752] [13 regression] ICE in check_complete_insertion, at hash-table.h:578 since r13-4937
  2023-05-05 17:50 [Bug c++/109752] New: [ICE] in check_complete_insertion, at hash-table.h:578 ldalessandro at gmail dot com
                   ` (9 preceding siblings ...)
  2023-05-09 19:10 ` [Bug c++/109752] [13 " ppalka at gcc dot gnu.org
@ 2023-05-12 12:38 ` cvs-commit at gcc dot gnu.org
  2023-05-12 12:47 ` ppalka at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-12 12:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 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:11fa2729eff8bc585e33086bb2c595ae8a37d14f

commit r14-786-g11fa2729eff8bc585e33086bb2c595ae8a37d14f
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri May 12 08:36:37 2023 -0400

    c++: robustify testcase [PR109752]

    This rewrites the testcase for PR109752 to make it simpler and more
    robust (i.e. no longer dependent on r13-4035-gc41bbfcaf9d6ef).

            PR c++/109752

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-pr109752.C: Rename to ...
            * g++.dg/cpp2a/concepts-complete4.C: ... this.  Rewrite.

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

* [Bug c++/109752] [13 regression] ICE in check_complete_insertion, at hash-table.h:578 since r13-4937
  2023-05-05 17:50 [Bug c++/109752] New: [ICE] in check_complete_insertion, at hash-table.h:578 ldalessandro at gmail dot com
                   ` (10 preceding siblings ...)
  2023-05-12 12:38 ` cvs-commit at gcc dot gnu.org
@ 2023-05-12 12:47 ` ppalka at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-05-12 12:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.2                        |14.0
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #11 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed on trunk; this doesn't seem worth backporting.

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

end of thread, other threads:[~2023-05-12 12:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-05 17:50 [Bug c++/109752] New: [ICE] in check_complete_insertion, at hash-table.h:578 ldalessandro at gmail dot com
2023-05-05 17:52 ` [Bug c++/109752] " pinskia at gcc dot gnu.org
2023-05-05 17:52 ` pinskia at gcc dot gnu.org
2023-05-05 18:00 ` ldalessandro at gmail dot com
2023-05-05 18:08 ` ldalessandro at gmail dot com
2023-05-05 19:35 ` pinskia at gcc dot gnu.org
2023-05-06 22:08 ` redi at gcc dot gnu.org
2023-05-06 22:10 ` redi at gcc dot gnu.org
2023-05-08 14:40 ` [Bug c++/109752] [13/14 regression] ICE in check_complete_insertion, at hash-table.h:578 since r13-4937 ppalka at gcc dot gnu.org
2023-05-09 19:08 ` cvs-commit at gcc dot gnu.org
2023-05-09 19:10 ` [Bug c++/109752] [13 " ppalka at gcc dot gnu.org
2023-05-12 12:38 ` cvs-commit at gcc dot gnu.org
2023-05-12 12:47 ` ppalka 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).