1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* intprops.h -- properties of integer types
4 
5    Copyright (C) 2001-2019 Free Software Foundation, Inc.
6 
7    This program is free software: you can redistribute it and/or modify it
8    under the terms of the GNU General Public License as published
9    by the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
19 
20 /* Written by Paul Eggert.  */
21 
22 #ifndef _GL_INTPROPS_H
23 #define _GL_INTPROPS_H
24 
25 #include <limits.h>
26 
27 /* Return a value with the common real type of E and V and the value of V.
28    Do not evaluate E.  */
29 #define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v))
30 
31 /* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see
32    <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00406.html>.  */
33 #define _GL_INT_NEGATE_CONVERT(e, v) ((1 ? 0 : (e)) - (v))
34 
35 /* The extra casts in the following macros work around compiler bugs,
36    e.g., in Cray C 5.0.3.0.  */
37 
38 /* True if the arithmetic type T is an integer type.  bool counts as
39    an integer.  */
40 #define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
41 
42 /* True if the real type T is signed.  */
43 #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
44 
45 /* Return 1 if the real expression E, after promotion, has a
46    signed or floating type.  Do not evaluate E.  */
47 #define EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0)
48 
49 
50 /* Minimum and maximum values for integer types and expressions.  */
51 
52 /* The width in bits of the integer type or expression T.
53    Do not evaluate T.
54    Padding bits are not supported; this is checked at compile-time below.  */
55 #define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT)
56 
57 /* The maximum and minimum values for the integer type T.  */
58 #define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t))
59 #define TYPE_MAXIMUM(t)                                                 \
60   ((t) (! TYPE_SIGNED (t)                                               \
61         ? (t) -1                                                        \
62         : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1)))
63 
64 /* The maximum and minimum values for the type of the expression E,
65    after integer promotion.  E is not evaluated.  */
66 #define _GL_INT_MINIMUM(e)                                              \
67   (EXPR_SIGNED (e)                                                      \
68    ? ~ _GL_SIGNED_INT_MAXIMUM (e)                                       \
69    : _GL_INT_CONVERT (e, 0))
70 #define _GL_INT_MAXIMUM(e)                                              \
71   (EXPR_SIGNED (e)                                                      \
72    ? _GL_SIGNED_INT_MAXIMUM (e)                                         \
73    : _GL_INT_NEGATE_CONVERT (e, 1))
74 #define _GL_SIGNED_INT_MAXIMUM(e)                                       \
75   (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH ((e) + 0) - 2)) - 1) * 2 + 1)
76 
77 /* Work around OpenVMS incompatibility with C99.  */
78 #if !defined LLONG_MAX && defined __INT64_MAX
79 # define LLONG_MAX __INT64_MAX
80 # define LLONG_MIN __INT64_MIN
81 #endif
82 
83 /* This include file assumes that signed types are two's complement without
84    padding bits; the above macros have undefined behavior otherwise.
85    If this is a problem for you, please let us know how to fix it for your host.
86    This assumption is tested by the intprops-tests module.  */
87 
88 /* Does the __typeof__ keyword work?  This could be done by
89    'configure', but for now it's easier to do it by hand.  */
90 #if (2 <= __GNUC__ \
91      || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \
92      || (0x5110 <= __SUNPRO_C && !__STDC__))
93 # define _GL_HAVE___TYPEOF__ 1
94 #else
95 # define _GL_HAVE___TYPEOF__ 0
96 #endif
97 
98 /* Return 1 if the integer type or expression T might be signed.  Return 0
99    if it is definitely unsigned.  This macro does not evaluate its argument,
100    and expands to an integer constant expression.  */
101 #if _GL_HAVE___TYPEOF__
102 # define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED (__typeof__ (t))
103 #else
104 # define _GL_SIGNED_TYPE_OR_EXPR(t) 1
105 #endif
106 
107 /* Bound on length of the string representing an unsigned integer
108    value representable in B bits.  log10 (2.0) < 146/485.  The
109    smallest value of B where this bound is not tight is 2621.  */
110 #define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485)
111 
112 /* Bound on length of the string representing an integer type or expression T.
113    Subtract 1 for the sign bit if T is signed, and then add 1 more for
114    a minus sign if needed.
115 
116    Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 0 when its argument is
117    signed, this macro may overestimate the true bound by one byte when
118    applied to unsigned types of size 2, 4, 16, ... bytes.  */
119 #define INT_STRLEN_BOUND(t)                                     \
120   (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \
121    + _GL_SIGNED_TYPE_OR_EXPR (t))
122 
123 /* Bound on buffer size needed to represent an integer type or expression T,
124    including the terminating null.  */
125 #define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
126 
127 
128 /* Range overflow checks.
129 
130    The INT_<op>_RANGE_OVERFLOW macros return 1 if the corresponding C
131    operators might not yield numerically correct answers due to
132    arithmetic overflow.  They do not rely on undefined or
133    implementation-defined behavior.  Their implementations are simple
134    and straightforward, but they are a bit harder to use than the
135    INT_<op>_OVERFLOW macros described below.
136 
137    Example usage:
138 
139      long int i = ...;
140      long int j = ...;
141      if (INT_MULTIPLY_RANGE_OVERFLOW (i, j, LONG_MIN, LONG_MAX))
142        printf ("multiply would overflow");
143      else
144        printf ("product is %ld", i * j);
145 
146    Restrictions on *_RANGE_OVERFLOW macros:
147 
148    These macros do not check for all possible numerical problems or
149    undefined or unspecified behavior: they do not check for division
150    by zero, for bad shift counts, or for shifting negative numbers.
151 
152    These macros may evaluate their arguments zero or multiple times,
153    so the arguments should not have side effects.  The arithmetic
154    arguments (including the MIN and MAX arguments) must be of the same
155    integer type after the usual arithmetic conversions, and the type
156    must have minimum value MIN and maximum MAX.  Unsigned types should
157    use a zero MIN of the proper type.
158 
159    These macros are tuned for constant MIN and MAX.  For commutative
160    operations such as A + B, they are also tuned for constant B.  */
161 
162 /* Return 1 if A + B would overflow in [MIN,MAX] arithmetic.
163    See above for restrictions.  */
164 #define INT_ADD_RANGE_OVERFLOW(a, b, min, max)          \
165   ((b) < 0                                              \
166    ? (a) < (min) - (b)                                  \
167    : (max) - (b) < (a))
168 
169 /* Return 1 if A - B would overflow in [MIN,MAX] arithmetic.
170    See above for restrictions.  */
171 #define INT_SUBTRACT_RANGE_OVERFLOW(a, b, min, max)     \
172   ((b) < 0                                              \
173    ? (max) + (b) < (a)                                  \
174    : (a) < (min) + (b))
175 
176 /* Return 1 if - A would overflow in [MIN,MAX] arithmetic.
177    See above for restrictions.  */
178 #define INT_NEGATE_RANGE_OVERFLOW(a, min, max)          \
179   ((min) < 0                                            \
180    ? (a) < - (max)                                      \
181    : 0 < (a))
182 
183 /* Return 1 if A * B would overflow in [MIN,MAX] arithmetic.
184    See above for restrictions.  Avoid && and || as they tickle
185    bugs in Sun C 5.11 2010/08/13 and other compilers; see
186    <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00401.html>.  */
187 #define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max)     \
188   ((b) < 0                                              \
189    ? ((a) < 0                                           \
190       ? (a) < (max) / (b)                               \
191       : (b) == -1                                       \
192       ? 0                                               \
193       : (min) / (b) < (a))                              \
194    : (b) == 0                                           \
195    ? 0                                                  \
196    : ((a) < 0                                           \
197       ? (a) < (min) / (b)                               \
198       : (max) / (b) < (a)))
199 
200 /* Return 1 if A / B would overflow in [MIN,MAX] arithmetic.
201    See above for restrictions.  Do not check for division by zero.  */
202 #define INT_DIVIDE_RANGE_OVERFLOW(a, b, min, max)       \
203   ((min) < 0 && (b) == -1 && (a) < - (max))
204 
205 /* Return 1 if A % B would overflow in [MIN,MAX] arithmetic.
206    See above for restrictions.  Do not check for division by zero.
207    Mathematically, % should never overflow, but on x86-like hosts
208    INT_MIN % -1 traps, and the C standard permits this, so treat this
209    as an overflow too.  */
210 #define INT_REMAINDER_RANGE_OVERFLOW(a, b, min, max)    \
211   INT_DIVIDE_RANGE_OVERFLOW (a, b, min, max)
212 
213 /* Return 1 if A << B would overflow in [MIN,MAX] arithmetic.
214    See above for restrictions.  Here, MIN and MAX are for A only, and B need
215    not be of the same type as the other arguments.  The C standard says that
216    behavior is undefined for shifts unless 0 <= B < wordwidth, and that when
217    A is negative then A << B has undefined behavior and A >> B has
218    implementation-defined behavior, but do not check these other
219    restrictions.  */
220 #define INT_LEFT_SHIFT_RANGE_OVERFLOW(a, b, min, max)   \
221   ((a) < 0                                              \
222    ? (a) < (min) >> (b)                                 \
223    : (max) >> (b) < (a))
224 
225 /* True if __builtin_add_overflow (A, B, P) works when P is non-null.  */
226 #if 5 <= __GNUC__ && !defined __ICC
227 # define _GL_HAS_BUILTIN_OVERFLOW 1
228 #else
229 # define _GL_HAS_BUILTIN_OVERFLOW 0
230 #endif
231 
232 /* True if __builtin_add_overflow_p (A, B, C) works.  */
233 #define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__)
234 
235 /* The _GL*_OVERFLOW macros have the same restrictions as the
236    *_RANGE_OVERFLOW macros, except that they do not assume that operands
237    (e.g., A and B) have the same type as MIN and MAX.  Instead, they assume
238    that the result (e.g., A + B) has that type.  */
239 #if _GL_HAS_BUILTIN_OVERFLOW_P
240 # define _GL_ADD_OVERFLOW(a, b, min, max)                               \
241    __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0)
242 # define _GL_SUBTRACT_OVERFLOW(a, b, min, max)                          \
243    __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0)
244 # define _GL_MULTIPLY_OVERFLOW(a, b, min, max)                          \
245    __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0)
246 #else
247 # define _GL_ADD_OVERFLOW(a, b, min, max)                                \
248    ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max)                  \
249     : (a) < 0 ? (b) <= (a) + (b)                                         \
250     : (b) < 0 ? (a) <= (a) + (b)                                         \
251     : (a) + (b) < (b))
252 # define _GL_SUBTRACT_OVERFLOW(a, b, min, max)                           \
253    ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max)             \
254     : (a) < 0 ? 1                                                        \
255     : (b) < 0 ? (a) - (b) <= (a)                                         \
256     : (a) < (b))
257 # define _GL_MULTIPLY_OVERFLOW(a, b, min, max)                           \
258    (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a))))       \
259     || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max))
260 #endif
261 #define _GL_DIVIDE_OVERFLOW(a, b, min, max)                             \
262   ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max)  \
263    : (a) < 0 ? (b) <= (a) + (b) - 1                                     \
264    : (b) < 0 && (a) + (b) <= (a))
265 #define _GL_REMAINDER_OVERFLOW(a, b, min, max)                          \
266   ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max)  \
267    : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b)                     \
268    : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max))
269 
270 /* Return a nonzero value if A is a mathematical multiple of B, where
271    A is unsigned, B is negative, and MAX is the maximum value of A's
272    type.  A's type must be the same as (A % B)'s type.  Normally (A %
273    -B == 0) suffices, but things get tricky if -B would overflow.  */
274 #define _GL_UNSIGNED_NEG_MULTIPLE(a, b, max)                            \
275   (((b) < -_GL_SIGNED_INT_MAXIMUM (b)                                   \
276     ? (_GL_SIGNED_INT_MAXIMUM (b) == (max)                              \
277        ? (a)                                                            \
278        : (a) % (_GL_INT_CONVERT (a, _GL_SIGNED_INT_MAXIMUM (b)) + 1))   \
279     : (a) % - (b))                                                      \
280    == 0)
281 
282 /* Check for integer overflow, and report low order bits of answer.
283 
284    The INT_<op>_OVERFLOW macros return 1 if the corresponding C operators
285    might not yield numerically correct answers due to arithmetic overflow.
286    The INT_<op>_WRAPV macros also store the low-order bits of the answer.
287    These macros work correctly on all known practical hosts, and do not rely
288    on undefined behavior due to signed arithmetic overflow.
289 
290    Example usage, assuming A and B are long int:
291 
292      if (INT_MULTIPLY_OVERFLOW (a, b))
293        printf ("result would overflow\n");
294      else
295        printf ("result is %ld (no overflow)\n", a * b);
296 
297    Example usage with WRAPV flavor:
298 
299      long int result;
300      bool overflow = INT_MULTIPLY_WRAPV (a, b, &result);
301      printf ("result is %ld (%s)\n", result,
302              overflow ? "after overflow" : "no overflow");
303 
304    Restrictions on these macros:
305 
306    These macros do not check for all possible numerical problems or
307    undefined or unspecified behavior: they do not check for division
308    by zero, for bad shift counts, or for shifting negative numbers.
309 
310    These macros may evaluate their arguments zero or multiple times, so the
311    arguments should not have side effects.
312 
313    The WRAPV macros are not constant expressions.  They support only
314    +, binary -, and *.  The result type must be signed.
315 
316    These macros are tuned for their last argument being a constant.
317 
318    Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B,
319    A % B, and A << B would overflow, respectively.  */
320 
321 #define INT_ADD_OVERFLOW(a, b) \
322   _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW)
323 #define INT_SUBTRACT_OVERFLOW(a, b) \
324   _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW)
325 #if _GL_HAS_BUILTIN_OVERFLOW_P
326 # define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a)
327 #else
328 # define INT_NEGATE_OVERFLOW(a) \
329    INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
330 #endif
331 #define INT_MULTIPLY_OVERFLOW(a, b) \
332   _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW)
333 #define INT_DIVIDE_OVERFLOW(a, b) \
334   _GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW)
335 #define INT_REMAINDER_OVERFLOW(a, b) \
336   _GL_BINARY_OP_OVERFLOW (a, b, _GL_REMAINDER_OVERFLOW)
337 #define INT_LEFT_SHIFT_OVERFLOW(a, b) \
338   INT_LEFT_SHIFT_RANGE_OVERFLOW (a, b, \
339                                  _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
340 
341 /* Return 1 if the expression A <op> B would overflow,
342    where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test,
343    assuming MIN and MAX are the minimum and maximum for the result type.
344    Arguments should be free of side effects.  */
345 #define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow)        \
346   op_result_overflow (a, b,                                     \
347                       _GL_INT_MINIMUM (_GL_INT_CONVERT (a, b)), \
348                       _GL_INT_MAXIMUM (_GL_INT_CONVERT (a, b)))
349 
350 /* Store the low-order bits of A + B, A - B, A * B, respectively, into *R.
351    Return 1 if the result overflows.  See above for restrictions.  */
352 #define INT_ADD_WRAPV(a, b, r) \
353   _GL_INT_OP_WRAPV (a, b, r, +, __builtin_add_overflow, INT_ADD_OVERFLOW)
354 #define INT_SUBTRACT_WRAPV(a, b, r) \
355   _GL_INT_OP_WRAPV (a, b, r, -, __builtin_sub_overflow, INT_SUBTRACT_OVERFLOW)
356 #define INT_MULTIPLY_WRAPV(a, b, r) \
357   _GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW)
358 
359 /* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390.  See:
360    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193
361    https://llvm.org/bugs/show_bug.cgi?id=25390
362    For now, assume all versions of GCC-like compilers generate bogus
363    warnings for _Generic.  This matters only for older compilers that
364    lack __builtin_add_overflow.  */
365 #if __GNUC__
366 # define _GL__GENERIC_BOGUS 1
367 #else
368 # define _GL__GENERIC_BOGUS 0
369 #endif
370 
371 /* Store the low-order bits of A <op> B into *R, where OP specifies
372    the operation.  BUILTIN is the builtin operation, and OVERFLOW the
373    overflow predicate.  Return 1 if the result overflows.  See above
374    for restrictions.  */
375 #if _GL_HAS_BUILTIN_OVERFLOW
376 # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r)
377 #elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS
378 # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \
379    (_Generic \
380     (*(r), \
381      signed char: \
382        _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
383                         signed char, SCHAR_MIN, SCHAR_MAX), \
384      short int: \
385        _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
386                         short int, SHRT_MIN, SHRT_MAX), \
387      int: \
388        _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
389                         int, INT_MIN, INT_MAX), \
390      long int: \
391        _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
392                         long int, LONG_MIN, LONG_MAX), \
393      long long int: \
394        _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
395                         long long int, LLONG_MIN, LLONG_MAX)))
396 #else
397 # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \
398    (sizeof *(r) == sizeof (signed char) \
399     ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
400                        signed char, SCHAR_MIN, SCHAR_MAX) \
401     : sizeof *(r) == sizeof (short int) \
402     ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
403                        short int, SHRT_MIN, SHRT_MAX) \
404     : sizeof *(r) == sizeof (int) \
405     ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
406                        int, INT_MIN, INT_MAX) \
407     : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow))
408 # ifdef LLONG_MAX
409 #  define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \
410     (sizeof *(r) == sizeof (long int) \
411      ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
412                         long int, LONG_MIN, LONG_MAX) \
413      : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
414                         long long int, LLONG_MIN, LLONG_MAX))
415 # else
416 #  define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \
417     _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
418                      long int, LONG_MIN, LONG_MAX)
419 # endif
420 #endif
421 
422 /* Store the low-order bits of A <op> B into *R, where the operation
423    is given by OP.  Use the unsigned type UT for calculation to avoid
424    overflow problems.  *R's type is T, with extrema TMIN and TMAX.
425    T must be a signed integer type.  Return 1 if the result overflows.  */
426 #define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \
427   (sizeof ((a) op (b)) < sizeof (t) \
428    ? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \
429    : _GL_INT_OP_CALC1 (a, b, r, op, overflow, ut, t, tmin, tmax))
430 #define _GL_INT_OP_CALC1(a, b, r, op, overflow, ut, t, tmin, tmax) \
431   ((overflow (a, b) \
432     || (EXPR_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \
433     || (tmax) < ((a) op (b))) \
434    ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 1) \
435    : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 0))
436 
437 /* Return the low-order bits of A <op> B, where the operation is given
438    by OP.  Use the unsigned type UT for calculation to avoid undefined
439    behavior on signed integer overflow, and convert the result to type T.
440    UT is at least as wide as T and is no narrower than unsigned int,
441    T is two's complement, and there is no padding or trap representations.
442    Assume that converting UT to T yields the low-order bits, as is
443    done in all known two's-complement C compilers.  E.g., see:
444    https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html
445 
446    According to the C standard, converting UT to T yields an
447    implementation-defined result or signal for values outside T's
448    range.  However, code that works around this theoretical problem
449    runs afoul of a compiler bug in Oracle Studio 12.3 x86.  See:
450    https://lists.gnu.org/r/bug-gnulib/2017-04/msg00049.html
451    As the compiler bug is real, don't try to work around the
452    theoretical problem.  */
453 
454 #define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t) \
455   ((t) ((ut) (a) op (ut) (b)))
456 
457 #endif /* _GL_INTPROPS_H */
458