build: ensure make-prime-list doesn't access out of bounds memory
[platform/upstream/coreutils.git] / tests / misc / seq-long-double.sh
1 #!/bin/sh
2 # Test for this fix: 461231f022bdb3ee392622d31dc475034adceeb2.
3 # Ensure that seq prints exactly two numbers for a 2-number integral
4 # range at the limit of floating point precision.
5
6 # Copyright (C) 2008-2013 Free Software Foundation, Inc.
7
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
21 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
22 print_ver_ seq
23 getlimits_
24
25 # Run this test only with glibc and sizeof (long double) > sizeof (double).
26 # Otherwise, there are known failures:
27 # http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/14939/focus=14944
28 cat <<\EOF > long.c
29 #include <features.h>
30 #if defined __GNU_LIBRARY__ && __GLIBC__ >= 2
31 int foo[sizeof (long double) - sizeof (double) - 1];
32 #else
33 "run this test only with glibc"
34 #endif
35 EOF
36 $CC -c long.c \
37   || skip_ \
38      'this test runs only on systems with glibc and long double != double'
39
40 a=$INTMAX_MAX
41 b=$INTMAX_OFLOW
42
43 seq $a $b > out || fail=1
44 printf "$a\n$b\n" > exp || fail=1
45 compare exp out || fail=1
46
47 Exit $fail