public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/31094]  New: Support annotating function parameters as read-only and/or non-escaping
@ 2007-03-09  7:17 burnus at gcc dot gnu dot org
  2007-03-09 10:34 ` [Bug middle-end/31094] " rguenth at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-03-09  7:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/ml/fortran/2007-02/msg00167.html
> > > From what I've seen, one of the main problems with Fortran and
> > > aliasing is the pass-by-reference rule in Fortran.  This often tricks 
> > > alias analysis into overstating the amount of call-clobbered variables.
> > Can we do something in the frontend to overcome the pass-by-reference
> > rule? Can some of the analysis be done where we have the information
> > and the variables be marked up ins some way?
> We need middle-end support to annotate function parameters as read-only
> and/or non-escaping.

Fortran allows to specify that certain arguments of procedures (functions and
subroutines) have "intent(in)", i.e. are not modified by the procedure, or to
be "intent(out)", i.e. their value on entry might be undefined.

Additionally, there exist PURE functions, which may not modify any of the
passed arguments nor global variables. This is actually also true for many
functions provided by the Fortran library, e.g. matrix products ("matmul()") or
dot_product()s; while for simple cases they are inlined, for more complicated
ones (e.g. several dimensions with strides) they are not but a call to the
Fortran library is generated.

Even if a temporary variable is created, one can do optimizations:
{
  real D.14354;
  D.14354 = foo; // Not needed for intent(out)
  bar(&D.14354);
  foo = D.14354; // Not needed for intent(in)
}

(In Fortran code: "call bar(foo)" where bar is defined, e.g., as:
"subroutine bar(a); real, intent(in) :: a")


-- 
           Summary: Support annotating function parameters as read-only
                    and/or non-escaping
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

* [Bug middle-end/31094] Support annotating function parameters as read-only and/or non-escaping
  2007-03-09  7:17 [Bug middle-end/31094] New: Support annotating function parameters as read-only and/or non-escaping burnus at gcc dot gnu dot org
@ 2007-03-09 10:34 ` rguenth at gcc dot gnu dot org
  2008-01-10 16:10 ` manu at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-03-09 10:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-03-09 10:33 -------
Confirmed.


-- 

rguenth 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, dnovillo at redhat
                   |                            |dot com
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-03-09 10:33:54
               date|                            |


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


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

* [Bug middle-end/31094] Support annotating function parameters as read-only and/or non-escaping
  2007-03-09  7:17 [Bug middle-end/31094] New: Support annotating function parameters as read-only and/or non-escaping burnus at gcc dot gnu dot org
  2007-03-09 10:34 ` [Bug middle-end/31094] " rguenth at gcc dot gnu dot org
@ 2008-01-10 16:10 ` manu at gcc dot gnu dot org
  2008-01-10 16:47 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-01-10 16:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2008-01-10 15:38 -------
Isn't this similar to 

include <stdio.h>
main()
{
 char foo[10];
 printf("%s", foo);
}

and other functions that we know for sure don't modify their arguments. It
seems a missed optimisation not only for Fortran.


-- 

manu at gcc dot gnu dot org changed:

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


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


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

* [Bug middle-end/31094] Support annotating function parameters as read-only and/or non-escaping
  2007-03-09  7:17 [Bug middle-end/31094] New: Support annotating function parameters as read-only and/or non-escaping burnus at gcc dot gnu dot org
  2007-03-09 10:34 ` [Bug middle-end/31094] " rguenth at gcc dot gnu dot org
  2008-01-10 16:10 ` manu at gcc dot gnu dot org
@ 2008-01-10 16:47 ` manu at gcc dot gnu dot org
  2009-10-08 11:23 ` matz at gcc dot gnu dot org
  2009-10-08 11:26 ` matz at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-01-10 16:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from manu at gcc dot gnu dot org  2008-01-10 15:40 -------
Actually, that is for Wuninitialized. For a missed optimisation:

#include <stdio.h>
char foo()
{
  char str[] = "Hola";

  char c;

  printf("%s", str);
  c = str[0];
  return c;
}


-- 


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


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

* [Bug middle-end/31094] Support annotating function parameters as read-only and/or non-escaping
  2007-03-09  7:17 [Bug middle-end/31094] New: Support annotating function parameters as read-only and/or non-escaping burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-01-10 16:47 ` manu at gcc dot gnu dot org
@ 2009-10-08 11:23 ` matz at gcc dot gnu dot org
  2009-10-08 11:26 ` matz at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: matz at gcc dot gnu dot org @ 2009-10-08 11:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from matz at gcc dot gnu dot org  2009-10-08 11:23 -------
We're (slowly) working on this.


-- 

matz at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matz at gcc dot gnu dot org
         AssignedTo|unassigned at gcc dot gnu   |matz at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-04-22 23:14:03         |2009-10-08 11:23:04
               date|                            |


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


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

* [Bug middle-end/31094] Support annotating function parameters as read-only and/or non-escaping
  2007-03-09  7:17 [Bug middle-end/31094] New: Support annotating function parameters as read-only and/or non-escaping burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-10-08 11:23 ` matz at gcc dot gnu dot org
@ 2009-10-08 11:26 ` matz at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: matz at gcc dot gnu dot org @ 2009-10-08 11:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from matz at gcc dot gnu dot org  2009-10-08 11:26 -------
See also my mail http://gcc.gnu.org/ml/fortran/2009-08/msg00200.html
about this issue.


-- 


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


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

* [Bug middle-end/31094] Support annotating function parameters as read-only and/or non-escaping
       [not found] <bug-31094-4@http.gcc.gnu.org/bugzilla/>
  2012-04-24  8:51 ` slayoo at staszic dot waw.pl
  2013-06-25  9:08 ` dominiq at lps dot ens.fr
@ 2013-08-28  8:25 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-08-28  8:25 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Not sure - the middle-end now has the 'fn spec' attribute, so middle-end
support
is ready.  The revision in question only marks IO library calls properly,
not as requested user functions with INTENT(IN)/INTENT(OUT) (?)

So, closing the middle-end part as fixed (this was a middle-end bug).

Eventually a Fortran bug still needs to be opened.


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

* [Bug middle-end/31094] Support annotating function parameters as read-only and/or non-escaping
       [not found] <bug-31094-4@http.gcc.gnu.org/bugzilla/>
  2012-04-24  8:51 ` slayoo at staszic dot waw.pl
@ 2013-06-25  9:08 ` dominiq at lps dot ens.fr
  2013-08-28  8:25 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-06-25  9:08 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |WAITING

--- Comment #7 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Is this PR fixed by revision 165559 or not?


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

* [Bug middle-end/31094] Support annotating function parameters as read-only and/or non-escaping
       [not found] <bug-31094-4@http.gcc.gnu.org/bugzilla/>
@ 2012-04-24  8:51 ` slayoo at staszic dot waw.pl
  2013-06-25  9:08 ` dominiq at lps dot ens.fr
  2013-08-28  8:25 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 9+ messages in thread
From: slayoo at staszic dot waw.pl @ 2012-04-24  8:51 UTC (permalink / raw)
  To: gcc-bugs

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

Sylwester Arabas <slayoo at staszic dot waw.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |slayoo at staszic dot
                   |                            |waw.pl

--- Comment #6 from Sylwester Arabas <slayoo at staszic dot waw.pl> 2012-04-24 08:50:52 UTC ---
Perhaps that's somehow related to the issue described in this message:
http://gcc.gnu.org/ml/fortran/2012-04/msg00122.html
Sylwester


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

end of thread, other threads:[~2013-08-28  8:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-09  7:17 [Bug middle-end/31094] New: Support annotating function parameters as read-only and/or non-escaping burnus at gcc dot gnu dot org
2007-03-09 10:34 ` [Bug middle-end/31094] " rguenth at gcc dot gnu dot org
2008-01-10 16:10 ` manu at gcc dot gnu dot org
2008-01-10 16:47 ` manu at gcc dot gnu dot org
2009-10-08 11:23 ` matz at gcc dot gnu dot org
2009-10-08 11:26 ` matz at gcc dot gnu dot org
     [not found] <bug-31094-4@http.gcc.gnu.org/bugzilla/>
2012-04-24  8:51 ` slayoo at staszic dot waw.pl
2013-06-25  9:08 ` dominiq at lps dot ens.fr
2013-08-28  8:25 ` rguenth 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).