[LU-4368] lustre_user.h calls offsetof() with non-constant expression Created: 09/Dec/13 Updated: 21/Feb/14 Resolved: 21/Feb/14 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Ned Bass | Assignee: | WC Triage |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Severity: | 3 |
| Rank (Obsolete): | 11962 |
| Description |
|
GCC supports offsetof() on non-constant expressions but in general this is compiler-dependent behavior. In particular, the IBM XLC does not support it. Since luster_user.h may be used by user applications, we should try to make the header as portable as possible. This is the function: /** Compute the current length of the provided hsm_user_request. */ static inline int hur_len(struct hsm_user_request *hur) { return offsetof(struct hsm_user_request, hur_user_item[hur->hur_request.hr_itemcount]) + hur->hur_request.hr_data_len; } Building the header with the IBM compilers produces this error: "/usr/local/tools/liblustre/include/lustre/lustre_user.h", line 1006.55: 1506-307 (S) Array index must be a constant expression in the offsetof macro. |
| Comments |
| Comment by Ned Bass [ 09/Dec/13 ] |
|
Already fixed under |