[Patch, gfortran] Fix host-associated, use-associated common blocks

Paul Thomas paulthomas2@wanadoo.fr
Fri Aug 19 15:07:00 GMT 2005


:ADDPATCH <fortran>:

This patch allows common block symbols that are both host and use 
associated to find the correct declaration.

At present, gfortran builds a reference to a module variable of the same 
name as the use_associated common block variable:  ie. with the attached 
test-case

[prt@localhost mytests]# /gcc-4.0/bin/gfortran  host_common.f90
/tmp/cc2DP9BV.o(.text+0x25): In function `foo.468':
: undefined reference to `__global__a'
collect2: ld returned 1 exit status

The patch works by moving the call to gfc_generate_contained_functions, 
in gfc_generate_function_code, to after the call to gfc_trans_common.  
This ensures that the host, use-associated common blocks are built and 
the declarations made before the contained functions are generated.

Bubblestrapped and regtested on FC3/Athlon 1700.

OK for mainline and 4.0?

Paul T


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: host_common.txt
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050819/33494067/attachment.txt>


More information about the Fortran mailing list