Project

General

Profile

Bug #5457

Variably modified at file scope

Added by Gary Mills over 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
kernel
Start date:
2014-12-21
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

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'
char xblk_pad1[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'
char xblk_pad2[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.


Files

xhat.diff (670 Bytes) xhat.diff Gary Mills, 2014-12-21 02:58 AM

Related issues

Is duplicate of illumos gate - Bug #3373: gcc >= 4.5 concerns about offsetof()Closed2012-11-18

Actions

History

#1

Updated by Igor Kozhukhov over 5 years ago

i have more places with updates:

#if defined(__GNUC__)
#define offsetof(s, m)  __builtin_offsetof(s, m)
#else
#define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))
#endif

#2

Updated by Rich Lowe over 4 years ago

  • Is duplicate of Bug #3373: gcc >= 4.5 concerns about offsetof() added
#3

Updated by Rich Lowe over 4 years ago

  • Status changed from New to Closed

duplicate of #3373

#4

Updated by Josef Sipek over 4 years ago

Also, #6345 removed the xhat code anyway.

Also available in: Atom PDF