[Bug c++/91548] [10 Regression] Regression in constexpr evaluation of std::array

2019-10-29 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91548

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #11 from Marek Polacek  ---
Fixed.

[Bug c++/91548] [10 Regression] Regression in constexpr evaluation of std::array

2019-10-29 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91548

--- Comment #10 from Marek Polacek  ---
Author: mpolacek
Date: Tue Oct 29 20:34:43 2019
New Revision: 277591

URL: https://gcc.gnu.org/viewcvs?rev=277591=gcc=rev
Log:
PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.

This fixes a bogus "modifying a const object" error for an array that actually
isn't declared const.  The problem was how I handled ARRAY_REFs here; we
shouldn't look at the ARRAY_REF itself, but at the array its accessing.

* constexpr.c (cxx_eval_store_expression): Don't call
modifying_const_object_p for ARRAY_REF.

* g++.dg/cpp1y/constexpr-tracking-const15.C: New test.
* g++.dg/cpp1y/constexpr-tracking-const16.C: New test.
* g++.dg/cpp1z/constexpr-tracking-const1.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const15.C
trunk/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const16.C
trunk/gcc/testsuite/g++.dg/cpp1z/constexpr-tracking-const1.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/constexpr.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/91548] [10 Regression] Regression in constexpr evaluation of std::array

2019-10-27 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91548

Marek Polacek  changed:

   What|Removed |Added

 CC||euloanty at live dot com

--- Comment #9 from Marek Polacek  ---
*** Bug 92238 has been marked as a duplicate of this bug. ***

[Bug c++/91548] [10 Regression] Regression in constexpr evaluation of std::array

2019-10-23 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91548

Marek Polacek  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #8 from Marek Polacek  ---
Patch posted: https://gcc.gnu.org/ml/gcc-patches/2019-10/msg01685.html

[Bug c++/91548] [10 Regression] Regression in constexpr evaluation of std::array

2019-10-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91548

--- Comment #7 from Marek Polacek  ---
Thanks.

Reduced (no templates, no lambda):

constexpr int& impl(const int ()[10], int index) {
  return const_cast(array[index]);
}

struct A {
  constexpr int& operator[](int i) { return impl(elems, i); }
  int elems[10];
};

constexpr bool
f()
{
  A arr = {};
  arr[2] = true;
  return false;
}

constexpr bool b = f();

[Bug c++/91548] [10 Regression] Regression in constexpr evaluation of std::array

2019-10-22 Thread h2+bugs at fsfe dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91548

--- Comment #6 from Hannes Hauswedell  ---
To make the test only complain about the current issue, change line 20 in
include/seqan3/std/span to

```
#if 0
```

Regards,
Hannes

[Bug c++/91548] [10 Regression] Regression in constexpr evaluation of std::array

2019-10-22 Thread h2+bugs at fsfe dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91548

--- Comment #5 from Hannes Hauswedell  ---
(In reply to Marek Polacek from comment #4)
> (In reply to Hannes Hauswedell from comment #2)
> > Any news on this issue? We are using this pattern in some rather central
> > files in our library and the bug literally breaks 90% of our unit tests so
> > we can't keep track of other gcc10 issues or try the new concepts support...
> > 
> > Thank you for your help!
> 
> BTW, is the library publicly accessible?  If it is, I could try to compile
> it when I have a fix for this to make sure it's resolved.

Sure, thanks for looking into this!

The library is available here:
https://github.com/seqan/seqan3/

Instructions for setting up unit tests are available here:
https://docs.seqan.de/seqan/3-master-user/setup_tests.html

The currently failing tests are visible here:
http://cdash.seqan.de/index.php?project=SeqAn3
Under "Nightly: unit", "FreeBSD unit Debug g++10 -std=c++2a"
Note that due to the recent arrival of C++20 concepts in gcc-trunk, other
things are currently broken with so you need to explicitly provide "-std=c++17
-fconcepts" (and not trust the auto detection of our cmake config).

Making e.g. "view_to_lower_test" should trigger the problem from this PR
(although I just saw that it also has a seemingly unrelated problem with not
finding std::span, just ignore that).

[Bug c++/91548] [10 Regression] Regression in constexpr evaluation of std::array

2019-10-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91548

--- Comment #4 from Marek Polacek  ---
(In reply to Hannes Hauswedell from comment #2)
> Any news on this issue? We are using this pattern in some rather central
> files in our library and the bug literally breaks 90% of our unit tests so
> we can't keep track of other gcc10 issues or try the new concepts support...
> 
> Thank you for your help!

BTW, is the library publicly accessible?  If it is, I could try to compile it
when I have a fix for this to make sure it's resolved.

[Bug c++/91548] [10 Regression] Regression in constexpr evaluation of std::array

2019-10-21 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91548

--- Comment #3 from Marek Polacek  ---
Sorry about that.  I've been working on new C++20 features in the dwindling
stage 1 time, and kept kicking this can down the stage3 road.  But hopefully
I'll get to this after posting my aggregate paren init patch, which should be
Real Soon.

Unfortunately, there's no way to turn off the const checking.

[Bug c++/91548] [10 Regression] Regression in constexpr evaluation of std::array

2019-10-21 Thread h2+bugs at fsfe dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91548

Hannes Hauswedell  changed:

   What|Removed |Added

 CC||h2+bugs at fsfe dot org

--- Comment #2 from Hannes Hauswedell  ---
Any news on this issue? We are using this pattern in some rather central files
in our library and the bug literally breaks 90% of our unit tests so we can't
keep track of other gcc10 issues or try the new concepts support...

Thank you for your help!

[Bug c++/91548] [10 Regression] Regression in constexpr evaluation of std::array

2019-08-26 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91548

Marek Polacek  changed:

   What|Removed |Added

   Priority|P3  |P1

[Bug c++/91548] [10 Regression] Regression in constexpr evaluation of std::array

2019-08-26 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91548

Marek Polacek  changed:

   What|Removed |Added

   Target Milestone|--- |10.0
Summary|Regression in constexpr |[10 Regression] Regression
   |evaluation of std::array|in constexpr evaluation of
   ||std::array