[ptx] Fix sso tests

Thomas Schwinge thomas@codesourcery.com
Tue Nov 24 08:20:00 GMT 2015


Hi!

On Mon, 23 Nov 2015 15:16:12 -0500, Nathan Sidwell <nathan@acm.org> wrote:
> The gcc.dg/sso tests gratuitously fail on PTX because they use IO facilities 
> that don't exist there.  This  patch changes the dumping to use the putchar 
> function call (and not a macro), and not use fputs.

>  void put (const char s[])
>  {
> +#ifdef  __nvptx__
> +  int i;
> +  for (i = 0; s[i]; i++)
> +    putchar (s[i]);
> +#else
>    fputs (s, stdout);
> +#endif
>  }

Doesn't __builtin_printf work?


More generally, I've been wondering before, whether we should improve the
I/O support in nvptx' newlib.  I suppose (but have not verified) that the
_stdout member of _REENT (struct _reent) will by default be initilized to
&__sf_fake_stdout (and similar for stderr), which we could detect in
nvptx I/O functions, and in such cases use the PTX printf function.  Or
something along these lines.


Grüße
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20151124/6e0eb68f/attachment.sig>


More information about the Gcc-patches mailing list