Bug 211540 - 11.0-BETA4 -r303759 build via amd64-gcc: sys/dev/hptmv/vdevice.h:145:2: error: variably modified '_ArrayTables' at file scope; more
Summary: 11.0-BETA4 -r303759 build via amd64-gcc: sys/dev/hptmv/vdevice.h:145:2: error...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.0-BETA3
Hardware: Any Any
: --- Affects Only Me
Assignee: Ryan Libby
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-03 07:33 UTC by Mark Millard
Modified: 2019-01-21 19:13 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Millard 2016-08-03 07:33:04 UTC
This is from attempting to build for amd64 via amd64-gcc instead of clang 3.8.0.

--- all_subdir_hptmv ---
In file included from /usr/src/sys/dev/hptmv/global.h:197:0,
                 from /usr/src/sys/modules/hptmv/../../dev/hptmv/mv.c:42:
/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];
  ^
. . .
--- entry.o ---
In file included from /usr/src/sys/dev/hptmv/global.h:197:0,
                 from /usr/src/sys/modules/hptmv/../../dev/hptmv/entry.c:54:
/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];
  ^
. . .
--- all_subdir_hptmv ---
/usr/src/sys/modules/hptmv/../../dev/hptmv/entry.c: In function 'hpt_poll':
/usr/src/sys/modules/hptmv/../../dev/hptmv/entry.c:2091:17: warning: variable 'pAdapter' set but not used [-Wunused-but-set-variable]
  IAL_ADAPTER_T *pAdapter;
                 ^
cc1: all warnings being treated as errors


Context:

# uname -apKU
FreeBSD FreeBSDx64 11.0-BETA3 FreeBSD 11.0-BETA3 #2 r303691M: Tue Aug  2 23:40:42 PDT 2016     markmi@FreeBSDx64:/usr/obj/clang/amd64.amd64/usr/src/sys/GENERIC-NODBG  amd64 amd64 1100120 1100120
Comment 1 Mark Millard 2016-08-05 01:42:16 UTC
(In reply to Mark Millard from comment #0)

Now reproduced in trying to build 11.0-BETA4 -r303759. But there is no 11.0-BETA4 Version selection available yet. So use 11.0-BETA3 selection for now.



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 is what is being complained about for its use in typedef struct _VBus at file scope.
Comment 2 commit-hook freebsd_committer 2017-07-06 05:32:35 UTC
A commit references this bug:

Author: rlibby
Date: Thu Jul  6 05:32:22 UTC 2017
New revision: 320714
URL: https://svnweb.freebsd.org/changeset/base/320714

Log:
  hptmv: avoid gcc variably-modified warning

  gcc produces a "variably modified X at file scope" warning for
  structures that use these size definitions.

  PR:		211540
  Reviewed by:	markj
  Approved by:	markj (mentor)
  Sponsored by:	Dell EMC Isilon
  Differential revision:	https://reviews.freebsd.org/D11416

Changes:
  head/sys/dev/hptmv/vdevice.h
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:49:09 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Comment 4 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2019-01-21 19:13:35 UTC
There is a commit referencing this PR, but it's still not closed and has been inactive for some time. Closing the PR as fixed but feel free to re-open it if the issue hasn't been completely resolved.

Thanks