Error compiling ATTRIBUTE_ALIGNED (workaround suggested)
Lennart Börjeson
lenborje at gmail.com
Fri May 4 12:06:47 UTC 2018
To whom it may concern,
after my latest hg pull -u, I get the following error compiling ZGC (partial output):
Compiling 300 files for BUILD_jdk.javadoc.interim
In file included from /home/lennartb/zgc/src/hotspot/share/utilities/globalDefinitions.hpp:32:0,
from /home/lennartb/zgc/src/hotspot/share/utilities/align.hpp:28,
from /home/lennartb/zgc/src/hotspot/share/runtime/globals.hpp:29,
from /home/lennartb/zgc/src/hotspot/share/memory/allocation.hpp:28,
from /home/lennartb/zgc/src/hotspot/share/oops/array.hpp:28,
from /home/lennartb/zgc/src/hotspot/share/memory/universe.hpp:28,
from /home/lennartb/zgc/src/hotspot/share/code/oopRecorder.hpp:28,
from /home/lennartb/zgc/src/hotspot/share/asm/codeBuffer.hpp:28,
from /home/lennartb/zgc/src/hotspot/share/asm/assembler.hpp:28,
from /home/lennartb/zgc/src/hotspot/share/precompiled/precompiled.hpp:31:
/home/lennartb/zgc/src/hotspot/share/utilities/globalDefinitions_gcc.hpp:280:63: error: requested alignment is not an integer constant
#define ATTRIBUTE_ALIGNED(x) __attribute__((aligned(x)))
^
/home/lennartb/zgc/src/hotspot/share/gc/z/zMarkStack.hpp:97:36: note: in expansion of macro ‘ATTRIBUTE_ALIGNED’
ZMarkStackMagazineList _freelist ATTRIBUTE_ALIGNED(ZCacheLineSize);
^
/home/lennartb/zgc/src/hotspot/share/utilities/globalDefinitions_gcc.hpp:280:63: error: requested alignment is not an integer constant
#define ATTRIBUTE_ALIGNED(x) __attribute__((aligned(x)))
^
/home/lennartb/zgc/src/hotspot/share/gc/z/zMarkStack.hpp:98:36: note: in expansion of macro ‘ATTRIBUTE_ALIGNED’
ZMarkStackSpace _space ATTRIBUTE_ALIGNED(ZCacheLineSize);
^
I believe this is an error in GCC 4.8.5, which is the one my RedHat systems use. Cf. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53017 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53017>, which I think is relevant despite concerning vector_size and not aligned, since when I patch globalDefinitions_gcc.hpp thus:
$ hg diff
diff -r c585f4a40572 src/hotspot/share/utilities/globalDefinitions_gcc.hpp
--- a/src/hotspot/share/utilities/globalDefinitions_gcc.hpp Mon Apr 30 11:35:42 2018 +0200
+++ b/src/hotspot/share/utilities/globalDefinitions_gcc.hpp Fri May 04 13:58:34 2018 +0200
@@ -277,6 +277,6 @@
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
// Alignment
-#define ATTRIBUTE_ALIGNED(x) __attribute__((aligned(x)))
+#define ATTRIBUTE_ALIGNED(x) __attribute__((aligned(x+0)))
#endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_GCC_HPP
the error disappeared and all is well.
Best regards,
/Lennart
More information about the zgc-dev
mailing list