This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran] PR 35831: Checking characteristics of dummy arguments


Hi all,

here is a straightforward patch for a rather old PR, which deals with
argument checking. The patch at hand fixes one of the outstanding todo
items of the PR (see comment 17), namely extending the attribute
checking of dummy arguments. It adds checks for the four missing
attributes (asynchronous, contiguous, value, volatile). The relevant
standard reference is F08:12.3.2.

Included is also a test case and a fix for one testsuite case which
was rejected with the patch.

Regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus



2013-12-10  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/35831
    * interface.c (check_dummy_characteristics): Add checks for several
    attributes.


2013-12-10  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/35831
    * gfortran.dg/c_by_val_5.f90: Modified.
    * gfortran.dg/dummy_procedure_10.f90: New.

Attachment: pr35831.diff
Description: Text document

! { dg-do compile }
!
! PR 35831: [F95] Shape mismatch check missing for dummy procedure argument
!
! Contributed by Janus Weil <janus@gcc.gnu.org>

program test_attributes

  call tester1 (a1)   ! { dg-error "ASYNCHRONOUS mismatch in argument" }
  call tester2 (a2)   ! { dg-error "CONTIGUOUS mismatch in argument" }
  call tester3 (a1)   ! { dg-error "VALUE mismatch in argument" }
  call tester4 (a1)   ! { dg-error "VOLATILE mismatch in argument" }

contains

  subroutine a1(aa)
    real :: aa
  end subroutine
  
  subroutine a2(bb)
    real :: bb(:)
  end subroutine

  subroutine tester1 (f1)
    interface
      subroutine f1 (a)
        real, asynchronous :: a
      end subroutine
    end interface
  end subroutine

  subroutine tester2 (f2)
    interface
      subroutine f2 (b)
        real, contiguous :: b(:)
      end subroutine
    end interface
  end subroutine
  
  subroutine tester3 (f3)
    interface
      subroutine f3 (c)
        real, value :: c
      end subroutine
    end interface
  end subroutine
  
  subroutine tester4 (f4)
    interface
      subroutine f4 (d)
        real, volatile :: d
      end subroutine
    end interface
  end subroutine

end

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]