[Bug fortran/47030] !GCC$ Attributes do not work for COMMON variables in procedures and BLOCK DATA

eh.toussaint at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Mar 2 22:18:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47030

Erik Toussaint <eh.toussaint at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eh.toussaint at gmail dot
                   |                            |com

--- Comment #3 from Erik Toussaint <eh.toussaint at gmail dot com> 2012-03-02 22:17:52 UTC ---
(In reply to comment #0)

For both program units, if I add 'implicit none' I get the following error:

!GCC$ attributes dllexport :: mydata
                                    1
Error: Symbol 'mydata' at (1) has no IMPLICIT type

So 'mydata' is treated as the identifier of a local entity. Which makes sense,
because a common block and a local entity can have the same name (with certain
restrictions; see 16.3.1 and 16.3.2 in f2008).

Looking at the syntax of the Intel Fortran compiler, the name of the common
block has to be between slashes:

!DEC$ ATTRIBUTES DLLEXPORT :: /X/

http://software.intel.com/sites/products/documentation/hpc/compilerpro/en-us/fortran/win/compiler_f/bldaps_for/win/bldaps_share_datadlls.htm

Trying this with gfortran gives an error:

!GCC$ attributes dllexport :: /mydata/
                               1
Error: Invalid character in name at (1)


P.s.:

> !-------------------------
> module m
>    real :: x
>    common /mydata/ x
>    !GCC$ attributes dllexport :: mydata
> end module
> !-------------------------
> 
> I get the warning:
> 
>   f951: warning: ‘dllexport’ attribute directive ignored [-Wattributes]

I get an error (I'm using MinGW GCC 4.6.2):

m.f90:5:0: error: external linkage required for symbol 'mydata' because of
'dlle
xport' attribute



More information about the Gcc-bugs mailing list