public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47030] New: !GCC$ Attributes do not work for COMMON variables in procedures and BLOCK DATA
@ 2010-12-21 10:49 burnus at gcc dot gnu.org
  2010-12-27 23:34 ` [Bug fortran/47030] " dfranke at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-12-21 10:49 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: !GCC$ Attributes do not work for COMMON variables in
                    procedures and BLOCK DATA
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


Cf. report by Arjen Markus at
http://gcc.gnu.org/ml/fortran/2010-12/msg00124.html  -- There is also a Windows
example.

Under Linux DLLEXPORT is not supported and thus there is a warning, which makes
testing very convenient. If I do now:
!-------------------------
subroutine print
   real :: x
!GCC$ attributes dllexport :: mydata
   common /mydata/ x

   write(*,*) 'X = ', x

end subroutine print
!-------------------------

it simply compiles - i.e. the DLLEXPORT is ignored. However, if I use:

!-------------------------
module m
   real :: x
   common /mydata/ x
   !GCC$ attributes dllexport :: mydata
end module
!-------------------------

I get the warning:

  f951: warning: ‘dllexport’ attribute directive ignored [-Wattributes]

Which directly implies that the attribute it not taken into account for COMMON
blocks defined in SUBROUTINE/FUNCTION.


Same problem for BLOCK DATA: No warning for

      block data
        real alpha, beta
        common /vector/ alpha,beta
        data alpha/3.14/, beta/2.71/
!GCC$ attributes dllexport :: vector
      end


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/47030] !GCC$ Attributes do not work for COMMON variables in procedures and BLOCK DATA
  2010-12-21 10:49 [Bug fortran/47030] New: !GCC$ Attributes do not work for COMMON variables in procedures and BLOCK DATA burnus at gcc dot gnu.org
@ 2010-12-27 23:34 ` dfranke at gcc dot gnu.org
  2011-01-07 23:21 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu.org @ 2010-12-27 23:34 UTC (permalink / raw)
  To: gcc-bugs

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

Daniel Franke <dfranke at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu.org

--- Comment #1 from Daniel Franke <dfranke at gcc dot gnu.org> 2010-12-27 23:34:45 UTC ---
Is this related to/dupe of PR42568?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/47030] !GCC$ Attributes do not work for COMMON variables in procedures and BLOCK DATA
  2010-12-21 10:49 [Bug fortran/47030] New: !GCC$ Attributes do not work for COMMON variables in procedures and BLOCK DATA burnus at gcc dot gnu.org
  2010-12-27 23:34 ` [Bug fortran/47030] " dfranke at gcc dot gnu.org
@ 2011-01-07 23:21 ` burnus at gcc dot gnu.org
  2012-03-02 22:18 ` eh.toussaint at gmail dot com
  2015-10-21 12:53 ` dominiq at lps dot ens.fr
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-07 23:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-07 22:22:15 UTC ---
Created attachment 22930
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22930
Draft patch

Draft patch attached (untested).
TODO: Warn if the same COMMON block has different ext_attr in different scopes
of the same translation unit.

 * * *

(In reply to comment #1)
> Is this related to/dupe of PR42568?

No - those are different issues.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/47030] !GCC$ Attributes do not work for COMMON variables in procedures and BLOCK DATA
  2010-12-21 10:49 [Bug fortran/47030] New: !GCC$ Attributes do not work for COMMON variables in procedures and BLOCK DATA burnus at gcc dot gnu.org
  2010-12-27 23:34 ` [Bug fortran/47030] " dfranke at gcc dot gnu.org
  2011-01-07 23:21 ` burnus at gcc dot gnu.org
@ 2012-03-02 22:18 ` eh.toussaint at gmail dot com
  2015-10-21 12:53 ` dominiq at lps dot ens.fr
  3 siblings, 0 replies; 5+ messages in thread
From: eh.toussaint at gmail dot com @ 2012-03-02 22:18 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/47030] !GCC$ Attributes do not work for COMMON variables in procedures and BLOCK DATA
  2010-12-21 10:49 [Bug fortran/47030] New: !GCC$ Attributes do not work for COMMON variables in procedures and BLOCK DATA burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-03-02 22:18 ` eh.toussaint at gmail dot com
@ 2015-10-21 12:53 ` dominiq at lps dot ens.fr
  3 siblings, 0 replies; 5+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-21 12:53 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2015-10-21
     Ever confirmed|0                           |1

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Compiling the first test with -Wall gives the warning

 !GCC$ attributes dllexport :: mydata
                                    1
Warning: Unused variable 'mydata' declared at (1) [-Wunused-variable]

for 5.2.0 and 6.0, without ' [-Wunused-variable]' for 4.8 and 4.9.

Compiling the second test gives

f951: warning: 'dllexport' attribute directive ignored [-Wattributes]

for 4.8 and 4.9 and an ICE for 5.2.0 and 6.0 (pr68040).

I don't get any warning for the third test for 4.8 up to trunk (6.0).


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-21 12:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-21 10:49 [Bug fortran/47030] New: !GCC$ Attributes do not work for COMMON variables in procedures and BLOCK DATA burnus at gcc dot gnu.org
2010-12-27 23:34 ` [Bug fortran/47030] " dfranke at gcc dot gnu.org
2011-01-07 23:21 ` burnus at gcc dot gnu.org
2012-03-02 22:18 ` eh.toussaint at gmail dot com
2015-10-21 12:53 ` dominiq at lps dot ens.fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).