http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57199

--- Comment #8 from Paul Pluzhnikov <ppluzhnikov at google dot com> ---
(In reply to Mikhail Veltishchev from comment #7)

> Please, can you explain how you fixed this? We have almost the same problem.

Here is the fix we deployed (test case from comment#2):

$ diff -u pr57199.cc pr57199a.cc
--- pr57199.cc  2014-03-26 13:50:25.682351842 -0700
+++ pr57199a.cc 2014-03-26 13:54:12.880279926 -0700
@@ -18,6 +18,9 @@
       DestroyElements(mutable_array() + n, s - n);
   }
   static void DestroyElements(T* ptr, size_t num) {
+    if (__builtin_expect (num == (size_t) -1, 0)) {
+      __builtin_unreachable();
+    }
     for (size_t i = 0; i < num; i++) {
       ptr[i].~T();
     }

Reply via email to