public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* [Testsuite] getpid in gcc.c-torture/execute/pr58419.c
@ 2014-01-27 11:15 Senthil Kumar Selvaraj
       [not found] ` <D70144161FA8C34E96606F874775290009CDE451@TOSBLRMBX01.TOSHIBA-TSIP.COM>
  0 siblings, 1 reply; 6+ messages in thread
From: Senthil Kumar Selvaraj @ 2014-01-27 11:15 UTC (permalink / raw)
  To: gcc

All,

  gcc.c-torture/execute/pr58419.c has a call to getpid, and this causes
  a linker error on the AVR (embedded) target. Is the call intentional,
  and if yes, how should this be fixed for targets that don't support an
  OS?

Regards
Senthil

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Testsuite] getpid in gcc.c-torture/execute/pr58419.c
       [not found] ` <D70144161FA8C34E96606F874775290009CDE451@TOSBLRMBX01.TOSHIBA-TSIP.COM>
@ 2014-01-28 11:02   ` Senthil Kumar Selvaraj
  2014-01-28 18:40     ` Janis Johnson
  0 siblings, 1 reply; 6+ messages in thread
From: Senthil Kumar Selvaraj @ 2014-01-28 11:02 UTC (permalink / raw)
  To: Umesh Kalappa; +Cc: gcc, mikestump

This is on trunk - I was under the impression that it is always trunk,
unless otherwise stated?

getpid doesn't really make sense for bare metal targets, I would think?

Regards
Senthil

On Mon, Jan 27, 2014 at 01:04:48PM +0000, Umesh Kalappa wrote:
> Senthil,
> Please do let us know the gcc version ,I couldn't locate the file pr58419.c  in  the GCC 4.8.1 source .
>  
> To go with the below problem ,you can attributed the getpid() function as weak (http://www.embedded-bits.co.uk/2008/gcc-weak-symbols/).
> 
> ~Umesh
> 
> -----Original Message-----
> From: gcc-owner@gcc.gnu.org [mailto:gcc-owner@gcc.gnu.org] On Behalf Of Senthil Kumar Selvaraj
> Sent: 27 January 2014 15:18
> To: gcc@gcc.gnu.org
> Subject: [Testsuite] getpid in gcc.c-torture/execute/pr58419.c
> 
> All,
> 
>   gcc.c-torture/execute/pr58419.c has a call to getpid, and this causes
>   a linker error on the AVR (embedded) target. Is the call intentional,
>   and if yes, how should this be fixed for targets that don't support an
>   OS?
> 
> Regards
> Senthil

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Testsuite] getpid in gcc.c-torture/execute/pr58419.c
  2014-01-28 11:02   ` Senthil Kumar Selvaraj
@ 2014-01-28 18:40     ` Janis Johnson
  2014-01-28 21:39       ` Jeff Law
  0 siblings, 1 reply; 6+ messages in thread
From: Janis Johnson @ 2014-01-28 18:40 UTC (permalink / raw)
  To: Senthil Kumar Selvaraj, Umesh.Kalappa; +Cc: gcc, mikestump, Jeff Law

On 01/27/2014 10:51 PM, Senthil Kumar Selvaraj wrote:
> This is on trunk - I was under the impression that it is always trunk,
> unless otherwise stated?
> 
> getpid doesn't really make sense for bare metal targets, I would think?
> 
> Regards
> Senthil
> 
> On Mon, Jan 27, 2014 at 01:04:48PM +0000, Umesh Kalappa wrote:
>> Senthil,
>> Please do let us know the gcc version ,I couldn't locate the file pr58419.c  in  the GCC 4.8.1 source .
>>  
>> To go with the below problem ,you can attributed the getpid() function as weak (http://www.embedded-bits.co.uk/2008/gcc-weak-symbols/).
>>
>> ~Umesh
>>
>> -----Original Message-----
>> From: gcc-owner@gcc.gnu.org [mailto:gcc-owner@gcc.gnu.org] On Behalf Of Senthil Kumar Selvaraj
>> Sent: 27 January 2014 15:18
>> To: gcc@gcc.gnu.org
>> Subject: [Testsuite] getpid in gcc.c-torture/execute/pr58419.c
>>
>> All,
>>
>>   gcc.c-torture/execute/pr58419.c has a call to getpid, and this causes
>>   a linker error on the AVR (embedded) target. Is the call intentional,
>>   and if yes, how should this be fixed for targets that don't support an
>>   OS?
>>
>> Regards
>> Senthil
> 
> 

The testcase in the PR had a call to printf.  The modified test doesn't call
printf, and doesn't declare getpid.  I assume that getpid is called simply
to have an external call, but there must be something that could be used
instead that is available for any target.

Jeff, you added this test, would you please take a look at it?

Janis 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Testsuite] getpid in gcc.c-torture/execute/pr58419.c
  2014-01-28 18:40     ` Janis Johnson
@ 2014-01-28 21:39       ` Jeff Law
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Law @ 2014-01-28 21:39 UTC (permalink / raw)
  To: janisjo, Senthil Kumar Selvaraj, Umesh.Kalappa; +Cc: gcc, mikestump

On 01/28/14 11:14, Janis Johnson wrote:
> The testcase in the PR had a call to printf.  The modified test doesn't call
> printf, and doesn't declare getpid.  I assume that getpid is called simply
> to have an external call, but there must be something that could be used
> instead that is available for any target.
>
> Jeff, you added this test, would you please take a look at it?
It was a testcase from Zhendong that was modified to fit within our 
testing framework.

I think we could replace the call to getpid with a call to a function 
which has a noinline attribute.

Jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Testsuite] getpid in gcc.c-torture/execute/pr58419.c
  2014-04-25  9:16   ` Dhakshinamoorthy, Soundararajan
@ 2014-04-30 21:09     ` Jeff Law
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Law @ 2014-04-30 21:09 UTC (permalink / raw)
  To: Dhakshinamoorthy, Soundararajan, gcc-patches; +Cc: gcc

On 04/25/14 03:16, Dhakshinamoorthy, Soundararajan wrote:
> 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.  I tweaked the ChangeLog slightly and installed your patch.

Jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [Testsuite] getpid in gcc.c-torture/execute/pr58419.c
       [not found] ` <5357EA80.1090900@redhat.com>
@ 2014-04-25  9:16   ` Dhakshinamoorthy, Soundararajan
  2014-04-30 21:09     ` Jeff Law
  0 siblings, 1 reply; 6+ messages in thread
From: Dhakshinamoorthy, Soundararajan @ 2014-04-25  9:16 UTC (permalink / raw)
  To: Jeff Law, gcc-patches; +Cc: gcc

[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pr58419.patch --]
[-- Type: text/x-patch; name="pr58419.patch", Size: 540 bytes --]

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;
 }

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-30 21:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-27 11:15 [Testsuite] getpid in gcc.c-torture/execute/pr58419.c Senthil Kumar Selvaraj
     [not found] ` <D70144161FA8C34E96606F874775290009CDE451@TOSBLRMBX01.TOSHIBA-TSIP.COM>
2014-01-28 11:02   ` Senthil Kumar Selvaraj
2014-01-28 18:40     ` Janis Johnson
2014-01-28 21:39       ` Jeff Law
     [not found] <54196F45A68D5F44A17DBFF39883E26F84DE25B2@penmbx02.corp.atmel.com>
     [not found] ` <5357EA80.1090900@redhat.com>
2014-04-25  9:16   ` Dhakshinamoorthy, Soundararajan
2014-04-30 21:09     ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).