public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103832] vectorized code segfaults due to misaligned access Date: Sun, 26 Dec 2021 12:09:53 +0000 [thread overview] Message-ID: <bug-103832-4-sHvbUhFJpP@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-103832-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103832 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- You are using the attribute aligned incorrectly. aligned_float *data = static_cast<aligned_float *>(aligned_alloc(64, 8192*sizeof(float))); float sum = 0.0f; for (int i=1; i<8192; i++) sum += data[i]; You are saying data+i are all 64byte aligned which is obviously not correct. If you want to say data+0 is aligned at a 64byte boundary you should use instead __builtin_assume_aligned . https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005fassume_005faligned
next prev parent reply other threads:[~2021-12-26 12:09 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-26 11:58 [Bug c++/103832] New: " joakim.rosqvist at gmail dot com 2021-12-26 12:09 ` pinskia at gcc dot gnu.org [this message] 2021-12-27 18:05 ` [Bug c++/103832] " joakim.rosqvist at gmail dot com
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-103832-4-sHvbUhFJpP@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: linkBe 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).