[Bug fortran/33037] TRANSFER should warn on mismatched sizes

2011-08-05 Thread tkoenig at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33037

Thomas Koenig tkoenig at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||tkoenig at gcc dot gnu.org
 Resolution||FIXED

--- Comment #10 from Thomas Koenig tkoenig at gcc dot gnu.org 2011-08-05 
23:13:58 UTC ---
The test cases now yield an error with -Wsurprising, after the fix
for PR 37211.

Closing as fixed.


[Bug fortran/33037] TRANSFER should warn on mismatched sizes

2008-01-11 Thread burnus at gcc dot gnu dot org


--- Comment #9 from burnus at gcc dot gnu dot org  2008-01-11 14:02 ---
For the following ill-defined program, also a warning should be printed. It
comes from PR 34537 and had before an ICE. NAG f95 prints Intrinsic TRANSFER
has partly undefined result.

program main
  implicit none
  character(len=8), target :: t
  character(len=8), pointer :: p
  p = t
  call test(p)
  print *, t
contains
  subroutine test(a)
character(len=8),pointer :: a
a = transfer('Sample',a)
  end subroutine test
end program main


-- 


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



[Bug fortran/33037] TRANSFER should warn on mismatched sizes

2007-09-21 Thread burnus at gcc dot gnu dot org


--- Comment #6 from burnus at gcc dot gnu dot org  2007-09-21 10:21 ---
Subject: Bug 33037

Author: burnus
Date: Fri Sep 21 10:21:29 2007
New Revision: 128646

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=128646
Log:
2007-09-21  Tobias Burnus  [EMAIL PROTECTED]

PR fortran/33037
* simplify.c (gfc_simplify_transfer): Warn if source size
is smaller than result size.

2007-09-21  Tobias Burnus  [EMAIL PROTECTED]

PR fortran/33037
* gfortran.dg/transfer_check_1.f90: New.


Added:
trunk/gcc/testsuite/gfortran.dg/transfer_check_1.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/simplify.c
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug fortran/33037] TRANSFER should warn on mismatched sizes

2007-09-21 Thread burnus at gcc dot gnu dot org


--- Comment #7 from burnus at gcc dot gnu dot org  2007-09-21 10:32 ---
Partially fixed.

Missing: Check whether the size of the LHS is bigger than the result of
TRANSFER (see example in this PR's comment 0).

The current fix gives the warning only if the specified (SIZE=...) result size
is larger than the source size (cf. example in bug 31610 comment 0).


-- 

burnus at gcc dot gnu dot org changed:

   What|Removed |Added

  GCC build triplet|gcc version 4.3.0 20070511  |
   |(experimental)  |
   GCC host triplet|powerpc-apple-darwin8.9.0   |
 GCC target triplet|powerpc-apple-darwin8.9.0   |


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



[Bug fortran/33037] TRANSFER should warn on mismatched sizes

2007-09-21 Thread patchapp at dberlin dot org


--- Comment #8 from patchapp at dberlin dot org  2007-09-22 01:36 ---
Subject: Bug number PR33037

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-09/msg01664.html


-- 


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



[Bug fortran/33037] TRANSFER should warn on mismatched sizes

2007-09-17 Thread burnus at gcc dot gnu dot org


--- Comment #5 from burnus at gcc dot gnu dot org  2007-09-17 16:29 ---
Simple patch; catches if result size  source size (cf. example in bug 31610
comment 0). However, it does not catch if result size  LHS variable. (Example
in this PR.)

Index: simplify.c
===
--- simplify.c  (Revision 128550)
+++ simplify.c  (Arbeitskopie)
@@ -4059,6 +4059,11 @@
   result_size = result_elt_size;
 }

+  if (source_size  result_size)
+gfc_warning(Intrinsic TRANSFER at %L has partly undefined result: source

+   size %ld  result size %ld, source-where,
+   (long) source_size, (long) result_size);
+
   /* Allocate the buffer to store the binary version of the source.  */
   buffer_size = MAX (source_size, result_size);
   buffer = (unsigned char*)alloca (buffer_size);


-- 

burnus at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||burnus at gcc dot gnu dot
   ||org


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



[Bug fortran/33037] TRANSFER should warn on mismatched sizes

2007-08-10 Thread pault at gcc dot gnu dot org


--- Comment #4 from pault at gcc dot gnu dot org  2007-08-10 08:47 ---
Just for the record:

13.14.110 TRANSFER (SOURCE, MOLD [, SIZE])
...snip...
Result Value. If the physical representation of the result has the same length
as that of SOURCE, the physical representation of the result is that of SOURCE.

***If the physical representation of the result is longer than that of SOURCE,
the physical representation of the leading part is that of SOURCE and the
remainder is undefined.***

If the physical representation of the result is shorter than that of SOURCE,
the physical representation of the result is the leading part of SOURCE. If D
and E are scalar variables such that the physical representation of D is as
long as or longer than that of E, the value of TRANSFER (TRANSFER (E, D), E)
shall be the value of E. IF D is an array and E is an array of rank one, the
value of TRANSFER (TRANSFER (E, D), E, SIZE (E)) shall be the value of E.

Paul


-- 


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



[Bug fortran/33037] TRANSFER should warn on mismatched sizes

2007-08-09 Thread fxcoudert at gcc dot gnu dot org


-- 

fxcoudert at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Keywords||diagnostic
   Last reconfirmed|-00-00 00:00:00 |2007-08-09 22:58:12
   date||
Summary|TRANSFER intrinsic is   |TRANSFER should warn on
   |context sensitive   |mismatched sizes


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