public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/56907] New: C_LOC shall not call internal-PACK when an array argument is used
@ 2013-04-10 15:30 burnus at gcc dot gnu.org
  2013-04-20 11:02 ` [Bug fortran/56907] " burnus at gcc dot gnu.org
  2013-04-20 11:03 ` burnus at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-04-10 15:30 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56907
           Summary: C_LOC shall not call internal-PACK when an array
                    argument is used
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


Found when looking at gfortran.dg/assumed_type_2.f90.

For an array argument, C_LOC should simply take the first element of the array
(section). Currently, it invokes internal packing.

As Fortran 2008 demands that the argument is contiguous, internal_packing
should simply return the original array (section) - hence, there is no
wrong-code issue - just a missed optimization.

>From the dump:
    D.1901 = _gfortran_internal_pack (&parm.4);
    D.1903 = D.1901;

Test case:

! { dg-do compile }
! { dg-options "-fdump-tree-original" }
!
! PR fortran/ <<<<<<<<<<<
!

subroutine sub(xxx)
  use iso_c_binding
  implicit none
  integer, target :: xxx(:)
  type(c_ptr) :: ptr
  ptr = c_loc (xxx)
end
! { dg-final { scan-tree-dump-not " _gfortran_internal_pack" "original" } }
! { dg-final { cleanup-tree-dump "optimized" } }


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

* [Bug fortran/56907] C_LOC shall not call internal-PACK when an array argument is used
  2013-04-10 15:30 [Bug fortran/56907] New: C_LOC shall not call internal-PACK when an array argument is used burnus at gcc dot gnu.org
@ 2013-04-20 11:02 ` burnus at gcc dot gnu.org
  2013-04-20 11:03 ` burnus at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-04-20 11:02 UTC (permalink / raw)
  To: gcc-bugs


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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

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

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-20 11:02:41 UTC ---
Author: burnus
Date: Sat Apr 20 11:01:55 2013
New Revision: 198109

URL: http://gcc.gnu.org/viewcvs?rev=198109&root=gcc&view=rev
Log:
2013-04-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56907
        * trans-intrinsic.c (conv_isocbinding_function): Don't pack
        * array
        passed to C_LOC

2013-04-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56907
        * gfortran.dg/c_loc_test_22.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/c_loc_test_22.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-intrinsic.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/56907] C_LOC shall not call internal-PACK when an array argument is used
  2013-04-10 15:30 [Bug fortran/56907] New: C_LOC shall not call internal-PACK when an array argument is used burnus at gcc dot gnu.org
  2013-04-20 11:02 ` [Bug fortran/56907] " burnus at gcc dot gnu.org
@ 2013-04-20 11:03 ` burnus at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-04-20 11:03 UTC (permalink / raw)
  To: gcc-bugs


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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-20 11:03:06 UTC ---
FIXED on the 4.9 trunk.


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

end of thread, other threads:[~2013-04-20 11:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-10 15:30 [Bug fortran/56907] New: C_LOC shall not call internal-PACK when an array argument is used burnus at gcc dot gnu.org
2013-04-20 11:02 ` [Bug fortran/56907] " burnus at gcc dot gnu.org
2013-04-20 11:03 ` burnus 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).