8220283: ZGC fails to build on GCC 4.4.7: ATTRIBUTE_ALIGNED compatibility issue
Reviewed-by: shade, kbarrett
--- 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