From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24400 invoked by alias); 12 Jul 2012 12:28:12 -0000 Received: (qmail 24390 invoked by uid 22791); 12 Jul 2012 12:28:10 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 12 Jul 2012 12:27:58 +0000 From: "Bil.Kleb at NASA dot gov" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: Bil.Kleb at NASA dot gov X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-07/txt/msg00947.txt.bz2 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 --------^