Variably modified at file scope
gcc 4.8.2 produced the following error message while it was building in usr/src/uts/sun4u/unix:
In file included from ../../sfmmu/vm/xhat_sfmmu.c:35:0:
../../sfmmu/vm/xhat_sfmmu.h:56:23: error: variably modified 'xblk_pad1' at file scope [-Werror]
sizeof (struct xhat *))
../../sfmmu/vm/xhat_sfmmu.h:68:19: note: in expansion of macro 'XHAT_PADHI'
../../sfmmu/vm/xhat_sfmmu.h:60:21: error: variably modified 'xblk_pad2' at file scope [-Werror]
sizeof (struct hme_blk_misc)))
../../sfmmu/vm/xhat_sfmmu.h:70:19: note: in expansion of macro 'XHAT_PADLO'
cc1: all warnings being treated as errors
The solution is to use the builtin offsetof() function of gcc for gcc. The Studio compiler generates no errors for the original code. I've attached the patch file.