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

Alexander Ivchenko aivchenk@gmail.com
Mon Aug 5 10:57:00 GMT 2013


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.

The following patch adds <stdlib.h> to the test.
Tested on x86_64-unknown-linux-gnu and on Android. Also I checked that
the original regression appears on the fixed test.

Is it OK for trunk?

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f356d55..5c23650 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-08-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
+
+       * gcc.dg/torture/pr56407.c: Add include of stdlib.h. Remove
+       declaration of abort() and rand().
+
 2013-08-04  Ed Smith-Rowland  <3dw4rd@verizon.net>

        PR c++/58072
diff --git a/gcc/testsuite/gcc.dg/torture/pr56407.c
b/gcc/testsuite/gcc.dg/torture/pr56407.c
index f26fd23..5d35874 100644
--- a/gcc/testsuite/gcc.dg/torture/pr56407.c
+++ b/gcc/testsuite/gcc.dg/torture/pr56407.c
@@ -1,7 +1,6 @@
 /* { dg-do run } */

-extern void abort(void);
-extern int rand(void);
+#include <stdlib.h>

 static void copy(int *r,int *a,int na)
 {


--Alexander



More information about the Gcc-patches mailing list