[PATCH] D61046: Fix compilation warnings when compiling with GCC 7.3

Alexandre Ganea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 24 13:04:34 PDT 2019


aganea added inline comments.


================
Comment at: llvm/trunk/lib/Target/AMDGPU/R600ISelLowering.cpp:1717-1722
+    // Fix spurious warning with gcc 7.3 -O3 for NewBldVec[i] below
+    // warning: array subscript is above array bounds [-Warray-bounds]
+#if defined(__GNUC__) && __GNUC__ >= 7 && __GNUC_MINOR__ >= 3
+    if (i >= 4)
+      continue;
+#endif
----------------
tstellar wrote:
> We don't want to  have ifdefs for specific compilers, can this be fixed another way or dropped from the patch?
Removed ifdefs, but I kept the test. This looks like an optimizer issue in GCC, however the regression tests are unaffected by this change. I will c-reduce and report it if it's still there in the latest GCC.


================
Comment at: llvm/trunk/unittests/Transforms/Scalar/CMakeLists.txt:14-17
+# Workaround for the gcc 6.1 bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80916.
+if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
+  set_source_files_properties(LoopPassManagerTest.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-function)
+endif()
----------------
tstellar wrote:
> Same thing here too.
Not sure I understand, there're plenty of compiler-specific examples in the .cmake files. Is there an alternate way to fix this?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61046/new/

https://reviews.llvm.org/D61046





More information about the cfe-commits mailing list