public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Janne Blomqvist <blomqvist.janne@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	 Fortran List <fortran@gcc.gnu.org>
Subject: Re: [Patch, libfortran] Improve performance of byte swapped IO
Date: Fri, 04 Jan 2013 22:35:00 -0000	[thread overview]
Message-ID: <m2a9somv9s.fsf@igel.home> (raw)
In-Reply-To: <CAO9iq9HB5us6X3faKPt=ZaAcBz_KeVQBTy4ZDiZ6XfeTOVwohA@mail.gmail.com>	(Janne Blomqvist's message of "Sat, 5 Jan 2013 00:15:11 +0200")

Janne Blomqvist <blomqvist.janne@gmail.com> writes:

> diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c
> index c8ecc3a..bf2250a 100644
> --- a/libgfortran/io/file_pos.c
> +++ b/libgfortran/io/file_pos.c
> @@ -140,15 +140,21 @@ unformatted_backspace (st_parameter_filepos *fpp, gfc_unit *u)
>  	}
>        else
>  	{
> +	  uint32_t u32;
> +	  uint64_t u64;
>  	  switch (length)
>  	    {
>  	    case sizeof(GFC_INTEGER_4):
> -	      reverse_memcpy (&m4, p, sizeof (m4));
> +	      memcpy (&u32, p, sizeof (u32));
> +	      u32 = __builtin_bswap32 (u32);
> +	      m4 = *(GFC_INTEGER_4*)&u32;

Isn't that an aliasing violation?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

  reply	other threads:[~2013-01-04 22:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-04 22:15 Janne Blomqvist
2013-01-04 22:35 ` Andreas Schwab [this message]
2013-01-05 15:35   ` Richard Biener
2013-01-05 21:13     ` Janne Blomqvist
2013-01-06 11:33       ` Richard Biener
2013-01-11 20:41       ` Janne Blomqvist
2013-01-13 22:44         ` Janne Blomqvist
2013-01-18 22:30           ` Janne Blomqvist
2013-01-22 22:32             ` Thomas Koenig
2013-01-23 21:57               ` Janne Blomqvist

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2a9somv9s.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=blomqvist.janne@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).