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 all, since the testcase has only the
> declarations of abort() and rand()
> and doesn't have any headers included.

It *is* surprising given that the testcase does have declarations of abort() or 
rand() -- which are the only two external functions referenced.

> 
> The following patch adds <stdlib.h> to the test.

I don't think this a correct fix.  [In most such cases the real problem can be 
found out by examining why linking a test against glibc works, but against 
bionic -- doesn't.]

How are you linking this testcase?  Please post both the link line from 
testsuite log and verbose output of linking (obtainable by adding "-v" to the 
link line).

Thank you,

--
Maxim Kuvyrkov
www.kugelworks.com


Reply via email to