public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "Bil.Kleb at NASA dot gov" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/53939] New: allows assignment to INTENT(IN) nested component
Date: Thu, 12 Jul 2012 12:28:00 -0000	[thread overview]
Message-ID: <bug-53939-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             Bug #: 53939
           Summary: allows assignment to INTENT(IN) nested component
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: Bil.Kleb@NASA.gov


I cannot get gfortran to complain when I assign something to an INTENT(IN)
variable, viz,

$ gfortran --version | head -1
GNU Fortran (GCC) 4.6.2 20111019 (prerelease)

$ cat > intent.f90 << EOF
module types
  type elem_type
    integer                        :: ncell
    integer, dimension(:), pointer :: cl2g
  end type
  type grid_type
    integer                                :: nelem
    type(elem_type), dimension(:), pointer :: elem 
  end type
end module

module nested_intents
  use types, only: grid_type
 contains
  subroutine pass_through( grid )
    type(grid_type), intent(in) :: grid
    call intent_inout( grid )
  end subroutine
  subroutine intent_inout( grid )
    type(grid_type), intent(in) :: grid ! should produce error: grid changed
    integer :: i, j
    do i = 1,grid%nelem
      do j = 1, grid%elem(i)%ncell
        grid%elem(i)%cl2g(j) = grid%elem(i)%cl2g(j) + 1
      end do
    end do
  end subroutine
end module
EOF

% gfortran -c -W -Wall -Wextra -pedantic-errors intent.f90 
%

The old DEC compiler complains,

alpha% % fort -what
    Compaq Fortran V1.2.0-1882
    Compaq Fortran Compiler V1.2.0-1882-48BBF

alpha% fort -c intent.f90 
f90: Error: intent.f90, line 24: There is an assignment to a dummy symbol with
the explicit INTENT(IN) attribute   [GRID]
        grid%elem(i)%cl2g(j) = grid%elem(i)%cl2g(j) + 1
--------^


             reply	other threads:[~2012-07-12 12:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12 12:28 Bil.Kleb at NASA dot gov [this message]
2012-07-12 13:24 ` [Bug fortran/53939] " burnus at gcc dot gnu.org
2012-07-12 13:29 ` burnus at gcc dot gnu.org
2012-07-12 13:32 ` Bil.Kleb at NASA dot gov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-53939-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).