[Bug c++/90659] [9/10 Regression] ICE in tree_to_uhwi, at tree.h:4352/7291

2019-11-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90659

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek  ---
Started with r269292 aka PR86969 fix.

[Bug c++/90659] [9/10 Regression] ICE in tree_to_uhwi, at tree.h:4352/7291

2019-11-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90659

--- Comment #7 from Jakub Jelinek  ---
The following fixes the ICE:

--- gcc/cp/constexpr.c.jj   2019-11-16 18:13:28.524822284 +0100
+++ gcc/cp/constexpr.c  2019-11-18 19:38:40.032618830 +0100
@@ -39,7 +39,7 @@ along with GCC; see the file COPYING3.
 static bool verify_constant (tree, bool, bool *, bool *);
 #define VERIFY_CONSTANT(X) \
 do {   \
-  if (verify_constant ((X), ctx->quiet, non_constant_p, overflow_p)) \
+  if (verify_constant ((X), ctx->quiet, non_constant_p, overflow_p))   \
 return t;  \
  } while (0)

@@ -3405,7 +3405,11 @@ cxx_eval_vec_init_1 (const constexpr_ctx

   tree nelts = get_array_or_vector_nelts (ctx, atype, non_constant_p,
  overflow_p);
-  unsigned HOST_WIDE_INT max = tree_to_uhwi (nelts);
+  unsigned HOST_WIDE_INT max;
+  if (verify_constant (nelts, ctx->quiet, non_constant_p, overflow_p))
+max = 0;
+  else
+max = tree_to_uhwi (nelts);
   for (i = 0; i < max; ++i)
 {
   tree idx = build_int_cst (size_type_node, i);
--- gcc/testsuite/g++.dg/cpp0x/pr90659.C.jj 2019-11-18 19:41:14.805308816
+0100
+++ gcc/testsuite/g++.dg/cpp0x/pr90659.C2019-11-18 19:43:50.630983085
+0100
@@ -0,0 +1,17 @@
+// PR c++/90659
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+template 
+void
+foo (int n)
+{
+  T a[n];
+  [=]{ a; };
+}
+
+void
+bar ()
+{
+  foo ;
+}

but the testcase still FAILs with -std=gnu++17/2a with weird errors:
/usr/src/gcc/gcc/testsuite/g++.dg/cpp0x/pr90659.C:10:3: error: name '__a' used
in a GNU-style designated initializer for an array
/usr/src/gcc/gcc/testsuite/g++.dg/cpp0x/pr90659.C:10:3: error: cannot convert
'double*' to 'double' in initialization

and e.g. with auto f = [=]{ a; }; instead it still ICEs elsewhere - in
check_initializer.  Having a VLA return from a lambda isn't the best idea...

[Bug c++/90659] [9/10 Regression] ICE in tree_to_uhwi, at tree.h:4352/7291

2019-05-28 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90659

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-05-28
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed.

[Bug c++/90659] [9/10 Regression] ICE in tree_to_uhwi, at tree.h:4352/7291

2019-05-28 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90659

--- Comment #2 from Marek Polacek  ---
The crash is here:

3126  unsigned HOST_WIDE_INT max = tree_to_uhwi (nelts);

(gdb) p nelts
$1 = 
(gdb) pge
(sizetype) (SAVE_EXPR <(ssizetype) n + -1>) + 1

[Bug c++/90659] [9/10 Regression] ICE in tree_to_uhwi, at tree.h:4352/7291

2019-05-28 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90659

--- Comment #3 from Marek Polacek  ---
Looks like missing verify_constant after the get_array_or_vector_nelts call.

[Bug c++/90659] [9/10 Regression] ICE in tree_to_uhwi, at tree.h:4352/7291

2019-05-28 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90659

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2
   Target Milestone|--- |9.2

[Bug c++/90659] [9/10 Regression] ICE in tree_to_uhwi, at tree.h:4352/7291

2019-06-18 Thread gs...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90659

--- Comment #4 from G. Steinmetz  ---

A modified variant :


$ cat z2.cc
template 
void foo (int n)
{
  int a[n];
  [a]{};
}
void bar ()
{
  foo (2);
}

[Bug c++/90659] [9/10 Regression] ICE in tree_to_uhwi, at tree.h:4352/7291

2019-08-12 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90659

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|9.2 |9.3

--- Comment #5 from Jakub Jelinek  ---
GCC 9.2 has been released.

[Bug c++/90659] [9/10 Regression] ICE in tree_to_uhwi, at tree.h:4352/7291

2020-03-12 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90659

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|9.3 |9.4

--- Comment #8 from Jakub Jelinek  ---
GCC 9.3.0 has been released, adjusting target milestone.