[PATCH, gfortran] Re: Cray Pointers

Asher Langton langton2@llnl.gov
Mon Aug 15 19:17:00 GMT 2005


At 12:34 PM -0400 8/14/05, Jack Howarth wrote:
>Asher,
>     I built gcc main branch (4.1) cvs today with your cp_patch_8_12a.diff
>applied on MacOS X 10.4.2. The resulting gfortran seems to pass the
>cray_pointers_1.f90, cray_pointers_2.f90 and loc_1.f90 testsuite tests
>when manually compiled and executed at various optimization levels.
>However I find that the cray_pointers_3.f90 test doesn't compile...
>
>gfortran -fcray-pointer cray_pointers_3.f90
>
>...gives...
>
>  In file cray_pointers_3.f90:8
>
>   pointer (ipt, array) ! { dg-error "integer" }
>              1
>Error: Cray pointer at (1) must be an integer.
>  In file cray_pointers_3.f90:15
<snip>

The best way to run the testsuites is to just drop them in the 
gcc/gcc/testsuites/gfortran.dg directory and let dejagnu run them. 
For cray_pointer2_3,f90, dejagnu checks that all of the appropriate 
error messages are produced.

>and while I can compile  loc_2.f90 with...
>
>gfortran  loc_2.f90
>
>...the resulting binary seems to generate an error...
>
>[Jack-Howarths-Computer:~/Desktop] howarth% ./a.out
>        12496

Yes, that looks correct.  In the testsuite, loc_2.f90 was only 
supposed to be compiled (even though the resulting binary will run 
correctly), because I was trying to prevent the following regression: 
if you comment out the following lines in trans_intrinsic.c, 
gfc_conv_intrinsic_loc:

   temp_var = gfc_create_var (gfc_unsigned_type (long_integer_type_node),
			     NULL);
   gfc_add_modify_expr (&se->pre, temp_var, se->expr);
   se->expr = temp_var;

then the compilation of loc_2.f90 will fail with an internal compiler 
error.  In particular, the following assertion fails in gcc/expr.c, 
expand_expr_addr_expr_1(...), line 6292:

   gcc_assert (inner != exp);

This only happens when a loc call is passed as an argument to a 
subroutine or a print statement, and only when the loc argument is 
part of a common block.


-Asher



More information about the Fortran mailing list