This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]