public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gpnuma at centaurean dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/66230] Using optimizations causes program to segfault
Date: Thu, 21 May 2015 15:53:00 -0000 [thread overview]
Message-ID: <bug-66230-4-1bAJ7RXqcI@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66230-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66230
--- Comment #11 from gpnuma at centaurean dot com ---
(In reply to Markus Trippelsdorf from comment #10)
> (In reply to gpnuma from comment #8)
> > Thanks Markus I didn't think these alignment issues were actually the
> > problem, it goes a long way.
> >
> > By doing memmoves instead of pointer cast allocations I got rid of the
> > segfault, but of course things are much slower... this "undefined behaviour"
> > is really treacherous !!
> >
> > Is there any way to ensure proper alignment so I don't fall into this trap
> > and still benefit from maximum speed ?
>
> I'm afraid there is no general recipe that would ensure proper alignment.
> But using memcpy hasn't necessary to be "much slower".
> And trading undefined behavior for a little more speed isn't a good idea in
> general.
Thanks, actually the code with __builtin_memmove is 30% slower compiled with
gcc 4.9.2 or 4.8 than it is with pointer cast allocations in 4.8 (4.9 can't say
because of the segfault).
However after testing with gcc 5.1 I had the pleasant surprise to see that it's
performing at the same speed as before, which means 30% faster than gcc 4.9.
30% faster is huge, you've obviously done a great job in the optimization
stages for 5.1 !
prev parent reply other threads:[~2015-05-21 15:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-66230-4@http.gcc.gnu.org/bugzilla/>
2015-05-21 6:03 ` trippels at gcc dot gnu.org
2015-05-21 9:32 ` gpnuma at centaurean dot com
2015-05-21 9:55 ` gpnuma at centaurean dot com
2015-05-21 10:04 ` gpnuma at centaurean dot com
2015-05-21 10:16 ` trippels at gcc dot gnu.org
2015-05-21 10:32 ` gpnuma at centaurean dot com
2015-05-21 10:35 ` gpnuma at centaurean dot com
2015-05-21 11:26 ` trippels at gcc dot gnu.org
2015-05-21 15:53 ` gpnuma at centaurean dot com [this message]
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=bug-66230-4-1bAJ7RXqcI@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@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).