This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch,Fortran,committed] PR 41219 - move variable decl. out of loop
- From: Tobias Burnus <burnus at net-b dot de>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 3 Sep 2009 09:37:13 +0200
- Subject: [Patch,Fortran,committed] PR 41219 - move variable decl. out of loop
Hi all,
I have committed the patch below as obvious. The compiler was warning
that "str" might be used uninitialized and I think it is right; in
the loop one has:
if (i == 0)
str = 1;
else
str = str * GFC_DESCRIPTOR_EXTENT(f_ptr_out,i-1);
Thus I moved the declaration of "str" out of the loop.
The PR contains more warnings which should be fixed ...
Tobias
Sending libgfortran/ChangeLog
Sending libgfortran/intrinsics/iso_c_binding.c
Transmitting file data ..
Committed revision 151371.
Index: intrinsics/iso_c_binding.c
===================================================================
--- intrinsics/iso_c_binding.c (revision 151370)
+++ intrinsics/iso_c_binding.c (working copy)
@@ -95,7 +95,7 @@ ISO_C_BINDING_PREFIX (c_f_pointer_u0) (v
if (shape != NULL)
{
index_type source_stride;
- index_type size;
+ index_type size, str;
char *p;
f_ptr_out->offset = 0;
@@ -109,7 +109,7 @@ ISO_C_BINDING_PREFIX (c_f_pointer_u0) (v
shapeSize = GFC_DESCRIPTOR_EXTENT(shape,0);
for (i = 0; i < shapeSize; i++)
{
- index_type str, ub;
+ index_type ub;
/* Have to allow for the SHAPE array to be any valid kind for
an INTEGER type. */
Index: ChangeLog
===================================================================
--- ChangeLog (revision 151370)
+++ ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2009-09-03 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/41219
+ * intrinsics/iso_c_binding.c (c_f_pointer_u0): Move variable
+ declaration out of the loop.
+
2009-08-30 Thomas Koenig <tkoenig@gcc.gnu.org>
* m4/pack.m4 (pack_'rtype_code`): Use count_0 for counting true