public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/23169] INTENT information not used in the middle-end for optimizations
       [not found] <bug-23169-280@http.gcc.gnu.org/bugzilla/>
@ 2005-10-02 21:27 ` pinskia at gcc dot gnu dot org
  2005-10-03  6:14 ` steven at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-02 21:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-10-02 21:27 -------
I think this is just another case of PR 23134.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |23134


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


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

* [Bug fortran/23169] INTENT information not used in the middle-end for optimizations
       [not found] <bug-23169-280@http.gcc.gnu.org/bugzilla/>
  2005-10-02 21:27 ` [Bug fortran/23169] INTENT information not used in the middle-end for optimizations pinskia at gcc dot gnu dot org
@ 2005-10-03  6:14 ` steven at gcc dot gnu dot org
  2005-10-09 17:41 ` pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-10-03  6:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from steven at gcc dot gnu dot org  2005-10-03 06:14 -------
No it is not.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|23134                       |


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


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

* [Bug fortran/23169] INTENT information not used in the middle-end for optimizations
       [not found] <bug-23169-280@http.gcc.gnu.org/bugzilla/>
  2005-10-02 21:27 ` [Bug fortran/23169] INTENT information not used in the middle-end for optimizations pinskia at gcc dot gnu dot org
  2005-10-03  6:14 ` steven at gcc dot gnu dot org
@ 2005-10-09 17:41 ` pinskia at gcc dot gnu dot org
  2008-09-21 13:37 ` steven at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-09 17:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2005-10-09 17:41 -------
There are a couple of problems here. First I noticed that bar in foo is not
marked as pure even though the IPA mechanism marked it as such, so that looks
like a fortran front-end bug in that it has two different DECLs for the same
function.

The second issue after that is filed as PR 24287 which talks about pure
functions causing local variables to be call clobbered even though they don't
escape.  This issue is related to PR 23134 also.

Here is a testcase which we would not get unless we take intent(in) into
account:
       integer function foo(b,c) 
          integer, intent(in) :: b, c 
          integer :: d, e
          d = b;
          e = c;
          call bar(b,c)

          foo = d-b + e-c;
       end function 


foo should always be zero as bar should not be able to touch b or c.


-- 


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


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

* [Bug fortran/23169] INTENT information not used in the middle-end for optimizations
       [not found] <bug-23169-280@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2005-10-09 17:41 ` pinskia at gcc dot gnu dot org
@ 2008-09-21 13:37 ` steven at gcc dot gnu dot org
  2008-12-27  0:41 ` dfranke at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: steven at gcc dot gnu dot org @ 2008-09-21 13:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from steven at gcc dot gnu dot org  2008-09-21 13:36 -------
A C equivalent test case "works".  Once the infamous
multiple-decls-per-function issue in gfortran is fixed, this bug probably will
disappear.


-- 


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


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

* [Bug fortran/23169] INTENT information not used in the middle-end for optimizations
       [not found] <bug-23169-280@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2008-09-21 13:37 ` steven at gcc dot gnu dot org
@ 2008-12-27  0:41 ` dfranke at gcc dot gnu dot org
  2008-12-29 14:27 ` dfranke at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-12-27  0:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dfranke at gcc dot gnu dot org  2008-12-27 00:38 -------
*** Bug 36076 has been marked as a duplicate of this bug. ***


-- 

dfranke at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/23169] INTENT information not used in the middle-end for optimizations
       [not found] <bug-23169-280@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2008-12-27  0:41 ` dfranke at gcc dot gnu dot org
@ 2008-12-29 14:27 ` dfranke at gcc dot gnu dot org
  2009-01-02 10:30 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-12-29 14:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from dfranke at gcc dot gnu dot org  2008-12-29 14:25 -------
(In reply to comment #4)
> Here is a testcase which we would not get unless we take intent(in) into
> account:
[...]
> foo should always be zero as bar should not be able to touch b or c.

Is this really related to the INTENT? For the equivalent C/C++ cases, I tried
prototypes with int, int*, const int*, int& and const int& respectively -- only
if the arguments are passed by value, the return value of foo is optimized to
zero (as shown by "-O3 -fdump-tree-optimized").


-- 


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


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

* [Bug fortran/23169] INTENT information not used in the middle-end for optimizations
       [not found] <bug-23169-280@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2008-12-29 14:27 ` dfranke at gcc dot gnu dot org
@ 2009-01-02 10:30 ` rguenth at gcc dot gnu dot org
  2009-01-02 11:06 ` tkoenig at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-02 10:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2009-01-02 10:29 -------
There is no way to tell the middle-end about anonymous readonly memory.


-- 


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


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

* [Bug fortran/23169] INTENT information not used in the middle-end for optimizations
       [not found] <bug-23169-280@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2009-01-02 10:30 ` rguenth at gcc dot gnu dot org
@ 2009-01-02 11:06 ` tkoenig at gcc dot gnu dot org
  2009-01-03 19:47 ` dfranke at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2009-01-02 11:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from tkoenig at gcc dot gnu dot org  2009-01-02 11:04 -------
(In reply to comment #8)
> There is no way to tell the middle-end about anonymous readonly memory.

So, we could either

- teach that to the middle-end (I couldn't, though :-)

- make a duplicate variable for intent(in) variables, to transfer
  the test case from comment #4 into

integer function foo(b,c) 
  integer, intent(in) :: b, c
  integer :: b_shadow, c_shadow;
  integer :: d, e
  b_shadow = b;
  c_shadow = c;
  d = b_shadow;
  e = c_shadow;
  call bar(b,c)

  foo = d-b_shadow + e-c_shadow;
end function foo


-- 

tkoenig 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=23169


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

* [Bug fortran/23169] INTENT information not used in the middle-end for optimizations
       [not found] <bug-23169-280@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2009-01-02 11:06 ` tkoenig at gcc dot gnu dot org
@ 2009-01-03 19:47 ` dfranke at gcc dot gnu dot org
  2009-04-14 15:21 ` dfranke at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-01-03 19:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from dfranke at gcc dot gnu dot org  2009-01-03 19:46 -------
Maybe realted: PR29697?!


-- 


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


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

* [Bug fortran/23169] INTENT information not used in the middle-end for optimizations
       [not found] <bug-23169-280@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2009-01-03 19:47 ` dfranke at gcc dot gnu dot org
@ 2009-04-14 15:21 ` dfranke at gcc dot gnu dot org
  2009-05-03 13:33 ` [Bug middle-end/23169] Fortran " fxcoudert at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-04-14 15:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from dfranke at gcc dot gnu dot org  2009-04-14 15:20 -------
The original testcase in #0 appears to be fixed if compiled with -fwhole-file.
Andrew's comment #4 appears to be still an issue?!


-- 


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


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

* [Bug middle-end/23169] Fortran INTENT information not used in the middle-end for optimizations
       [not found] <bug-23169-280@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2009-04-14 15:21 ` dfranke at gcc dot gnu dot org
@ 2009-05-03 13:33 ` fxcoudert at gcc dot gnu dot org
  2010-07-13 10:37 ` steven at gcc dot gnu dot org
  2010-07-13 13:32 ` burnus at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-05-03 13:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from fxcoudert at gcc dot gnu dot org  2009-05-03 13:32 -------
(In reply to comment #11)
> The original testcase in #0 appears to be fixed if compiled with -fwhole-file.
> Andrew's comment #4 appears to be still an issue?!

Here's a full testcase showing the remaining issue:

integer function foo()
  interface
    integer function bar(b)
      integer, intent(in) :: b
    end function
  end interface

  integer :: b, d, k
  b = 12
  d = b
  k = bar(b)
  foo = d - b
end function


In this code, the return value of function foo should not be computed, because
it's guaranteed to be 0. The missed optimization is still present.

This is something that the middle-end should be taught to honour, so I'm
switching the component to middle-end.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
          Component|fortran                     |middle-end
   Last reconfirmed|2006-01-08 05:22:43         |2009-05-03 13:32:52
               date|                            |
            Summary|INTENT information not used |Fortran INTENT information
                   |in the middle-end for       |not used in the middle-end
                   |optimizations               |for optimizations


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


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

* [Bug middle-end/23169] Fortran INTENT information not used in the middle-end for optimizations
       [not found] <bug-23169-280@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2009-05-03 13:33 ` [Bug middle-end/23169] Fortran " fxcoudert at gcc dot gnu dot org
@ 2010-07-13 10:37 ` steven at gcc dot gnu dot org
  2010-07-13 13:32 ` burnus at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: steven at gcc dot gnu dot org @ 2010-07-13 10:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from steven at gcc dot gnu dot org  2010-07-13 10:37 -------
Still present.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2009-05-03 13:32:52         |2010-07-13 10:37:16
               date|                            |


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


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

* [Bug middle-end/23169] Fortran INTENT information not used in the middle-end for optimizations
       [not found] <bug-23169-280@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2010-07-13 10:37 ` steven at gcc dot gnu dot org
@ 2010-07-13 13:32 ` burnus at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-13 13:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from burnus at gcc dot gnu dot org  2010-07-13 13:32 -------
(In reply to comment #13)
> Still present.

Well, INTENT(IN), nonclobber, and something more is now supported by the middle
end through the "fn spec" attribute (space to make sure this attribute stays
internal for now). INTENT(OUT) could be added, but has not so far.

Cf. PR fortran/43665.

See also:
- "Call argument flags." in tree.h
- "gimple_call_arg_flags" in gimple.c
- Initial patch: http://gcc.gnu.org/ml/fortran/2010-05/msg00032.html
- Committal: http://gcc.gnu.org/ml/fortran/2010-05/msg00092.html


-- 


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


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

* [Bug middle-end/23169] Fortran INTENT information not used in the middle-end for optimizations
       [not found] <bug-23169-4@http.gcc.gnu.org/bugzilla/>
@ 2013-06-25  9:03 ` dominiq at lps dot ens.fr
  0 siblings, 0 replies; 14+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-06-25  9:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #15 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
This PR seems to have been fixed by revision 165559 or earlier. Closing as
FIXED. Please reopen if I am wrong.


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

end of thread, other threads:[~2013-06-25  9:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-23169-280@http.gcc.gnu.org/bugzilla/>
2005-10-02 21:27 ` [Bug fortran/23169] INTENT information not used in the middle-end for optimizations pinskia at gcc dot gnu dot org
2005-10-03  6:14 ` steven at gcc dot gnu dot org
2005-10-09 17:41 ` pinskia at gcc dot gnu dot org
2008-09-21 13:37 ` steven at gcc dot gnu dot org
2008-12-27  0:41 ` dfranke at gcc dot gnu dot org
2008-12-29 14:27 ` dfranke at gcc dot gnu dot org
2009-01-02 10:30 ` rguenth at gcc dot gnu dot org
2009-01-02 11:06 ` tkoenig at gcc dot gnu dot org
2009-01-03 19:47 ` dfranke at gcc dot gnu dot org
2009-04-14 15:21 ` dfranke at gcc dot gnu dot org
2009-05-03 13:33 ` [Bug middle-end/23169] Fortran " fxcoudert at gcc dot gnu dot org
2010-07-13 10:37 ` steven at gcc dot gnu dot org
2010-07-13 13:32 ` burnus at gcc dot gnu dot org
     [not found] <bug-23169-4@http.gcc.gnu.org/bugzilla/>
2013-06-25  9:03 ` dominiq at lps dot ens.fr

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