In the function bar, the INTENT(IN) markers mean that p and q may not be  
modified by bar.  This means that the constants 3 and 12 can be progagated 
in the function foo.  My guess is that there should be some way for alias 
analysis to be taught about this, so I've added the experts to the CC: list. 
 
       integer function foo(a,b,c) 
          integer, intent(out) :: a 
          integer, intent(in) :: b, c 
          integer p, q 
 
          p = 3 
          q = 12 
 
          a = bar(b,c,p,q) 
 
          foo = p*q 
       end function 
 
       integer function bar(b,c,p,q) 
          integer, intent(in) :: b, c, p, q 
          bar = p*b + q*c 
       end function

-- 
           Summary: INTENT information not used in the middle-end for
                    optimizations
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, alias
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: steven at gcc dot gnu dot org
                CC: dberlin at gcc dot gnu dot org,dnovillo at redhat dot
                    com,gcc-bugs at gcc dot gnu dot org


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

Reply via email to