Workaround for GCC internal compiler error.
authorJarkko Pöyry <jpoyry@google.com>
Wed, 29 Oct 2014 22:36:04 +0000 (15:36 -0700)
committerJarkko Pöyry <jpoyry@google.com>
Wed, 29 Oct 2014 22:59:05 +0000 (15:59 -0700)
GCC 4.8.0 generates internal compiler error (assign_by_spills) in
RandomArrayGenerator::createQuads() when compiled with -march=prescott.
As a workaround for the error, disable inlining of
alignmentSafeAssignment() when compiling for x86 using the affected GCC
version.

Bug: 18171557
Bug: 18174291

Change-Id: I3c7120ab304941d943515f0e2713513779253380

modules/glshared/glsVertexArrayTests.cpp

index 4c9c19b..43aeb83 100644 (file)
@@ -460,7 +460,19 @@ inline GLValue::Double abs (GLValue::Double val)
 }
 
 template<class T>
-inline static void alignmentSafeAssignment (char* dst, T val)
+static
+#if (DE_COMPILER == DE_COMPILER_GCC) && (DE_CPU == DE_CPU_X86) && \
+       (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) && (__GNUC_PATCHLEVEL__ == 0)
+       // GCC 4.8.0 generates internal compiler error (assign_by_spills) in
+       // RandomArrayGenerator::createQuads() when compiled with -march=prescott.
+       // As a workaround for the error, disable inlining of
+       // alignmentSafeAssignment() when compiling for x86 using the affected GCC
+       // version.
+       __attribute__ ((noinline))
+#else
+       inline
+#endif
+void alignmentSafeAssignment (char* dst, T val)
 {
        std::memcpy(dst, &val, sizeof(T));
 }