public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/46886] [4.5/4.6 Regression] gfortran.dg/array_constructor_9.f90 FAILs with -ftree-parallelize-loops -fstrict-overflow -fno-tree-ch
Date: Tue, 18 Jan 2011 17:32:00 -0000	[thread overview]
Message-ID: <bug-46886-4-VUSqYlxRZk@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-46886-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46886

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rakdver at gcc dot gnu.org,
                   |                            |spop at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-18 17:00:29 UTC ---
Seems one extra incorrect iteration is added after GOMP_parallel_end:
<bb 16>:
  D.1592_69 = D.1591_183 * 4;

<bb 17>:
  # D.1592_15 = PHI <0(15), D.1592_69(16)>
  D.1749_71 = (<unnamed-unsigned:64>) D.1592_15;
  D.1750_72 = MAX_EXPR <D.1749_71, 1>;
  D.1751_73 = __builtin_malloc (D.1750_72);
  D.1594_74 = (void * restrict) D.1751_73;
  D.1898_232 = (<unnamed-unsigned:64>) D.1591_183;
  D.1899_233 = D.1591_183 >= 0;
  D.1900_234 = D.1898_232 > 199;
  D.1901_235 = D.1899_233 && D.1900_234;
  if (D.1901_235 != 0)
    goto <bb 18>;
  else
    goto <bb 19>;

<bb 18>:
  .paral_data_store.64.D.1910 = D.1578_1;
  .paral_data_store.64.D.1911 = D.1594_74;
  .paral_data_store.64.D.1912 = D.1898_232;
  __builtin_GOMP_parallel_start (build._loopfn.1, &.paral_data_store.64, 2);
  build._loopfn.1 (&.paral_data_store.64);
  __builtin_GOMP_parallel_end ();
  ivtmp.60_247 = D.1898_232;
  S.7_248 = (integer(kind=8)) ivtmp.60_247;
  D.1755_249 = *D.1578_1[S.7_248];
  MEM[(real(kind=4)[0:] *)D.1594_74][S.7_248] = D.1755_249;
  S.7_251 = S.7_248 + 1;
  ivtmp.60_252 = ivtmp.60_247 + 1;
S.7_248 is equal to the number of ints allocated, so stores after the end of
malloced area.  The loop is initially:
loop_4 (header = 18, latch = 19, niter = , upper_bound = 9223372036854775808,
estimate = 9223372036854775808)
{
  bb_18 (preds = {bb_17 bb_19 }, succs = {bb_20 bb_19 })
  {
  <bb 18>:
    # S.7_7 = PHI <0(17), S.7_80(19)>
    # .MEM_152 = PHI <.MEM_182(17), .MEM_185(19)>
    if (S.7_7 > D.1586_64)
      goto <bb 20>;
    else
      goto <bb 19>;

  }
  bb_19 (preds = {bb_18 }, succs = {bb_18 })
  {
  <bb 19>:
    # VUSE <.MEM_152>
    D.1755_79 = *D.1578_1[S.7_7];
    # .MEM_185 = VDEF <.MEM_152>
    MEM[(real(kind=4)[0:] *)D.1594_74][S.7_7] = D.1755_79;
    S.7_80 = S.7_7 + 1;
    goto <bb 18>;

  }
}
and try_get_loop_niter computes niter->niter as (<unnamed-unsigned:64>)
D.1591_183.  On:
__attribute__((noinline, noclone)) void
foo (int *__restrict__ p, int *__restrict__ q, int n)
{
  int i;
  for (i = 0; i < n; i++)
    p[i] = q[i];
}

int
main (void)
{
  int *p = __builtin_calloc (1024, sizeof (int));
  int *q = __builtin_calloc (1024, sizeof (int));
  foo (p, q, 1024);
  return 0;
}
try_get_loop_niter instead computes niter->niter as n - 1 (which is strange to
me), but then it works even with the extra iteration added after
GOMP_parallel_end (as that iteration is done with iv set to n - 1).


  parent reply	other threads:[~2011-01-18 17:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-10 15:44 [Bug tree-optimization/46886] New: " zsojka at seznam dot cz
2010-12-27 19:09 ` [Bug tree-optimization/46886] " jakub at gcc dot gnu.org
2011-01-18 17:32 ` jakub at gcc dot gnu.org [this message]
2011-02-04  7:12 ` jakub at gcc dot gnu.org
2011-02-04  7:58 ` spop at gcc dot gnu.org
2011-02-04 20:31 ` sebpop at gmail dot com
2011-02-08 13:55 ` rguenth at gcc dot gnu.org
2011-02-14  5:18 ` spop at gcc dot gnu.org
2011-03-21 12:27 ` [Bug tree-optimization/46886] [4.5/4.6/4.7 " pault at gcc dot gnu.org
2011-04-14 19:03 ` [Bug tree-optimization/46886] [4.5/4.6/4.7 Regression] wrong code with -ftree-parallelize-loops -fno-tree-ch zsojka at seznam dot cz
2011-04-28 15:24 ` rguenth at gcc dot gnu.org
2012-02-08 14:17 ` rguenth at gcc dot gnu.org
2012-02-08 15:29 ` [Bug tree-optimization/46886] [4.5/4.6 " rguenth at gcc dot gnu.org
2012-02-08 15:30 ` [Bug tree-optimization/46886] [4.5/4.6/4.7 " rguenth at gcc dot gnu.org
2012-02-15 11:08 ` [Bug tree-optimization/46886] [4.5/4.6 " rguenth at gcc dot gnu.org
2012-02-15 11:09 ` rguenth at gcc dot gnu.org
2012-04-22 10:36 ` razya 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-46886-4-VUSqYlxRZk@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).