Mark Millard
2016-Aug-14 04:37 UTC
stable/11 -r304029: amd64-gcc says: sys/dev/hptmv/vdevice.h error: variably modified '_ArrayTables' at file scope
[This was part of Bugzilla report 211540 against the HighPoint RocketRAID 182x driver code. My -r304029 build attempt using -r304029 still reports the error. This note is just about a build-ability problem under amd64-gcc: I only tried it to add to the testing of 11.0. I'm personally not blocked by the problem.] Attempting to build stable/11 -r304029 for TARGET_ARCH=amd64 with amd64-gcc (amd64-xtoolchain-gcc) reports: /usr/src/sys/dev/hptmv/vdevice.h:145:2: error: variably modified '_ArrayTables' at file scope [-Werror] BYTE _ArrayTables[MAX_ARRAY_PER_VBUS * ARRAY_VDEV_SIZE]; ^ The "variably modified '_ArrayTables' at file scope" messages refer to (various .h files contributing): #define MAX_VDEVICE_PER_VBUS 8 . . . #ifndef MAX_ARRAY_PER_VBUS #define MAX_ARRAY_PER_VBUS (MAX_VDEVICE_PER_VBUS*2) /* worst case */ #endif . . . #define ARRAY_VDEV_SIZE ((UINT)(ULONG_PTR)&((PVDevice)0)->u+sizeof(RaidArray)) . . . typedef struct _VBus { . . . #ifdef SUPPORT_ARRAY PVDevice pFreeArrayLink; BYTE _ArrayTables[MAX_ARRAY_PER_VBUS * ARRAY_VDEV_SIZE]; #endif . . . } VBus; ARRAY_VDEV_SIZE from /usr/src/sys/dev/hptmv/vdevice.h is what is being complained about for its use in typedef struct _VBus's _ArrayTables field at file scope. amd64-gcc does not treat ((UINT)(ULONG_PTR)&((PVDevice)0)->u+sizeof(RaidArray)) as a known constant where such is required in the _ArrayTables field declaration. /usr/src/sys/dev/hptmv/vdevice.h having ((UINT)(ULONG_PTR)&((PVDevice)0)->u+sizeof(RaidArray)) for ARRAY_VDEV_SIZE goes back to -r136849 and the file's creation on 2004-Oct-24. It appears that SUPPORT_ARRAY was defined back then. SO the code is old. Context details: # svnlite info /usr/src/ | grep "Rev[i:]" you have mail Revision: 304029 Last Changed Rev: 304029 # uname -apKU FreeBSD FreeBSDx64 11.0-PRERELEASE FreeBSD 11.0-PRERELEASE #4 r304029M: Sat Aug 13 00:40:30 PDT 2016 markmi at FreeBSDx64:/usr/obj/clang/amd64.amd64/usr/src/sys/GENERIC-NODBG amd64 amd64 1100500 1100500 # more ~/src.configs/src.conf.amd64-xtoolchain.amd64-host TO_TYPE=amd64 TOOLS_TO_TYPE=x86_64 VERSION_CONTEXT=11.0 # KERNCONF=GENERIC-NODBG TARGET=${TO_TYPE} .if ${.MAKE.LEVEL} == 0 TARGET_ARCH=${TO_TYPE} .export TARGET_ARCH .endif # WITHOUT_CROSS_COMPILERWITHOUT_SYSTEM_COMPILER# WITH_LIBCPLUSPLUSWITHOUT_BINUTILS_BOOTSTRAPWITHOUT_CLANG_BOOTSTRAPWITH_CLANGWITH_CLANG_IS_CCWITH_CLANG_FULLWITH_CLANG_EXTRASWITH_LLDB#PORTS_MODULES=emulators/virtualbox-ose-additions # #WITH_BOOT= for amd64-xtoolschain-gcc/amd64-gcc gets something like... # --- all_subdir_sys --- # -994 bytes available # *** [boot2] Error code 1 WITHOUT_BOOTWITH_LIB32# WITHOUT_ELFTOOLCHAIN_BOOTSTRAPWITHOUT_GCC_BOOTSTRAPWITHOUT_GCCWITHOUT_GCC_IS_CCWITHOUT_GNUCXX# NO_WERROR#WERRORMALLOC_PRODUCTION# WITH_DEBUG_FILES# # # For TO (so-called "cross") stages . . . # So-called-cross via ${TO_TYPE}-xtoolchain-gcc/${TO_TYPE}-gcc. . . # TOOLS_TO_TYPE based on ${TO_TYPE}-xtoolchain-gcc related binutils. . . # CROSS_TOOLCHAIN=${TO_TYPE}-gcc X_COMPILER_TYPE=gcc CROSS_BINUTILS_PREFIX=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ .if ${.MAKE.LEVEL} == 0 XCC=/usr/local/bin/${TOOLS_TO_TYPE}-portbld-freebsd${VERSION_CONTEXT}-gcc XCXX=/usr/local/bin/${TOOLS_TO_TYPE}-portbld-freebsd${VERSION_CONTEXT}-g++ XCPP=/usr/local/bin/${TOOLS_TO_TYPE}-portbld-freebsd${VERSION_CONTEXT}-cpp .export XCC .export XCXX .export XCPP XAS=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/as XAR=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ar XLD=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ld XNM=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/nm XOBJCOPY=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/objcopy XOBJDUMP=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/objdump XRANLIB=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ranlib XSIZE=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/size #NO-SUCH: XSTRINGS=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/strings XSTRINGS=/usr/local/bin/${TOOLS_TO_TYPE}-freebsd-strings .export XAS .export XAR .export XLD .export XNM .export XOBJCOPY .export XOBJDUMP .export XRANLIB .export XSIZE .export XSTRINGS .endif # # # From based on clang (via system). . . # .if ${.MAKE.LEVEL} == 0 CC=/usr/bin/clang CXX=/usr/bin/clang++ CPP=/usr/bin/clang-cpp .export CC .export CXX .export CPP .endif # more ~/src.configs/make.conf CFLAGS.gcc+= -v ==Mark Millard markmi at dsl-only.net