summaryrefslogtreecommitdiff
path: root/tests/tprintf.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2012-03-08 13:01:07 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2012-03-08 13:01:07 +0000
commit52ea024c4058665ec0596e0154a1ee03249f1dea (patch)
tree9fb57a8582b21fd945328ba1dfaa75fb11222525 /tests/tprintf.c
parenta3a92fd955af3b0ab88a37918fc80f85c2ba99c2 (diff)
downloadmpfr-52ea024c4058665ec0596e0154a1ee03249f1dea.tar.gz
[tests/tprintf.c] Corrected the test with MPFR_CHECK_LARGEMEM=1.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8078 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tprintf.c')
-rw-r--r--tests/tprintf.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/tprintf.c b/tests/tprintf.c
index fc84386ab..aade07e12 100644
--- a/tests/tprintf.c
+++ b/tests/tprintf.c
@@ -159,8 +159,23 @@ check_long_string (void)
/* this test is VERY expensive both in time (~1 min on core2 @ 2.40GHz) and
in memory (~2.5 GB) */
mpfr_t x;
-
- mpfr_init2 (x, INT_MAX);
+ long large_prec = 2147483647;
+
+ /* With a 32-bit (4GB) address space, a realloc failure has been noticed
+ with a 2G precision (though allocating up to 4GB is possible):
+ MPFR: Can't reallocate memory (old_size=4096 new_size=2147487744)
+ The implementation might be improved to use less memory and avoid
+ this problem. In the mean time, let's choose a smaller precision,
+ but with r8077 on an x86_64 machine with a 32-bit ABI (-m32), this
+ currently fails with: Error in mpfr_vprintf("%Rb", ...) */
+ if (sizeof (void *) == 4)
+ large_prec /= 2;
+
+ /* We assume that the precision won't be increased internally. */
+ if (large_prec > MPFR_PREC_MAX)
+ large_prec = MPFR_PREC_MAX;
+
+ mpfr_init2 (x, large_prec);
mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_nextabove (x);