public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/57823] New: restrict qualifier non effective with pointer returned by new
@ 2013-07-04 15:54 vincenzo.innocente at cern dot ch
  2013-07-04 16:15 ` [Bug tree-optimization/57823] " jakub at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2013-07-04 15:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57823
           Summary: restrict qualifier non effective with pointer returned
                    by new
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincenzo.innocente at cern dot ch

I am sure this has been already discussed, not found a specific report though.

below the code emitted for "add" is what expected, for "bar" gcc adds
versioning for alias..

void add(const float *__restrict__ a, const float *__restrict__ b, float
*__restrict__ c) {
  a = (const float*)__builtin_assume_aligned (a, 16, 0);
  b = (const float*)__builtin_assume_aligned (b, 16, 0);
  c = (float*)__builtin_assume_aligned (c, 16, 0);

     for (int iat=0; iat<128; ++iat) 
    c[iat] = a[iat]+b[iat];
}


inline
void iadd(const float *__restrict__ a, const float *__restrict__ b, float
*__restrict__ c) {
  a = (const float*)__builtin_assume_aligned (a, 16, 0);
  b = (const float*)__builtin_assume_aligned (b, 16, 0);
  c = (float*)__builtin_assume_aligned (c, 16, 0);

     for (int iat=0; iat<128; ++iat)
    c[iat] = a[iat]+b[iat];
}


float * bar() {
  const float *__restrict__ a = new float[128];
  const float *__restrict__ b = new float[128];
  float *__restrict__ c = new float[128];


  iadd(a,b,c);

  return c;

}


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/57823] restrict qualifier non effective with pointer returned by new
  2013-07-04 15:54 [Bug tree-optimization/57823] New: restrict qualifier non effective with pointer returned by new vincenzo.innocente at cern dot ch
@ 2013-07-04 16:15 ` jakub at gcc dot gnu.org
  2013-07-04 16:22 ` glisse at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-07-04 16:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
PR49279 I guess, which removed CAST_RESTRICT handling because it didn't work
well.  That PR has some thoughts what could be used instead, but nobody has
implemented it so far.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/57823] restrict qualifier non effective with pointer returned by new
  2013-07-04 15:54 [Bug tree-optimization/57823] New: restrict qualifier non effective with pointer returned by new vincenzo.innocente at cern dot ch
  2013-07-04 16:15 ` [Bug tree-optimization/57823] " jakub at gcc dot gnu.org
@ 2013-07-04 16:22 ` glisse at gcc dot gnu.org
  2013-07-04 16:36 ` vincenzo.innocente at cern dot ch
  2013-07-08  4:54 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-07-04 16:22 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |glisse at gcc dot gnu.org

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
Related to PR23383 as well, which could make restrict unnecessary in this case.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/57823] restrict qualifier non effective with pointer returned by new
  2013-07-04 15:54 [Bug tree-optimization/57823] New: restrict qualifier non effective with pointer returned by new vincenzo.innocente at cern dot ch
  2013-07-04 16:15 ` [Bug tree-optimization/57823] " jakub at gcc dot gnu.org
  2013-07-04 16:22 ` glisse at gcc dot gnu.org
@ 2013-07-04 16:36 ` vincenzo.innocente at cern dot ch
  2013-07-08  4:54 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2013-07-04 16:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from vincenzo Innocente <vincenzo.innocente at cern dot ch> ---
indeed

float * bar3() {
  const float * a = (float*) malloc(4*128);
  const float * b = (float*) malloc(4*128);
  float *  c = (float*) malloc(4*128);

  a = (const float*)__builtin_assume_aligned (a, 16, 0);
  b = (const float*)__builtin_assume_aligned (b, 16, 0);
  c = (float*)__builtin_assume_aligned (c, 16, 0);

    for (int iat=0; iat<128; ++iat)
    c[iat] = a[iat]+b[iat];

  return c;

}

produces no aliases


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/57823] restrict qualifier non effective with pointer returned by new
  2013-07-04 15:54 [Bug tree-optimization/57823] New: restrict qualifier non effective with pointer returned by new vincenzo.innocente at cern dot ch
                   ` (2 preceding siblings ...)
  2013-07-04 16:36 ` vincenzo.innocente at cern dot ch
@ 2013-07-08  4:54 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-07-08  4:54 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #2)
> Related to PR23383 as well, which could make restrict unnecessary in this
> case.

It is a dup of that bug.

*** This bug has been marked as a duplicate of bug 23383 ***


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-07-08  4:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-04 15:54 [Bug tree-optimization/57823] New: restrict qualifier non effective with pointer returned by new vincenzo.innocente at cern dot ch
2013-07-04 16:15 ` [Bug tree-optimization/57823] " jakub at gcc dot gnu.org
2013-07-04 16:22 ` glisse at gcc dot gnu.org
2013-07-04 16:36 ` vincenzo.innocente at cern dot ch
2013-07-08  4:54 ` pinskia at gcc dot gnu.org

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).