ra-11.cc 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // -*- mode: c++; coding: utf-8 -*-
  2. /// @file ra-11.cc
  3. /// @brief Reduce a bug in gcc 8.3
  4. // (c) Daniel Llorens - 2013-2015
  5. // This library is free software; you can redistribute it and/or modify it under
  6. // the terms of the GNU Lesser General Public License as published by the Free
  7. // Software Foundation; either version 3 of the License, or (at your option) any
  8. // later version.
  9. #include <iostream>
  10. #include <iterator>
  11. #include <numeric>
  12. #include "ra/test.hh"
  13. #include "ra/ra.hh"
  14. #include "ra/mpdebug.hh"
  15. using std::cout, std::endl, std::flush, ra::TestRecorder;
  16. int main()
  17. {
  18. TestRecorder tr(std::cout);
  19. {
  20. double b[6] = { 1, 2, 3, 4, 5, 6 };
  21. ra::View<double *> ra { {6}, b }; // FIXME [ra28]
  22. tr.test_eq(b, ra);
  23. ra::Unique<double> A({2, 3}, 0);
  24. tr.test_eq(ra::Small<ra::dim_t, 2> {2, 3}, shape(iter<-2>(A)));
  25. tr.test_eq(ra::Small<ra::dim_t, 1> {2}, shape(iter<-1>(A)));
  26. double pool[6] = { 1, 2, 3, 4, 5, 6 };
  27. ra::Unique<double> u({3, 2}, pool, pool+6);
  28. tr.test(std::equal(pool, pool+6, u.begin()));
  29. ra::Unique<double> q(ra::scalar(44));
  30. tr.test_eq(1, q.size());
  31. double rpool[6] = { 1, 2, 3, 4, 5, 6 };
  32. ra::View<double *, 2> r { {{3, 1}, {2, 3}}, rpool }; // FIXME [ra28]
  33. double rcheck[6] = { 1, 4, 2, 5, 3, 6 };
  34. tr.test(std::equal(rcheck, rcheck+6, r.at(ra::Big<int>({0}, {})).begin()));
  35. }
  36. return tr.summary();
  37. }
  38. // copy ra-0.cc to dum0.cc and
  39. // git bisect run sh -c '/opt/gcc-8.3/bin/g++ -o src/ext/ra/test/dum0 -std=c++17 -Wall -Werror -fdiagnostics-color=always -Wno-unknown-pragmas -finput-charset=UTF-8 -fextended-identifiers -Wno-error=strict-overflow -Werror=zero-as-null-pointer-constant -O3 -march=native -Isrc/ext/ra -Isrc/ext/ra/test src/ext/ra/test/dum0.cc && src/ext/ra/test/dum0'