public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34796]  New: [4.3 Regression] Too strict error checking for assumed-shaped array
@ 2008-01-15 13:16 burnus at gcc dot gnu dot org
  2008-01-15 14:44 ` [Bug fortran/34796] " burnus at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-15 13:16 UTC (permalink / raw)
  To: gcc-bugs

Compiling gives twice the error message:
  Error: Element of assumed-shaped array passed to dummy argument 'y'

Other compilers give it only for "rdiff2"; thinking over it, there is no reason
to reject it for "rdiff" as the memory is contiguous which might not be the
case for dummy arguments (stripes!). I will try to dig out the exact wording
from the standard. The check was added by me in  PR34665.

A simple fix would be to check for attr.dummy, but maybe one has to do
something else.

subroutine test(rdiff2)
implicit none
interface
  subroutine rlv(y)
    real   :: y(3)
  end subroutine rlv
end interface

real, allocatable :: rdiff(:,:,:)
real :: rdiff2(:,:,:)
call rlv(rdiff(1,1,1))  ! OK, it is contiguous memory (error wrong)
call rlv(rdiff2(1,1,1)) ! WRONG, error is ok (non contiguous)
end


-- 
           Summary: [4.3 Regression] Too strict error checking for assumed-
                    shaped array
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        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=34796


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

* [Bug fortran/34796] [4.3 Regression] Too strict error checking for assumed-shaped array
  2008-01-15 13:16 [Bug fortran/34796] New: [4.3 Regression] Too strict error checking for assumed-shaped array burnus at gcc dot gnu dot org
@ 2008-01-15 14:44 ` burnus at gcc dot gnu dot org
  2008-01-15 18:09 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-15 14:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2008-01-15 14:04 -------
>From the Fortran 2003 standard ("12.4.1.2 Actual arguments associated with
dummy data objects")

"If the actual argument is scalar, the corresponding dummy argument shall be
scalar unless the actual argument is of type default character, of type
character with the C character kind (15.1), or is an element or substring of an
element of an array that is not an assumed-shape or pointer array. If the
procedure is nonelemental and is referenced by a generic name or as a defined
operator or defined assignment, the ranks of the actual arguments and
corresponding dummy arguments shall agree.
If a dummy argument is an assumed-shape array, the rank of the actual argument
shall be the same as the rank of the dummy argument; the actual argument shall
not be an assumed-size array (including an array element designator or an array
element substring designator)."

In the example posted, the array is of DEFERRED type and not an ASSUMED-SHAPE
array and thus the first part of the last paragraph does not apply. As DEFERRED
arrays are also not forbidden in the paragraph before, they are allowed.

Thus only
a) pointer arrays (dummy or not)
b) assumed-shape array (which are dummy arguments)
should be rejected as they might have strides and thus accessing the next byte
in memory might leave the array.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |burnus at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-01-15 14:04:49
               date|                            |


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


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

* [Bug fortran/34796] [4.3 Regression] Too strict error checking for assumed-shaped array
  2008-01-15 13:16 [Bug fortran/34796] New: [4.3 Regression] Too strict error checking for assumed-shaped array burnus at gcc dot gnu dot org
  2008-01-15 14:44 ` [Bug fortran/34796] " burnus at gcc dot gnu dot org
@ 2008-01-15 18:09 ` burnus at gcc dot gnu dot org
  2008-01-15 20:49 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-15 18:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2008-01-15 18:00 -------
Patch: http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00656.html


-- 


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


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

* [Bug fortran/34796] [4.3 Regression] Too strict error checking for assumed-shaped array
  2008-01-15 13:16 [Bug fortran/34796] New: [4.3 Regression] Too strict error checking for assumed-shaped array burnus at gcc dot gnu dot org
  2008-01-15 14:44 ` [Bug fortran/34796] " burnus at gcc dot gnu dot org
  2008-01-15 18:09 ` burnus at gcc dot gnu dot org
@ 2008-01-15 20:49 ` burnus at gcc dot gnu dot org
  2008-01-16  8:01 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-15 20:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2008-01-15 19:30 -------
*** Bug 34788 has been marked as a duplicate of this bug. ***


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |krefson at googlemail dot
                   |                            |com


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


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

* [Bug fortran/34796] [4.3 Regression] Too strict error checking for assumed-shaped array
  2008-01-15 13:16 [Bug fortran/34796] New: [4.3 Regression] Too strict error checking for assumed-shaped array burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-01-15 20:49 ` burnus at gcc dot gnu dot org
@ 2008-01-16  8:01 ` burnus at gcc dot gnu dot org
  2008-01-16  8:46 ` burnus at gcc dot gnu dot org
  2008-01-20 10:49 ` tkoenig at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-16  8:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2008-01-16 07:12 -------
Subject: Bug 34796

Author: burnus
Date: Wed Jan 16 07:12:00 2008
New Revision: 131566

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131566
Log:
2008-01-16  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34796
        * interface.c (compare_parameter): Allow AS_DEFERRED array
        elements and reject attr.pointer array elemenents.
        (get_expr_storage_size): Return storage size of elements of
        assumed-shape and pointer arrays.

2008-01-16  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34796
        * gfortran.dg/argument_checking_13.f90: New.
        * gfortran.dg/argument_checking_14.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/argument_checking_13.f90
    trunk/gcc/testsuite/gfortran.dg/argument_checking_14.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/interface.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/34796] [4.3 Regression] Too strict error checking for assumed-shaped array
  2008-01-15 13:16 [Bug fortran/34796] New: [4.3 Regression] Too strict error checking for assumed-shaped array burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-01-16  8:01 ` burnus at gcc dot gnu dot org
@ 2008-01-16  8:46 ` burnus at gcc dot gnu dot org
  2008-01-20 10:49 ` tkoenig at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-16  8:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2008-01-16 07:13 -------
Fixed on the trunk (4.3.0).


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/34796] [4.3 Regression] Too strict error checking for assumed-shaped array
  2008-01-15 13:16 [Bug fortran/34796] New: [4.3 Regression] Too strict error checking for assumed-shaped array burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-01-16  8:46 ` burnus at gcc dot gnu dot org
@ 2008-01-20 10:49 ` tkoenig at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-01-20 10:49 UTC (permalink / raw)
  To: gcc-bugs



-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.3.0


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


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

end of thread, other threads:[~2008-01-20  9:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-15 13:16 [Bug fortran/34796] New: [4.3 Regression] Too strict error checking for assumed-shaped array burnus at gcc dot gnu dot org
2008-01-15 14:44 ` [Bug fortran/34796] " burnus at gcc dot gnu dot org
2008-01-15 18:09 ` burnus at gcc dot gnu dot org
2008-01-15 20:49 ` burnus at gcc dot gnu dot org
2008-01-16  8:01 ` burnus at gcc dot gnu dot org
2008-01-16  8:46 ` burnus at gcc dot gnu dot org
2008-01-20 10:49 ` tkoenig 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).