From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14046 invoked by alias); 29 Nov 2012 10:52:59 -0000 Received: (qmail 13903 invoked by uid 48); 29 Nov 2012 10:52:34 -0000 From: "kloedej at knmi dot nl" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/53685] surprising warns about transfer with explicit character range Date: Thu, 29 Nov 2012 10:52:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: kloedej at knmi dot nl X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: 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-11/txt/msg02862.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53685 Jos de Kloe changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kloedej at knmi dot nl --- Comment #7 from Jos de Kloe 2012-11-29 10:52:32 UTC --- I see a very similar problem with a slightly modified piece of testcode on version 4.7.2. Not sure if it is exactly the same, but probably related to the already patched issue. My testcode: program testtransfer integer, parameter :: r8_ = Selected_Real_Kind(15,307) ! = real*8 integer, parameter :: nbytes_r8_ = 8 real(r8_) :: val character(len=1), dimension(16) :: byte_array byte_array(:) = ' ' call mytest(byte_array,val) print *,"val: ",val contains subroutine mytest(byte_array,val) character(len=1), dimension(16), intent(in) :: byte_array real(r8_),intent(out) :: val val = transfer(byte_array(1:nbytes_r8_),val) end subroutine mytest end program testtransfer Results: >gfortran -Wall -o transfer_problem transfer_problem.F90 transfer_problem.F90:15.19: val = transfer(byte_array(1:nbytes_r8_),val) 1 Warning: Intrinsic TRANSFER at (1) has partly undefined result: source size 1 < result size 8 > This occurs for this version: >gfortran --version | head -1 GNU Fortran (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2) on my Fedora17 system. (package gcc-gfortran-4.7.2-2.fc17.x86_64) The problem is not present in: >gfortran --version | head -1 GNU Fortran (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2) on a Fedora16 system. (package gcc-gfortran-4.6.3-2.fc16.x86_64)