From 8e1b5dda4bbf55f303b15d61968ad72766a04127 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Fri, 15 May 2015 12:39:53 +0100 Subject: [PATCH] Log the bug report code into the git repo. --- gcc-bug-report/README | 23 ++++++++++++++++ gcc-bug-report/broken.cc | 59 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 gcc-bug-report/README create mode 100644 gcc-bug-report/broken.cc diff --git a/gcc-bug-report/README b/gcc-bug-report/README new file mode 100644 index 00000000..294d0a6c --- /dev/null +++ b/gcc-bug-report/README @@ -0,0 +1,23 @@ +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66153 + +Grid code breaks on GCC4.8, 4.9, 5.0 due to the +peekIndex operating on lattice. + +It erroneously recurses back into the Lattice variant, even though +the lattice container is dropped. + +Work around is possible; if the Lattice routine is given a disambiguating +name prefix, such as + +latPeekIndex + +GCC5 works. + +However this is ugly and for now I have submitted a bug report to see the reaction and +speed of fixing. + +The simple testcase in this directory is the submitted bug report that encapsulates the +problem. The test case works with icpc and with clang++, but fails consistently on g++ +current variants. + +Peter \ No newline at end of file diff --git a/gcc-bug-report/broken.cc b/gcc-bug-report/broken.cc new file mode 100644 index 00000000..bd403e85 --- /dev/null +++ b/gcc-bug-report/broken.cc @@ -0,0 +1,59 @@ +#include +#include +#include +#include + +typedef std::complex ComplexD; + +template class TypeMapper { +public: + enum { NestLevel = T::NestLevel }; +}; + +template<> class TypeMapper { +public: + enum { NestLevel = 0 }; +}; + +template class Container { + public: + std::vector data; + Container(int size) : data (size){}; +}; + +template class Recursive { +public: + enum { NestLevel = TypeMapper::NestLevel + 1}; + obj internal; +}; + +template::type * = nullptr > auto function(const obj &arg)-> obj +{ + std::cout<<"Leaf "<::type * = nullptr > auto function(const obj &arg)-> obj +{ + std::cout<<"Node "<(arg.internal); + return ret; +} + +template auto function(const Container & arg)-> Container(arg.data[0]))> +{ + Container(arg.data[0]))> ret(arg.data.size()); + for(int ss=0;ss(arg.data[ss]); + } + return ret; +} + + +int main(int argc,char **argv) +{ + Container > > array(10); + Container > > ret(10); + + ret = function<1>(array); +}