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  <sounderaraja...@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 [l...@redhat.com]
Sent: 23 April 2014 21:59:52
To: Dhakshinamoorthy, Soundararajan; gcc-ow...@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;
 }

Reply via email to