[Bug fortran/29951] incorrect conversion from string to integer by TRANSFER()

2006-11-24 Thread kloedej at knmi dot nl


--- Comment #5 from kloedej at knmi dot nl  2006-11-24 08:12 ---
Yes, I can confirm the gfortran version used was 4.3.0.
I didn't notice the version number changed when I downoaded the latest version.
Sorry for that.


-- 


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



[Bug fortran/29951] incorrect conversion from string to integer by TRANSFER()

2006-11-23 Thread burnus at gcc dot gnu dot org


--- Comment #2 from burnus at gcc dot gnu dot org  2006-11-23 11:17 ---
Confirmed.
For transfer(string, integer), gfortran's transfer only uses the first
character (byte).
It should use all characters.

-fdump-tree-original:
  value = VIEW_CONVERT_EXPRint4(byte_string[1]{lb: 1 sz: 1});

In iresolve.c gfortran only checks whether the source is scalar or an array,
the transfer is then done in gfc_conv_intrinsic_transfer (scalar) or
gfc_conv_intrinsic_array_transfer in trans-intrinsic.c.


-- 

burnus at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||burnus at gcc dot gnu dot
   ||org
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Keywords||wrong-code
   Last reconfirmed|-00-00 00:00:00 |2006-11-23 11:17:09
   date||
Summary|incorrect conversion from   |incorrect conversion from
   |string to integer by|string to integer by
   |convert()   |TRANSFER()


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



[Bug fortran/29951] incorrect conversion from string to integer by TRANSFER()

2006-11-23 Thread burnus at gcc dot gnu dot org


--- Comment #3 from burnus at gcc dot gnu dot org  2006-11-23 11:39 ---
 In iresolve.c gfortran only checks whether the source is scalar or an array,
This is none sense it actually checks the mold-rank.

The function to modify is gfc_conv_intrinsic_transfer (trans-intrinsic.c);
we somewhere need to obtain for character strings their byte size.
gfc_conv_intrinsic_array_transfer seems to do the right thing.

For character(len=2) :: byte_array(2) it works,
for character(len=4) :: byte_array(1) it does not.


-- 


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



[Bug fortran/29951] incorrect conversion from string to integer by TRANSFER()

2006-11-23 Thread pinskia at gcc dot gnu dot org


--- Comment #4 from pinskia at gcc dot gnu dot org  2006-11-24 03:00 ---
(In reply to comment #2)
 Confirmed.
 For transfer(string, integer), gfortran's transfer only uses the first
 character (byte).
 It should use all characters.
 
 -fdump-tree-original:
   value = VIEW_CONVERT_EXPRint4(byte_string[1]{lb: 1 sz: 1});

Hmm, I think this is only a bug in 4.3.0 but this was reported against 4.2.0. 
The above VCE is my fault and I have to figure that out but I think there is
something else going wrong if it fails for 4.2.0 since my VCE patch was not
applied there.  I guess I might have revert the VCE patch and create a new one
with memcpy and just hope someone optimizes memcpy better.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||pinskia at gcc dot gnu dot
   ||org


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