public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/20165] New: Pointer does not really escape with write
@ 2005-02-23 18:21 pinskia at gcc dot gnu dot org
  2005-02-23 23:29 ` [Bug tree-optimization/20165] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-23 18:21 UTC (permalink / raw)
  To: gcc-bugs

Take the following fortran code (were we know that write does not make the pointer escape):
      program main
      dimension x(10)
      write(3)n,(x(n),n=1,10)
      end

in the last tree dump we get:
  _gfortran_transfer_integer (&n, 4);
  n = 1;

<L0>:;
  _gfortran_transfer_real (&x[n + -1], 4);
  n.3 = n;
  n = n.3 + 1;
  if (n.3 == 10) goto <L4>; else goto <L0>;

See how n is marked as not a gimple variable which causes us to store it on the stack.  Even though we 
know that _gfortran_transfer_real will not cause the pointer to escape.  There should be a new attribute 
to mark functions as causing pointers not to escape at all.

-- 
           Summary: Pointer does not really escape with write
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug tree-optimization/20165] Pointer does not really escape with write
  2005-02-23 18:21 [Bug tree-optimization/20165] New: Pointer does not really escape with write pinskia at gcc dot gnu dot org
@ 2005-02-23 23:29 ` pinskia at gcc dot gnu dot org
  2005-03-01 18:12 ` pinskia at gcc dot gnu dot org
  2005-08-31 15:09 ` dberlin at gcc dot gnu dot org
  2 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-23 23:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-23 18:59 -------
A C testcase (scanf this time):
#include <stdio.h>

int main(void)
{
  int i;
  int j;
  scanf("%d", &i);
  for(;i<=0;i--)
    printf("H");
  return 0;
}

-- 


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


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

* [Bug tree-optimization/20165] Pointer does not really escape with write
  2005-02-23 18:21 [Bug tree-optimization/20165] New: Pointer does not really escape with write pinskia at gcc dot gnu dot org
  2005-02-23 23:29 ` [Bug tree-optimization/20165] " pinskia at gcc dot gnu dot org
@ 2005-03-01 18:12 ` pinskia at gcc dot gnu dot org
  2005-08-31 15:09 ` dberlin at gcc dot gnu dot org
  2 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-01 18:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-01 18:11 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-03-01 18:11:59
               date|                            |


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


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

* [Bug tree-optimization/20165] Pointer does not really escape with write
  2005-02-23 18:21 [Bug tree-optimization/20165] New: Pointer does not really escape with write pinskia at gcc dot gnu dot org
  2005-02-23 23:29 ` [Bug tree-optimization/20165] " pinskia at gcc dot gnu dot org
  2005-03-01 18:12 ` pinskia at gcc dot gnu dot org
@ 2005-08-31 15:09 ` dberlin at gcc dot gnu dot org
  2 siblings, 0 replies; 11+ messages in thread
From: dberlin at gcc dot gnu dot org @ 2005-08-31 15:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dberlin at gcc dot gnu dot org  2005-08-31 15:08 -------
These should simply be marked with pointer_no_escape once that goes in

-- 


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


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

* [Bug tree-optimization/20165] Pointer does not really escape with write
       [not found] <bug-20165-4@http.gcc.gnu.org/bugzilla/>
  2010-10-16 16:06 ` tkoenig at gcc dot gnu.org
@ 2010-10-16 18:53 ` tkoenig at gcc dot gnu.org
  1 sibling, 0 replies; 11+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-10-16 18:53 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #10 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-10-16 18:53:27 UTC ---
I think this can now be closed.


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

* [Bug tree-optimization/20165] Pointer does not really escape with write
       [not found] <bug-20165-4@http.gcc.gnu.org/bugzilla/>
@ 2010-10-16 16:06 ` tkoenig at gcc dot gnu.org
  2010-10-16 18:53 ` tkoenig at gcc dot gnu.org
  1 sibling, 0 replies; 11+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-10-16 16:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-10-16 16:06:14 UTC ---
Author: tkoenig
Date: Sat Oct 16 16:06:07 2010
New Revision: 165559

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=165559
Log:
2010-10-16  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/20165
    PR fortran/31593
    PR fortran/43665
    * gfortran.map:  Add _gfortran_transfer_array_write,
    _gfortran_transfer_array_write, _gfortran_transfer_character_write,
    _gfortran_transfer_character_wide_write,
    _gfortran_transfer_complex_write,
    _gfortran_transfer_integer_write,
    _gfortran_transfer_logical_write and
    _gfortran_transfer_real_write.
    * io/transfer.c (transfer_integer_write):  Add prototype and
    function body as call to the original function, without the
    _write.
    (transfer_real_write):  Likewise.
    (transfer_logical_write):  Likewise.
    (transfer_character_write):  Likewise.
    (transfer_character_wide_write):  Likewise.
    (transfer_complex_write):  Likewise.
    (transfer_array_write):  Likewise.

2010-10-16  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/20165
    PR fortran/31593
    PR fortran/43665
    * trans-io.c (enum iocall): Add IOCALL_X_INTEGER_WRITE,
    IOCALL_X_LOGICAL_WRITE, IOCALL_X_CHARACTER_WRITE,
    IOCALL_X_CHARACTER_WIDE_WRIE, IOCALL_X_REAL_WRITE,
    IOCALL_X_COMPLEX_WRITE and IOCALL_X_ARRAY_WRITE.
    (gfc_build_io_library_fndecls):  Add corresponding function
    decls.
    (transfer_expr):  If the current transfer is a READ, use
    the iocall with the original version, otherwise the version
    with _WRITE.
    (transfer_array_desc):  Likewise.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-io.c
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/gfortran.map
    trunk/libgfortran/io/transfer.c


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

* [Bug tree-optimization/20165] Pointer does not really escape with write
       [not found] <bug-20165-6528@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2009-07-02 15:47 ` rguenther at suse dot de
@ 2009-09-26 15:33 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-09-26 15:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2009-09-26 15:33 -------
Mine.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-03-05 03:09:54         |2009-09-26 15:33:38
               date|                            |


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


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

* [Bug tree-optimization/20165] Pointer does not really escape with write
       [not found] <bug-20165-6528@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2009-07-02 15:40 ` steven at gcc dot gnu dot org
@ 2009-07-02 15:47 ` rguenther at suse dot de
  2009-09-26 15:33 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 11+ messages in thread
From: rguenther at suse dot de @ 2009-07-02 15:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenther at suse dot de  2009-07-02 15:46 -------
Subject: Re:  Pointer does not really escape
 with write

On Thu, 2 Jul 2009, steven at gcc dot gnu dot org wrote:

> ------- Comment #6 from steven at gcc dot gnu dot org  2009-07-02 15:40 -------
> Dan, you mentioned a "pointer_no_escape" attribute.  What was that about?  I've
> never seen that mentioned before (or a patch to implement it).  Sounds like a
> cool attribute to have (and not just for Fortran, too).

There are several useful things to specify per pointer argument:

 1) whether it escapes
 2) whether pointed-to memory is read
 3) whether pointed-to memory is written to
 4) whether memory reachable from it is read
 5) whether memory reachable form it is written to
 6) whether addresses to pointed-to memory may be returned
 7) whether addresses to reachable memory may be returned

in addition to, of course, if the function reads from / writes to
global memory.

Zdenek hat a patch with some fancy attribute at some point, and
implementation-wise I'd like to have something that shares
representation with IPA-PTA results.

We do have tasks to do both IPA-PTA and the above attribute btw.

Richard.


-- 


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


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

* [Bug tree-optimization/20165] Pointer does not really escape with write
       [not found] <bug-20165-6528@http.gcc.gnu.org/bugzilla/>
  2007-04-16 21:54 ` pinskia at gcc dot gnu dot org
  2009-06-08 18:12 ` tkoenig at gcc dot gnu dot org
@ 2009-07-02 15:40 ` steven at gcc dot gnu dot org
  2009-07-02 15:47 ` rguenther at suse dot de
  2009-09-26 15:33 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 11+ messages in thread
From: steven at gcc dot gnu dot org @ 2009-07-02 15:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from steven at gcc dot gnu dot org  2009-07-02 15:40 -------
Dan, you mentioned a "pointer_no_escape" attribute.  What was that about?  I've
never seen that mentioned before (or a patch to implement it).  Sounds like a
cool attribute to have (and not just for Fortran, too).


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dberlin at gcc dot gnu dot
                   |                            |org, rguenth at gcc dot gnu
                   |                            |dot org


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


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

* [Bug tree-optimization/20165] Pointer does not really escape with write
       [not found] <bug-20165-6528@http.gcc.gnu.org/bugzilla/>
  2007-04-16 21:54 ` pinskia at gcc dot gnu dot org
@ 2009-06-08 18:12 ` tkoenig at gcc dot gnu dot org
  2009-07-02 15:40 ` steven at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2009-06-08 18:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from tkoenig at gcc dot gnu dot org  2009-06-08 18:12 -------
This also causes missed warnings about unitizialized variables:

$ cat foo.f
      print *,x
      end
$ gfortran -O3 -Wall -Wextra foo.f

We should have some way of marking that pointer as read-only.


-- 


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


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

* [Bug tree-optimization/20165] Pointer does not really escape with write
       [not found] <bug-20165-6528@http.gcc.gnu.org/bugzilla/>
@ 2007-04-16 21:54 ` pinskia at gcc dot gnu dot org
  2009-06-08 18:12 ` tkoenig at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-16 21:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2007-04-16 22:54 -------
*** Bug 31593 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkoenig at gcc dot gnu dot
                   |                            |org


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


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

end of thread, other threads:[~2010-10-16 18:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-23 18:21 [Bug tree-optimization/20165] New: Pointer does not really escape with write pinskia at gcc dot gnu dot org
2005-02-23 23:29 ` [Bug tree-optimization/20165] " pinskia at gcc dot gnu dot org
2005-03-01 18:12 ` pinskia at gcc dot gnu dot org
2005-08-31 15:09 ` dberlin at gcc dot gnu dot org
     [not found] <bug-20165-6528@http.gcc.gnu.org/bugzilla/>
2007-04-16 21:54 ` pinskia at gcc dot gnu dot org
2009-06-08 18:12 ` tkoenig at gcc dot gnu dot org
2009-07-02 15:40 ` steven at gcc dot gnu dot org
2009-07-02 15:47 ` rguenther at suse dot de
2009-09-26 15:33 ` rguenth at gcc dot gnu dot org
     [not found] <bug-20165-4@http.gcc.gnu.org/bugzilla/>
2010-10-16 16:06 ` tkoenig at gcc dot gnu.org
2010-10-16 18:53 ` tkoenig 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).