[Bug c++/120320] g++ freezes forever

2025-05-24 Thread gessos.paul at yahoo dot gr via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120320

--- Comment #4 from Chameleon  ---
Indeed, avoiding determining which of these partial specializations is most
constrained, fixes the problem.

But, the failed algorithm, if not fixed to handle HUGE DNF/CNF constraints, at
least it must produce a bailing-out diagnostic.

[Bug c++/120320] g++ freezes forever

2025-05-17 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120320

--- Comment #3 from Patrick Palka  ---
or rather:

--- a/matrix.h
+++ b/matrix.h
@@ -1187,7 +1187,9 @@ struct storage_mul
 Specialization for DenseMatrix * Matrix or Matrix * DenseMatrix or
SparseMatrix * Matrix or
 Matrix * SparseMatrix. */
 template
-requires(DenseMatrix || DenseMatrix || SparseMatrix ||
SparseMatrix)
+requires(DenseMatrix || DenseMatrix
+ || (!DiagonalMatrix && !DiagonalMatrix
+ && (SparseMatrix || SparseMatrix)))
 struct storage_mul
 {
storage_mul() = delete;

[Bug c++/120320] g++ freezes forever

2025-05-17 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120320

--- Comment #2 from Patrick Palka  ---
The problem is the CNF/DNF of the constraints in

template
requires(DenseMatrix || DenseMatrix || SparseMatrix ||
SparseMatrix)
struct storage_mul

template
struct storage_mul

template
struct storage_mul

are all huge, which makes determining which of these partial specializations is
most constrained not feasible via the ordinary subsumption algorithm.

Assuming the intent is to make the second and third partial specializations
above preferred over the first one, a workaround is to make this preference
more obvious, e.g. by adding potentially redundant constraints:

@@ -1187,7 +1187,7 @@ struct storage_mul
 Specialization for DenseMatrix * Matrix or Matrix * DenseMatrix or
SparseMatrix * Matrix or
 Matrix * SparseMatrix. */
 template
-requires(DenseMatrix || DenseMatrix || SparseMatrix ||
SparseMatrix)
+requires(!DiagonalMatrix) && (!DiagonalMatrix) && (DenseMatrix ||
DenseMatrix || SparseMatrix || SparseMatrix)
 struct storage_mul
 {
storage_mul() = delete;

[Bug c++/120320] g++ freezes forever

2025-05-17 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120320

Richard Biener  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2025-05-17
 Status|UNCONFIRMED |NEW
   Keywords||compile-time-hog,
   ||needs-reduction
 CC||ppalka at gcc dot gnu.org

--- Comment #1 from Richard Biener  ---
Confirmed.  It never finishes subsumes_constraints_nonnull (), thus proving
some constraints.