8220283: ZGC fails to build on GCC 4.4.7: ATTRIBUTE_ALIGNED compatibility issue
authorsgehwolf
Thu, 07 Mar 2019 16:15:43 +0100
changeset 54030 889dae20c4c4
parent 54029 4ff6c8365b69
child 54031 feea57b38a1c
8220283: ZGC fails to build on GCC 4.4.7: ATTRIBUTE_ALIGNED compatibility issue Reviewed-by: shade, kbarrett
src/hotspot/share/utilities/globalDefinitions_gcc.hpp
--- a/src/hotspot/share/utilities/globalDefinitions_gcc.hpp	Thu Mar 07 19:35:02 2019 -0800
+++ b/src/hotspot/share/utilities/globalDefinitions_gcc.hpp	Thu Mar 07 16:15:43 2019 +0100
@@ -269,6 +269,9 @@
 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55382 and
 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53017
 //
-#define ATTRIBUTE_ALIGNED(x) __attribute__((aligned(x+0)))
+// GCC versions older than 4.6.4 would fail even with "+0", and needs additional
+// cast to typeof(x) to work around the similar bug.
+//
+#define ATTRIBUTE_ALIGNED(x) __attribute__((aligned((typeof(x))x+0)))
 
 #endif // SHARE_UTILITIES_GLOBALDEFINITIONS_GCC_HPP