[Bug c++/69261] [6 Regression] Copying char arrays during constexpr evaluation does not work reliably
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69261 --- Comment #8 from Jason Merrill --- Author: jason Date: Wed Mar 2 02:46:12 2016 New Revision: 233883 URL: https://gcc.gnu.org/viewcvs?rev=233883=gcc=rev Log: PR c++/69261 * constexpr.c (find_array_ctor_elt): Handle splitting RANGE_EXPR. Added: branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp1y/constexpr-array2.C Modified: branches/gcc-5-branch/gcc/cp/ChangeLog branches/gcc-5-branch/gcc/cp/constexpr.c
[Bug c++/69261] [6 Regression] Copying char arrays during constexpr evaluation does not work reliably
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69261 --- Comment #6 from Jason Merrill --- Author: jason Date: Thu Jan 14 15:32:31 2016 New Revision: 232370 URL: https://gcc.gnu.org/viewcvs?rev=232370=gcc=rev Log: PR c++/69261 * constexpr.c (find_array_ctor_elt): Handle splitting RANGE_EXPR. Added: trunk/gcc/testsuite/g++.dg/cpp1y/constexpr-array2.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/constexpr.c
[Bug c++/69261] [6 Regression] Copying char arrays during constexpr evaluation does not work reliably
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69261 Marek Polacek changed: What|Removed |Added Status|ASSIGNED|RESOLVED CC||mpolacek at gcc dot gnu.org Resolution|--- |FIXED --- Comment #7 from Marek Polacek --- So fixed.
[Bug c++/69261] [6 Regression] Copying char arrays during constexpr evaluation does not work reliably
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69261 --- Comment #4 from Jens Auer --- It produces the correct results if you change foo to not use constexpr: void foo() { auto const s1 = s( "bla" ); auto const s2 = s( "blu" ); string_constexpr<7> const s1s2 = concat(s1,s2); auto constexpr c = concat("bla", "blu"); std::cout << s1.data << std::endl << s2.data << std::endl << s1s2.data << std::endl << c << std::endl; } $ ./a.out bla blu blablu blablu
[Bug c++/69261] [6 Regression] Copying char arrays during constexpr evaluation does not work reliably
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69261 --- Comment #5 from Jason Merrill --- *** Bug 69263 has been marked as a duplicate of this bug. ***
[Bug c++/69261] [6 Regression] Copying char arrays during constexpr evaluation does not work reliably
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69261 Jason Merrill changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
[Bug c++/69261] [6 Regression] Copying char arrays during constexpr evaluation does not work reliably
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69261 Jakub Jelinek changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2016-01-13 CC||jakub at gcc dot gnu.org, ||jason at gcc dot gnu.org Target Milestone|--- |6.0 Summary|Copying char arrays during |[6 Regression] Copying char |constexpr evaluation does |arrays during constexpr |not work reliably |evaluation does not work ||reliably Ever confirmed|0 |1 --- Comment #3 from Jakub Jelinek --- The ICE started with r226949. Adjusted testcase without need for headers: typedef __SIZE_TYPE__ size_t; template struct S { constexpr S() = default; template constexpr S (char const ()[M]) : data { 0 } { static_assert (M <= N, "size!"); for (size_t i = 0; i != M; i++) data[i] = d[i]; } char data[N]; }; template constexpr S s (char const ()[N]) { S c {}; for (size_t i = 0; i != N; i++) c.data[i] = d[i]; return c; } template constexpr auto concat (S const& s1, S const& s2) { Ss (s1.data); for (size_t i = 0; i != M; i++) s.data[N + i - 1] = s2.data[i]; return s; } template constexpr auto concat (char const ()[N], char const ()[M]) { S tmp { x }; for (size_t i = 0; i != M; i++) tmp.data[N+i-1] = y[i]; return tmp; } int main () { auto constexpr s1 = s ("bla"); auto constexpr s2 = s ("blub"); S<8> constexpr s1s2 = concat (s1, s2); auto constexpr c = concat ("bla", "blub"); if (__builtin_strcmp (s1.data, "bla") || __builtin_strcmp (s2.data, "blub") || __builtin_strcmp (s1s2.data, "blablub") || __builtin_strcmp (c.data, "blablub")) __builtin_abort (); }