aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2019-05-01 14:22:57 -0600
committerBrian Paul <[email protected]>2019-05-01 20:06:54 -0600
commit413e55b5b99d7d135624f461797d450745b3bfbf (patch)
tree713ef87c9725edabd984b14f2b07ac585665add6
parent96540e4f0a99252bcd402a216525df84d9d74364 (diff)
glsl: work around MinGW 7.x compiler bug
I'm not sure what triggered this, but building with scons platform=windows toolchain=crossmingw machine=x86 build=profile with MinGW g++ 7.3 or 7.4 causes an internal compiler error. We can work around it by forcing -O1 optimization. Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Neha Bhende <[email protected]>
-rw-r--r--src/compiler/glsl/builtin_variables.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
index 17ee80cd419..1b9963a530a 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -21,6 +21,21 @@
* DEALINGS IN THE SOFTWARE.
*/
+
+/**
+ * Building this file with MinGW g++ 7.3 or 7.4 with:
+ * scons platform=windows toolchain=crossmingw machine=x86 build=profile
+ * triggers an internal compiler error.
+ * Overriding the optimization level to -O1 works around the issue.
+ * MinGW 5.3.1 does not seem to have the bug, neither does 8.3. So for now
+ * we're simply testing for version 7.x here.
+ */
+#if defined(__MINGW32__) && __GNUC__ == 7
+#warning "disabling optimizations for this file to work around compiler bug in MiGW gcc 7.x"
+#pragma GCC optimize("O1")
+#endif
+
+
#include "ir.h"
#include "ir_builder.h"
#include "linker.h"