public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34816]  New: logical kinds for any and all
@ 2008-01-16 20:08 tkoenig at gcc dot gnu dot org
  2008-02-19 15:49 ` [Bug fortran/34816] " fxcoudert at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-01-16 20:08 UTC (permalink / raw)
  To: gcc-bugs

The patch for PR 34671 created an optimization opportunity that
is currently missed.

The "any" and "all" functions with dim=1 now accept an argument that
can be any logical type.  Only the lowest-order byte is used for
evaluation.

Now consider the following:

program main
  logical(kind=1), dimension(2,2) :: a
  logical, dimension(2) :: b
  data a / .false., .true., .false., .false. /
  b = any(a,dim=1)
end program main

This gets translated to

    _gfortran_any_l1 (&atmp.2, &parm.1, &C.511);
    {
      integer(kind=4) S.4;

      S.4 = 0;
      while (1)
        {
          if (S.4 > 1) goto L.1;
          b[S.4] = (logical(kind=4)) (*(logical(kind=1)[2] *)
atmp.2.data)[S.4];
          S.4 = S.4 + 1;
        }
      L.1:;
    }
  }

where a simple call to _gfortran_any_l4 would have been enough.


-- 
           Summary: logical kinds for any and all
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


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


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

* [Bug fortran/34816] logical kinds for any and all
  2008-01-16 20:08 [Bug fortran/34816] New: logical kinds for any and all tkoenig at gcc dot gnu dot org
@ 2008-02-19 15:49 ` fxcoudert at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-02-19 15:49 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-02-19 15:48:57
               date|                            |


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


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

end of thread, other threads:[~2008-02-19 15:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-16 20:08 [Bug fortran/34816] New: logical kinds for any and all tkoenig at gcc dot gnu dot org
2008-02-19 15:49 ` [Bug fortran/34816] " fxcoudert at gcc dot gnu dot 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).