Re: [testsuite, Android] Add stdlib.h to pr56407.c

2013-08-06 Thread Alexander Ivchenko
The reason for undefined reference to rand is that it is defined as static __inline__ in Bionic stdlib.h: static __inline__ int rand(void) { return (int)lrand48(); } So in fact, if you do nm libc.so for Bionic, you won't get the rand.. which is probably not correct, because it doesn't have

Re: [testsuite, Android] Add stdlib.h to pr56407.c

2013-08-06 Thread Andreas Schwab
Alexander Ivchenko aivch...@gmail.com writes: Still, in C standart it is said that rand is defined in stdlib.h, and we don't include it in that testcase. It also says: Provided that a library function can be declared without reference to any type defined in a header, it is also permissible to

Re: [testsuite, Android] Add stdlib.h to pr56407.c

2013-08-06 Thread Alexander Ivchenko
Thanks Andreas, it seems clear now that Bionic rand function is not consistent with the standart. --Alexander 2013/8/6 Andreas Schwab sch...@suse.de: Alexander Ivchenko aivch...@gmail.com writes: Still, in C standart it is said that rand is defined in stdlib.h, and we don't include it in

[testsuite, Android] Add stdlib.h to pr56407.c

2013-08-05 Thread Alexander Ivchenko
Hi, The following test case fails to compile on Android: gcc.dg/torture/pr56407.c /tmp/ccA08Isw.o:pr56407.c:function test: error: undefined reference to 'rand' collect2: error: ld returned 1 exit status Which is not surprising at all, since the testcase has only the declarations of abort() and

Re: [testsuite, Android] Add stdlib.h to pr56407.c

2013-08-05 Thread Maxim Kuvyrkov
On 5/08/2013, at 10:57 PM, Alexander Ivchenko wrote: Hi, The following test case fails to compile on Android: gcc.dg/torture/pr56407.c /tmp/ccA08Isw.o:pr56407.c:function test: error: undefined reference to 'rand' collect2: error: ld returned 1 exit status Which is not surprising at