public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/107451] [11/12/13 Regression] Segmentation fault with vectorized code since r11-6434
Date: Thu, 17 Nov 2022 14:58:20 +0000	[thread overview]
Message-ID: <bug-107451-4-OOJwZA6XRv@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107451-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107451

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Interestingly the following variant of the testcase falls back to
VMAT_ELEMENTWISE but does have the same problem there fixed up by later
folding, but it will segfault when using -O2 -mavx2 -fno-vect-cost-model
-fdisable-tree-vrp2 -fdisable-free-forwprop4 which then keeps the bogus

  _62 = *ivtmp_64;
  _61 = MEM[(const double *)ivtmp_64 + 8B];
  ivtmp_60 = ivtmp_64 + _65;
  _59 = *ivtmp_60;
  _58 = MEM[(const double *)ivtmp_60 + 8B];
  ivtmp_57 = ivtmp_60 + _65;
  vect_cst__56 = {_62, _61, _59, _58};
  vect__4.7_55 = VEC_PERM_EXPR <vect_cst__56, vect_cst__56, { 0, 1, 0, 1 }>;

that problem should be present even before the r11-6434 change.  In fact
this segfaults on the GCC 10 branch with just -O2 -ftree-loop-vectorize -mavx2
generating the same load/permute as trunk for the reduction (so there's some
half-way "fix" on the later branches).  Also broken with GCC 9.5.

static void __attribute__((noipa))
setdot(int n, const double *x, int inc_x, const double *y, double * __restrict
dot)
{
  int i, ix = 0;

  for(i = 0; i < n; i++) {
      dot[i*4+0] = x[ix]          * y[ix]   ;
      dot[i*4+1] = x[ix+1] * y[ix+1] ;
      dot[i*4+2] = x[ix]          * y[ix+1] ;
      dot[i*4+3] = x[ix+1] * y[ix]   ;
      ix += inc_x ;
  }
}

int main(void)
{
  double x[2] = {0, 0}, y[2] = {0, 0};
  double dot[4];
  setdot(1, x, 4096*4096, y, dot);
  return 0;
}

  parent reply	other threads:[~2022-11-17 14:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 19:07 [Bug tree-optimization/107451] New: Segmentation fault with vectorized code bartoldeman at users dot sourceforge.net
2022-10-28 19:19 ` [Bug tree-optimization/107451] " jakub at gcc dot gnu.org
2022-10-28 19:19 ` [Bug tree-optimization/107451] [11/12/13 Regression] " pinskia at gcc dot gnu.org
2022-10-29  0:12 ` bartoldeman at users dot sourceforge.net
2022-10-31  3:29 ` crazylht at gmail dot com
2022-11-05 10:21 ` rguenth at gcc dot gnu.org
2022-11-05 10:29 ` [Bug tree-optimization/107451] [11/12/13 Regression] Segmentation fault with vectorized code since r11-6434 jakub at gcc dot gnu.org
2022-11-17  9:06 ` rguenth at gcc dot gnu.org
2022-11-17 14:48 ` rguenth at gcc dot gnu.org
2022-11-17 14:57 ` bartoldeman at users dot sourceforge.net
2022-11-17 14:58 ` rguenth at gcc dot gnu.org [this message]
2022-12-22 11:21 ` cvs-commit at gcc dot gnu.org
2022-12-22 11:21 ` [Bug tree-optimization/107451] [11/12 " rguenth at gcc dot gnu.org
2023-03-15  9:47 ` cvs-commit at gcc dot gnu.org
2023-05-02 12:03 ` [Bug tree-optimization/107451] [11 " cvs-commit at gcc dot gnu.org
2023-05-02 12:05 ` rguenth at gcc dot gnu.org

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-107451-4-OOJwZA6XRv@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).