- char buf[UINTMAX_STRSIZE_BOUND];
- ERROR ((0, 0, _("%s value %s is too large to fit in a %u-bit field"),
- type, STRINGIFY_BIGINT (value, buf),
- (unsigned) ((size - 1) * 3)));
+ uintmax_t maxval = MAX_OCTAL_VAL_WITH_DIGITS (size);
+ char buf1[UINTMAX_STRSIZE_BOUND];
+ char buf2[UINTMAX_STRSIZE_BOUND];
+ char buf3[UINTMAX_STRSIZE_BOUND];
+ char *value_string = STRINGIFY_BIGINT (value, buf1);
+ char *maxval_string = STRINGIFY_BIGINT (maxval, buf2);
+ if (substitute)
+ {
+ substitute &= maxval;
+ WARN ((0, 0, _("%s value %s too large (max=%s); substituting %s"),
+ type, value_string, maxval_string,
+ STRINGIFY_BIGINT (substitute, buf3)));
+ to_oct (substitute, (uintmax_t) 0, where, size, type);
+ }
+ else
+ ERROR ((0, 0, _("%s value %s too large (max=%s)"),
+ type, value_string, maxval_string));