aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2017-04-15 22:22:49 -0700
committerPaul Eggert2017-04-15 22:23:05 -0700
commit0ef7f64407525a1e1bcc8aef4d1fd19a1cf60ec6 (patch)
tree8ef5acb8ebb49d0fe5113af24fc0cb8ab918af57
parent23d3eeb798c7edc27898b0dbd4c2364a6ca6247d (diff)
downloademacs-0ef7f64407525a1e1bcc8aef4d1fd19a1cf60ec6.tar.gz
emacs-0ef7f64407525a1e1bcc8aef4d1fd19a1cf60ec6.zip
Merge from gnulib
This incorporates: 2017-04-14 intprops: try to avoid tickling similar bugs 2017-04-14 intprops: port to Oracle Studio 12.3 x86 * doc/misc/texinfo.tex, lib/intprops.h: Copy from gnulib.
-rw-r--r--doc/misc/texinfo.tex6
-rw-r--r--lib/intprops.h47
2 files changed, 33 insertions, 20 deletions
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index 7bcb27b76e1..9cd73101c1f 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,7 +3,7 @@
3% Load plain if necessary, i.e., if running under initex. 3% Load plain if necessary, i.e., if running under initex.
4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi 4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
5% 5%
6\def\texinfoversion{2017-03-25.14} 6\def\texinfoversion{2017-04-14.11}
7% 7%
8% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 8% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -11595,6 +11595,9 @@ directory should work if nowhere else does.}
11595 @def ^^M{@let^^M@secondlinenl}% 11595 @def ^^M{@let^^M@secondlinenl}%
11596 % Definition for a newline in the main Texinfo file. 11596 % Definition for a newline in the main Texinfo file.
11597 @gdef @secondlinenl{@fixbackslash}% 11597 @gdef @secondlinenl{@fixbackslash}%
11598 % In case the first line has a whole-line command on it
11599 @let@originalparsearg@parsearg
11600 @def@parsearg{@fixbackslash@originalparsearg}
11598}} 11601}}
11599 11602
11600{@catcode`@^=7 @catcode`@^^M=13% 11603{@catcode`@^=7 @catcode`@^^M=13%
@@ -11615,6 +11618,7 @@ directory should work if nowhere else does.}
11615 @catcode13=5 % regular end of line 11618 @catcode13=5 % regular end of line
11616 @enableemergencynewline 11619 @enableemergencynewline
11617 @let@c=@texinfoc 11620 @let@c=@texinfoc
11621 @let@parsearg@originalparsearg
11618 % Also turn back on active characters that might appear in the input 11622 % Also turn back on active characters that might appear in the input
11619 % file name, in case not using a pre-dumped format. 11623 % file name, in case not using a pre-dumped format.
11620 @catcode`+=@active 11624 @catcode`+=@active
diff --git a/lib/intprops.h b/lib/intprops.h
index 85ed61f8d8c..1ea9647e16e 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -389,10 +389,10 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH);
389 (_Generic \ 389 (_Generic \
390 (*(r), \ 390 (*(r), \
391 signed char: \ 391 signed char: \
392 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \ 392 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
393 signed char, SCHAR_MIN, SCHAR_MAX), \ 393 signed char, SCHAR_MIN, SCHAR_MAX), \
394 short int: \ 394 short int: \
395 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \ 395 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
396 short int, SHRT_MIN, SHRT_MAX), \ 396 short int, SHRT_MIN, SHRT_MAX), \
397 int: \ 397 int: \
398 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ 398 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
@@ -406,10 +406,10 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH);
406#else 406#else
407# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ 407# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \
408 (sizeof *(r) == sizeof (signed char) \ 408 (sizeof *(r) == sizeof (signed char) \
409 ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \ 409 ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
410 signed char, SCHAR_MIN, SCHAR_MAX) \ 410 signed char, SCHAR_MIN, SCHAR_MAX) \
411 : sizeof *(r) == sizeof (short int) \ 411 : sizeof *(r) == sizeof (short int) \
412 ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \ 412 ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
413 short int, SHRT_MIN, SHRT_MAX) \ 413 short int, SHRT_MIN, SHRT_MAX) \
414 : sizeof *(r) == sizeof (int) \ 414 : sizeof *(r) == sizeof (int) \
415 ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ 415 ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
@@ -431,9 +431,8 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH);
431 431
432/* Store the low-order bits of A <op> B into *R, where the operation 432/* Store the low-order bits of A <op> B into *R, where the operation
433 is given by OP. Use the unsigned type UT for calculation to avoid 433 is given by OP. Use the unsigned type UT for calculation to avoid
434 overflow problems. *R's type is T, with extremal values TMIN and 434 overflow problems. *R's type is T, with extrema TMIN and TMAX.
435 TMAX. T must be a signed integer type. Return 1 if the result 435 T must be a signed integer type. Return 1 if the result overflows. */
436 overflows. */
437#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \ 436#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \
438 (sizeof ((a) op (b)) < sizeof (t) \ 437 (sizeof ((a) op (b)) < sizeof (t) \
439 ? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \ 438 ? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \
@@ -442,17 +441,27 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH);
442 ((overflow (a, b) \ 441 ((overflow (a, b) \
443 || (EXPR_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \ 442 || (EXPR_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \
444 || (tmax) < ((a) op (b))) \ 443 || (tmax) < ((a) op (b))) \
445 ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 1) \ 444 ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 1) \
446 : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 0)) 445 : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 0))
447 446
448/* Return A <op> B, where the operation is given by OP. Use the 447/* Return the low-order bits of A <op> B, where the operation is given
449 unsigned type UT for calculation to avoid overflow problems. 448 by OP. Use the unsigned type UT for calculation to avoid undefined
450 Convert the result to type T without overflow by subtracting TMIN 449 behavior on signed integer overflow, and convert the result to type T.
451 from large values before converting, and adding it afterwards. 450 UT is at least as wide as T and is no narrower than unsigned int,
452 Compilers can optimize all the operations except OP. */ 451 T is two's complement, and there is no padding or trap representations.
453#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t, tmin, tmax) \ 452 Assume that converting UT to T yields the low-order bits, as is
454 (((ut) (a) op (ut) (b)) <= (tmax) \ 453 done in all known two's-complement C compilers. E.g., see:
455 ? (t) ((ut) (a) op (ut) (b)) \ 454 https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html
456 : ((t) (((ut) (a) op (ut) (b)) - (tmin)) + (tmin))) 455
456 According to the C standard, converting UT to T yields an
457 implementation-defined result or signal for values outside T's
458 range. However, code that works around this theoretical problem
459 runs afoul of a compiler bug in Oracle Studio 12.3 x86. See:
460 http://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00049.html
461 As the compiler bug is real, don't try to work around the
462 theoretical problem. */
463
464#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t) \
465 ((t) ((ut) (a) op (ut) (b)))
457 466
458#endif /* _GL_INTPROPS_H */ 467#endif /* _GL_INTPROPS_H */