public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kloedej at knmi dot nl" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-53685-4-VuxV648QTs@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53685-4@http.gcc.gnu.org/bugzilla/>


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

Jos de Kloe <kloedej at knmi dot nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kloedej at knmi dot nl

--- Comment #7 from Jos de Kloe <kloedej at knmi dot nl> 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)


  parent reply	other threads:[~2012-11-29 10:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-15 14:35 [Bug fortran/53685] New: " ajmay81 at googlemail dot com
2012-06-15 16:18 ` [Bug fortran/53685] " burnus at gcc dot gnu.org
2012-06-15 17:02 ` burnus at gcc dot gnu.org
2012-06-16 10:51 ` burnus at gcc dot gnu.org
2012-06-17 19:31 ` burnus at gcc dot gnu.org
2012-06-22 10:28 ` burnus at gcc dot gnu.org
2012-09-24 13:58 ` ajmay81 at googlemail dot com
2012-11-29 10:52 ` kloedej at knmi dot nl [this message]
2013-04-22 19:23 ` janus at gcc dot gnu.org
2013-04-26 22:50 ` janus at gcc dot gnu.org

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-53685-4-VuxV648QTs@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).