This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Convert TEST_f_f tests from code to data


On 11-05-2013 02:13, Andreas Jaeger wrote:
> On 05/10/2013 11:00 PM, Joseph S. Myers wrote:
>> This patch converts all the TEST_f_f tests in libm-test.inc from code
>> to data. Tested x86_64 and x86
>
> Ok, thanks,
>
> Andreas

Hi,

After this commit I'm seeing this issue with PowerPC/PowerPC64:

In file included from test-float.c:33:0:
libm-test.c:10701:5: error: initializer element is not constant
math/libm-test.c:10701:5: error: (near initialization for ‘log_test_data[9].arg’)

Looks like GCC is messing up on a constant fold:

{ "log (1.0 / M_El) == -1", 1.0 / M_El, -1, 0, 0 },

It is indeed being processed as expect, as the output from -E -dD shows:

{ "log (1.0 / M_El) == -1", 1.0 / 2.718281828459045235360287471352662498L, -1, 0, 0 },

I didn't dig into, but it shows on GCC 4.4.6, 4.7.4, and trunk (4.9). To avoid more compiler
ifdefs, I suggest just replace it to a constant. Tested on PowerPC and PowerPC64.

--

2013-05-12  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>

	* math/libm-test.inc (log_test_data): Constant fold to fix compiler issue.

---

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 2d4006f..6fb2fc8 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -10779,7 +10779,7 @@ static const struct test_f_f_data log_test_data[] =
     TEST_f_f (log, qnan_value, qnan_value),
 
     TEST_f_f (log, M_El, 1),
-    TEST_f_f (log, 1.0 / M_El, -1),
+    TEST_f_f (log, 0.3678794411714423215955237701614608674458111L, -1),
     TEST_f_f (log, 2, M_LN2l),
     TEST_f_f (log, 10, M_LN10l),
     TEST_f_f (log, 0.75L, -0.287682072451780927439219005993827432L),


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]