This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33037] TRANSFER should warn on mismatched sizes
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Sep 2007 16:29:08 -0000
- Subject: [Bug fortran/33037] TRANSFER should warn on mismatched sizes
- References: <bug-33037-13164@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla 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