This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [Testsuite] getpid in gcc.c-torture/execute/pr58419.c
- From: "Dhakshinamoorthy, Soundararajan" <Soundararajan dot Dhakshinamoorthy at atmel dot com>
- To: Jeff Law <law at redhat dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Fri, 25 Apr 2014 09:16:00 +0000
- Subject: RE: [Testsuite] getpid in gcc.c-torture/execute/pr58419.c
- Authentication-results: sourceware.org; auth=none
- References: <54196F45A68D5F44A17DBFF39883E26F84DE25B2 at penmbx02 dot corp dot atmel dot com>,<5357EA80 dot 1090900 at redhat dot com>
Hi,
I have attached a patch based on the recommendation. Can you please review and apply, if it looks ok ?. I don't have commit access.
gcc/testsuite/ChangeLog
2014-04-25 Soundararajan Dhakshinamoorthy <sounderarajan.d@atmel.com>
* gcc.c-torture/execute/pr58419.c: Adjust the test to work with bare metal targets. The
test code references to functions that is not implemented for the avr target (getpid()).
Thanks,
Soundararajan
________________________________________
From: Jeff Law [law@redhat.com]
Sent: 23 April 2014 21:59:52
To: Dhakshinamoorthy, Soundararajan; gcc-owner@gcc.gnu.org
Subject: Re: [Testsuite] getpid in gcc.c-torture/execute/pr58419.c
On 04/23/14 05:50, Dhakshinamoorthy, Soundararajan wrote:
> Hi all,
>
> The test mentioned in the link had a call to getpid which causes the test to fail for bare metal targets. Is it ok to replace it with
> printf("\0") ?
>
> which seems to be the first version of the test.
You want to avoid the printf. Instead I think a dummy function that is
marked as noinline should be sufficient -- I just haven't had the time
to verify that myself.
Jeff
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58419.c b/gcc/testsuite/gcc.c-torture/execute/pr58419.c
index 69cc040..78bf437 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pr58419.c
+++ b/gcc/testsuite/gcc.c-torture/execute/pr58419.c
@@ -1,4 +1,9 @@
-int printf(const char *, ...);
+__attribute__((__noinline__))
+void
+dummy ()
+{
+ asm volatile("");
+}
int a, g, i, k, *p;
signed char b;
@@ -31,6 +36,6 @@ main ()
*l = a;
g = foo (*m = k && *d, 1 > i) || bar ();
}
- getpid();
+ dummy();
return 0;
}