Patchwork [fortran] Further fixes for PR 49479

login
register
mail settings
Submitter Thomas Koenig
Date Sept. 8, 2011, 8 p.m.
Message ID <4E691ECE.2060304@netcologne.de>
Download mbox | patch
Permalink /patch/113934/
State New
Headers show

Comments

Thomas Koenig - Sept. 8, 2011, 8 p.m.
Hello world,

this patch fixes the same kind of problems that PR 49479 addressed,
by applying the same kind of fix to another class of function.

I have not bothered to find a test case.  Regression-tested.

OK for trunk and (after a few days) for 4.6?

	Thomas

2011-09-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/49479
         * generated/m4/ifunction.m4:  Always call internal_malloc_size
         even when there is no return array.
         * generated/generated/maxloc1_16_i16.c: Regenerated.
         * generated/generated/maxloc1_16_i1.c: Regenerated.
         * generated/generated/maxloc1_16_i2.c: Regenerated.
         * generated/generated/maxloc1_16_i4.c: Regenerated.
         * generated/generated/maxloc1_16_i8.c: Regenerated.
         * generated/generated/maxloc1_16_r10.c: Regenerated.
         * generated/generated/maxloc1_16_r16.c: Regenerated.
         * generated/generated/maxloc1_16_r4.c: Regenerated.
         * generated/generated/maxloc1_16_r8.c: Regenerated.
         * generated/generated/maxloc1_4_i16.c: Regenerated.
         * generated/generated/maxloc1_4_i1.c: Regenerated.
         * generated/generated/maxloc1_4_i2.c: Regenerated.
         * generated/generated/maxloc1_4_i4.c: Regenerated.
         * generated/generated/maxloc1_4_i8.c: Regenerated. 

         * generated/generated/maxloc1_4_r10.c: Regenerated. 

         * generated/generated/maxloc1_4_r16.c: Regenerated. 

         * generated/generated/maxloc1_4_r4.c: Regenerated. 

         * generated/generated/maxloc1_4_r8.c: Regenerated. 

         * generated/generated/maxloc1_8_i16.c: Regenerated. 

         * generated/generated/maxloc1_8_i1.c: Regenerated. 

         * generated/generated/maxloc1_8_i2.c: Regenerated. 

         * generated/generated/maxloc1_8_i4.c: Regenerated. 

         * generated/generated/maxloc1_8_i8.c: Regenerated. 

         * generated/generated/maxloc1_8_r10.c: Regenerated. 

         * generated/generated/maxloc1_8_r16.c: Regenerated. 

         * generated/generated/maxloc1_8_r4.c: Regenerated. 

         * generated/generated/maxloc1_8_r8.c: Regenerated. 

         * generated/generated/maxval_i16.c: Regenerated. 

         * generated/generated/maxval_i1.c: Regenerated. 

         * generated/generated/maxval_i2.c: Regenerated. 

         * generated/generated/maxval_i4.c: Regenerated. 

         * generated/generated/maxval_i8.c: Regenerated. 

         * generated/generated/maxval_r10.c: Regenerated. 

         * generated/generated/maxval_r16.c: Regenerated. 

         * generated/generated/maxval_r4.c: Regenerated. 

         * generated/generated/maxval_r8.c: Regenerated. 

         * generated/generated/minloc1_16_i16.c: Regenerated. 

         * generated/generated/minloc1_16_i1.c: Regenerated. 

         * generated/generated/minloc1_16_i2.c: Regenerated. 

         * generated/generated/minloc1_16_i4.c: Regenerated. 

         * generated/generated/minloc1_16_i8.c: Regenerated. 

         * generated/generated/minloc1_16_r10.c: Regenerated. 

         * generated/generated/minloc1_16_r16.c: Regenerated. 

         * generated/generated/minloc1_16_r4.c: Regenerated. 

         * generated/generated/minloc1_16_r8.c: Regenerated. 

         * generated/generated/minloc1_4_i16.c: Regenerated. 

         * generated/generated/minloc1_4_i1.c: Regenerated. 

         * generated/generated/minloc1_4_i2.c: Regenerated. 

         * generated/generated/minloc1_4_i4.c: Regenerated. 

         * generated/generated/minloc1_4_i8.c: Regenerated. 

         * generated/generated/minloc1_4_r10.c: Regenerated. 

         * generated/generated/minloc1_4_r16.c: Regenerated. 

         * generated/generated/minloc1_4_r4.c: Regenerated. 

         * generated/generated/minloc1_4_r8.c: Regenerated. 

         * generated/generated/minloc1_8_i16.c: Regenerated.
         * generated/generated/minloc1_8_i1.c: Regenerated.
         * generated/generated/minloc1_8_i2.c: Regenerated.
         * generated/generated/minloc1_8_i4.c: Regenerated.
         * generated/generated/minloc1_8_i8.c: Regenerated.
         * generated/generated/minloc1_8_r10.c: Regenerated.
         * generated/generated/minloc1_8_r16.c: Regenerated.
         * generated/generated/minloc1_8_r4.c: Regenerated.
         * generated/generated/minloc1_8_r8.c: Regenerated.
         * generated/generated/minval_i16.c: Regenerated.
         * generated/generated/minval_i1.c: Regenerated.
         * generated/generated/minval_i2.c: Regenerated.
         * generated/generated/minval_i4.c: Regenerated.
         * generated/generated/minval_i8.c: Regenerated.
         * generated/generated/minval_r10.c: Regenerated.
         * generated/generated/minval_r16.c: Regenerated.
         * generated/generated/minval_r4.c: Regenerated.
         * generated/generated/minval_r8.c: Regenerated.
         * generated/generated/product_c10.c: Regenerated.
         * generated/generated/product_c16.c: Regenerated.
         * generated/generated/product_c4.c: Regenerated.
         * generated/generated/product_c8.c: Regenerated.
         * generated/generated/product_i16.c: Regenerated.
         * generated/generated/product_i1.c: Regenerated.
         * generated/generated/product_i2.c: Regenerated.
         * generated/generated/product_i4.c: Regenerated.
         * generated/generated/product_i8.c: Regenerated.
         * generated/generated/product_r10.c: Regenerated.
         * generated/generated/product_r16.c: Regenerated.
         * generated/generated/product_r4.c: Regenerated.
         * generated/generated/product_r8.c: Regenerated.
         * generated/generated/sum_c10.c: Regenerated.
         * generated/generated/sum_c16.c: Regenerated.
         * generated/generated/sum_c4.c: Regenerated.
         * generated/generated/sum_c8.c: Regenerated.
         * generated/generated/sum_i16.c: Regenerated.
         * generated/generated/sum_i1.c: Regenerated.
         * generated/generated/sum_i2.c: Regenerated.
         * generated/generated/sum_i4.c: Regenerated.
         * generated/generated/sum_i8.c: Regenerated.
         * generated/generated/sum_r10.c: Regenerated.
         * generated/generated/sum_r16.c: Regenerated.
         * generated/generated/sum_r4.c: Regenerated.
         * generated/generated/sum_r8.c: Regenerated.
Tobias Burnus - Sept. 10, 2011, 1:16 p.m.
Thomas Koenig wrote:
> this patch fixes the same kind of problems that PR 49479 addressed,
> by applying the same kind of fix to another class of function.
>
> OK for trunk and (after a few days) for 4.6?

OK. Though, I find the ChangeLog entry a bit misleading: There is a 
(zero-sized) return array.

Tobias

> 2011-09-08  Thomas Koenig <tkoenig@gcc.gnu.org>
>
>         PR fortran/49479
>         * generated/m4/ifunction.m4:  Always call internal_malloc_size
>         even when there is no return array.
>         * generated/generated/maxloc1_16_i16.c: Regenerated.
>         * generated/generated/maxloc1_16_i1.c: Regenerated.
>         * generated/generated/maxloc1_16_i2.c: Regenerated.
>         * generated/generated/maxloc1_16_i4.c: Regenerated.
>         * generated/generated/maxloc1_16_i8.c: Regenerated.
>         * generated/generated/maxloc1_16_r10.c: Regenerated.
>         * generated/generated/maxloc1_16_r16.c: Regenerated.
>         * generated/generated/maxloc1_16_r4.c: Regenerated.
>         * generated/generated/maxloc1_16_r8.c: Regenerated.
>         * generated/generated/maxloc1_4_i16.c: Regenerated.
>         * generated/generated/maxloc1_4_i1.c: Regenerated.
>         * generated/generated/maxloc1_4_i2.c: Regenerated.
>         * generated/generated/maxloc1_4_i4.c: Regenerated.
>         * generated/generated/maxloc1_4_i8.c: Regenerated.
>         * generated/generated/maxloc1_4_r10.c: Regenerated.
>         * generated/generated/maxloc1_4_r16.c: Regenerated.
>         * generated/generated/maxloc1_4_r4.c: Regenerated.
>         * generated/generated/maxloc1_4_r8.c: Regenerated.
>         * generated/generated/maxloc1_8_i16.c: Regenerated.
>         * generated/generated/maxloc1_8_i1.c: Regenerated.
>         * generated/generated/maxloc1_8_i2.c: Regenerated.
>         * generated/generated/maxloc1_8_i4.c: Regenerated.
>         * generated/generated/maxloc1_8_i8.c: Regenerated.
>         * generated/generated/maxloc1_8_r10.c: Regenerated.
>         * generated/generated/maxloc1_8_r16.c: Regenerated.
>         * generated/generated/maxloc1_8_r4.c: Regenerated.
>         * generated/generated/maxloc1_8_r8.c: Regenerated.
>         * generated/generated/maxval_i16.c: Regenerated.
>         * generated/generated/maxval_i1.c: Regenerated.
>         * generated/generated/maxval_i2.c: Regenerated.
>         * generated/generated/maxval_i4.c: Regenerated.
>         * generated/generated/maxval_i8.c: Regenerated.
>         * generated/generated/maxval_r10.c: Regenerated.
>         * generated/generated/maxval_r16.c: Regenerated.
>         * generated/generated/maxval_r4.c: Regenerated.
>         * generated/generated/maxval_r8.c: Regenerated.
>         * generated/generated/minloc1_16_i16.c: Regenerated.
>         * generated/generated/minloc1_16_i1.c: Regenerated.
>         * generated/generated/minloc1_16_i2.c: Regenerated.
>         * generated/generated/minloc1_16_i4.c: Regenerated.
>         * generated/generated/minloc1_16_i8.c: Regenerated.
>         * generated/generated/minloc1_16_r10.c: Regenerated.
>         * generated/generated/minloc1_16_r16.c: Regenerated.
>         * generated/generated/minloc1_16_r4.c: Regenerated.
>         * generated/generated/minloc1_16_r8.c: Regenerated.
>         * generated/generated/minloc1_4_i16.c: Regenerated.
>         * generated/generated/minloc1_4_i1.c: Regenerated.
>         * generated/generated/minloc1_4_i2.c: Regenerated.
>         * generated/generated/minloc1_4_i4.c: Regenerated.
>         * generated/generated/minloc1_4_i8.c: Regenerated.
>         * generated/generated/minloc1_4_r10.c: Regenerated.
>         * generated/generated/minloc1_4_r16.c: Regenerated.
>         * generated/generated/minloc1_4_r4.c: Regenerated.
>         * generated/generated/minloc1_4_r8.c: Regenerated.
>         * generated/generated/minloc1_8_i16.c: Regenerated.
>         * generated/generated/minloc1_8_i1.c: Regenerated.
>         * generated/generated/minloc1_8_i2.c: Regenerated.
>         * generated/generated/minloc1_8_i4.c: Regenerated.
>         * generated/generated/minloc1_8_i8.c: Regenerated.
>         * generated/generated/minloc1_8_r10.c: Regenerated.
>         * generated/generated/minloc1_8_r16.c: Regenerated.
>         * generated/generated/minloc1_8_r4.c: Regenerated.
>         * generated/generated/minloc1_8_r8.c: Regenerated.
>         * generated/generated/minval_i16.c: Regenerated.
>         * generated/generated/minval_i1.c: Regenerated.
>         * generated/generated/minval_i2.c: Regenerated.
>         * generated/generated/minval_i4.c: Regenerated.
>         * generated/generated/minval_i8.c: Regenerated.
>         * generated/generated/minval_r10.c: Regenerated.
>         * generated/generated/minval_r16.c: Regenerated.
>         * generated/generated/minval_r4.c: Regenerated.
>         * generated/generated/minval_r8.c: Regenerated.
>         * generated/generated/product_c10.c: Regenerated.
>         * generated/generated/product_c16.c: Regenerated.
>         * generated/generated/product_c4.c: Regenerated.
>         * generated/generated/product_c8.c: Regenerated.
>         * generated/generated/product_i16.c: Regenerated.
>         * generated/generated/product_i1.c: Regenerated.
>         * generated/generated/product_i2.c: Regenerated.
>         * generated/generated/product_i4.c: Regenerated.
>         * generated/generated/product_i8.c: Regenerated.
>         * generated/generated/product_r10.c: Regenerated.
>         * generated/generated/product_r16.c: Regenerated.
>         * generated/generated/product_r4.c: Regenerated.
>         * generated/generated/product_r8.c: Regenerated.
>         * generated/generated/sum_c10.c: Regenerated.
>         * generated/generated/sum_c16.c: Regenerated.
>         * generated/generated/sum_c4.c: Regenerated.
>         * generated/generated/sum_c8.c: Regenerated.
>         * generated/generated/sum_i16.c: Regenerated.
>         * generated/generated/sum_i1.c: Regenerated.
>         * generated/generated/sum_i2.c: Regenerated.
>         * generated/generated/sum_i4.c: Regenerated.
>         * generated/generated/sum_i8.c: Regenerated.
>         * generated/generated/sum_r10.c: Regenerated.
>         * generated/generated/sum_r16.c: Regenerated.
>         * generated/generated/sum_r4.c: Regenerated.
>         * generated/generated/sum_r8.c: Regenerated.
Thomas Koenig - Sept. 10, 2011, 2:08 p.m.
Hi Tobias,

> OK. Though, I find the ChangeLog entry a bit misleading: There is a
> (zero-sized) return array.

I have changed the entry to

	* generated/m4/ifunction.m4:  Always call internal_malloc_size
	even when there is a zero-sized return array

on commit.

Thanks for the review!

	Thomas

Patch

Index: m4/ifunction.m4
===================================================================
--- m4/ifunction.m4	(Revision 178139)
+++ m4/ifunction.m4	(Arbeitskopie)
@@ -88,6 +88,7 @@  name`'rtype_qual`_'atype_code (rtype * const restr
       alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
     		   * extent[rank-1];
 
+      retarray->data = internal_malloc_size (alloc_size);
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
@@ -95,8 +96,6 @@  name`'rtype_qual`_'atype_code (rtype * const restr
 	  return;
 
 	}
-      else
-	retarray->data = internal_malloc_size (alloc_size);
     }
   else
     {