Jö Fahlkechanged title from test-cornerstoragerefwrap segfaults on {-shared-ci@tu-dresden.de in job "debian:10 gcc-8-noassert-17"-} to test-cornerstoragerefwrap segfaults on AMD CPUs in job "debian:10 gcc-8-noassert-17" since gcc-8.2.0
changed title from test-cornerstoragerefwrap segfaults on {-shared-ci@tu-dresden.de in job "debian:10 gcc-8-noassert-17"-} to test-cornerstoragerefwrap segfaults on AMD CPUs in job "debian:10 gcc-8-noassert-17" since gcc-8.2.0
With all of the above parameters, the test segfaults.
With none of the above parameters, the test segfaults too.
With only -mavx (or -mavx2), the test passes.
If manually reduced the test to a call to Dune::ReferenceElements<double, 2>::cube() and am in the process of running a creduce. The interestingness test
compiles the preprocessed output with -mavx and requires it to exit with 0,
compiles the preprocessed output without -mavx and requires it to segfault.
I've tried your code on our AMD EPYC 7551P with GCC 8.2.0 and I get: pass= 10/10, fail= 10/10. I have repeated the compile-and-run test several times and always the same result.
const_cast makes it possible to form a reference or pointer to non-const type that is actually referring to a const object or a reference or pointer to non-volatile type that is actually referring to a volatile object. Modifying a const object through a non-const access path and referring to a volatile object through a non-volatile glvalue results in undefined behavior.
Hmm, the C++17 standard (§10.1.7.1 The cv-qualifiers) actually has several examples showing that taking a pointer-to-const to a non-const object, then casting away the constness of that pointer and modifying the object through the result is well-defined.