public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/49324] New: iso_varying_string and reshape fail
@ 2011-06-08 15:07 jjcogliati-r1 at yahoo dot com
  2011-06-08 16:23 ` [Bug fortran/49324] " burnus at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: jjcogliati-r1 at yahoo dot com @ 2011-06-08 15:07 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: iso_varying_string and reshape fail
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jjcogliati-r1@yahoo.com


Iso varying string seems to fail with reshape.

I am using the iso_varying_string module available from 
http://www.fortran.com/iso_varying_string.f95

My test case is:
!--------------
program test_ivs
  use iso_varying_string
  implicit none

  type(varying_string),dimension(:,:),allocatable :: array2d
  type(varying_string) :: extra
  integer :: i,j

  allocate(array2d(2,3))

  extra = "four"

  array2d(:,:) = reshape((/ var_str("1"), &
       var_str("2"), var_str("3"), &
       extra, var_str("5"), &
       var_str("six") /), (/ 2, 3 /))


  print *,"array2d second ",ubound(array2d),(("'"//char(array2d(i,j))//"'
",i=1,size(array2d,1)),j=1,size(array2d,2))

end program test_ivs
!-----------------

With this test case, I get the output:

 array2d second            2           3 '' '0' 'P' 'P!&\x02' '0' '!&' 


If I modify it to:
!---------------------
program test_ivs_no_reshape
  use iso_varying_string
  implicit none

  type(varying_string),dimension(:,:),allocatable :: array2d
  type(varying_string) :: extra
  integer :: i,j

  allocate(array2d(2,3))

  extra = "four"

  array2d(:,1) = (/ var_str("1"), var_str("2") /)
  array2d(:,2) = (/ var_str("3"), extra /)
  array2d(:,3) = (/ var_str("5"), var_str("six") /)

  print *,"array2d first ",ubound(array2d),(("'"//char(array2d(i,j))//"'
",i=1,size(array2d,1)),j=1,size(array2d,2))

end program test_ivs_no_reshape
!------------------

I get the following output:
 array2d first            2           3 '1' '2' '3' 'four' '5' 'six' 

which is what I expected. 

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/jjc/gcc/gcc_460_install/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.6.0/configure --prefix=/home/jjc/gcc/gcc_460_install/
Thread model: posix
gcc version 4.6.0 (GCC) 

Compiling:
$ gfortran -Wall -c iso_varying_string.f95
$ gfortran -Wall -o test_ivs.f90 test_ivs.f90 iso_varying_string.o
$ ./test_ivs
 array2d second            2           3 '' '0' 'P' 'PQ�' '0' 'Q�'


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-06-21  9:27 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-08 15:07 [Bug fortran/49324] New: iso_varying_string and reshape fail jjcogliati-r1 at yahoo dot com
2011-06-08 16:23 ` [Bug fortran/49324] " burnus at gcc dot gnu.org
2011-06-08 16:30 ` jjcogliati-r1 at yahoo dot com
2011-06-08 22:13 ` burnus at gcc dot gnu.org
2011-06-09  7:27 ` [Bug fortran/49324] Deep copy missing for array constructors of DT w/ allocatable components burnus at gcc dot gnu.org
2011-06-09 22:23 ` burnus at gcc dot gnu.org
2011-06-10  8:35 ` burnus at gcc dot gnu.org
2011-06-10 12:45 ` burnus at gcc dot gnu.org
2011-06-11 22:09 ` burnus at gcc dot gnu.org
2011-06-14 13:08 ` burnus at gcc dot gnu.org
2011-06-17  6:12 ` burnus at gcc dot gnu.org
2011-07-11 16:38 ` jjcogliati-r1 at yahoo dot com
2011-07-11 16:53 ` burnus at gcc dot gnu.org
2023-06-21  9:27 ` damian at archaeologic dot codes

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).