diff mbox

[Fortran] PR54788 ICE on pointer-array element assignment

Message ID 20130628150328.30E603BE1E@mailhost.lps.ens.fr
State New
Headers show

Commit Message

Dominique d'Humières June 28, 2013, 3:03 p.m. UTC
Dear all,

The following patchlet fixes the ICE for the test case bellow and AFAICT
gives the right error.  Regstrapped on x86_64-apple-darwin10.8.0.  

OK for the trunk?

Dominiaue

2013-06-28  Dominique d'Humieres  <dominiq@lps.ens.fr>

	PR fortran/54788
	* array.c (spec_size): handle the case as==NULL.

2013-06-28  Dominique d'Humieres  <dominiq@lps.ens.fr>

	PR fortran/54788
	* gfortran.dg/pointer_remapping_8.f90: New.

Comments

Tobias Burnus July 1, 2013, 8:14 a.m. UTC | #1
Am 28.06.2013 17:03, schrieb Dominique Dhumieres:
> The following patchlet fixes the ICE for the test case bellow and AFAICT
> gives the right error.  Regstrapped on x86_64-apple-darwin10.8.0.
> OK for the trunk?

The patch is okay and sufficiently trivial. Committed as Rev. 200575.

Thanks for the patch!

Tobias


> 2013-06-28  Dominique d'Humieres  <dominiq@lps.ens.fr>
>
> 	PR fortran/54788
> 	* array.c (spec_size): handle the case as==NULL.
>
> 2013-06-28  Dominique d'Humieres  <dominiq@lps.ens.fr>
>
> 	PR fortran/54788
> 	* gfortran.dg/pointer_remapping_8.f90: New.
>
>
> --- ../_clean/gcc/fortran/array.c	2013-06-08 11:35:26.000000000 +0200
> +++ gcc/fortran/array.c	2013-06-27 11:06:24.000000000 +0200
> @@ -2084,7 +2084,7 @@ spec_size (gfc_array_spec *as, mpz_t *re
>     mpz_t size;
>     int d;
>   
> -  if (as->type == AS_ASSUMED_RANK)
> +  if (!as || as->type == AS_ASSUMED_RANK)
>       return false;
>   
>     mpz_init_set_ui (*result, 1);
> --- ../_clean/gcc/testsuite/gfortran.dg/pointer_remapping_8.f90	1970-01-01 01:00:00.000000000 +0100
> +++ gcc/testsuite/gfortran.dg/pointer_remapping_8.f90	2013-06-27 23:04:39.000000000 +0200
> @@ -0,0 +1,10 @@
> +! { dg-do compile }
> +!
> +! PR 54788 ICE on pointer-array element assignment
> +!
> +program bug
> +  integer, pointer :: a(:)
> +  integer :: b
> +  allocate(a(0:0))
> +  a(0:0) => b ! { dg-error "Rank remapping target must be rank 1 or simply contiguous" }
> +end
diff mbox

Patch

--- ../_clean/gcc/fortran/array.c	2013-06-08 11:35:26.000000000 +0200
+++ gcc/fortran/array.c	2013-06-27 11:06:24.000000000 +0200
@@ -2084,7 +2084,7 @@  spec_size (gfc_array_spec *as, mpz_t *re
   mpz_t size;
   int d;
 
-  if (as->type == AS_ASSUMED_RANK)
+  if (!as || as->type == AS_ASSUMED_RANK)
     return false;
 
   mpz_init_set_ui (*result, 1);
--- ../_clean/gcc/testsuite/gfortran.dg/pointer_remapping_8.f90	1970-01-01 01:00:00.000000000 +0100
+++ gcc/testsuite/gfortran.dg/pointer_remapping_8.f90	2013-06-27 23:04:39.000000000 +0200
@@ -0,0 +1,10 @@ 
+! { dg-do compile }
+!
+! PR 54788 ICE on pointer-array element assignment
+!
+program bug
+  integer, pointer :: a(:)
+  integer :: b
+  allocate(a(0:0))
+  a(0:0) => b ! { dg-error "Rank remapping target must be rank 1 or simply contiguous" }
+end