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

            Bug ID: 87495
           Summary: Warning: ‘fastcall’ attribute ignored [-Wattributes]
                    for !GCC$ ATTRIBUTES
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
  Target Milestone: ---

Looks GCC ATTRIBUTES are broken:

$ cat fortran-options.f90
program test
  interface
    subroutine sub1()
    end subroutine sub1
    subroutine sub2()
      !GCC$ ATTRIBUTES CDECL :: sub2
    end subroutine sub2
    subroutine sub3()
      !GCC$ ATTRIBUTES STDCALL :: sub3
    end subroutine sub3
    subroutine sub4()
!GCC$ ATTRIBUTES FASTCALL :: sub4
    end subroutine sub4
  end interface

  !gcc$ attributes cdecl :: cdecl
  !gcc$ attributes stdcall :: stdcall
  procedure(), pointer :: ptr
  procedure(), pointer :: cdecl
  procedure(), pointer :: stdcall
  procedure(), pointer :: fastcall
  !gcc$ attributes fastcall :: fastcall

  ! Valid:
  ptr => sub1
  cdecl => sub2
  stdcall => sub3
  fastcall => sub4
end program

$ gfortran fortran-options.f90 -c
fortran-options.f90:26:0:

   cdecl => sub2

Warning: ‘cdecl’ attribute ignored [-Wattributes]
fortran-options.f90:26:0: Warning: ‘cdecl’ attribute ignored [-Wattributes]
fortran-options.f90:27:0:

   stdcall => sub3

Warning: ‘stdcall’ attribute ignored [-Wattributes]
fortran-options.f90:27:0: Warning: ‘stdcall’ attribute ignored [-Wattributes]
fortran-options.f90:28:0:

   fastcall => sub4

Warning: ‘fastcall’ attribute ignored [-Wattributes]
fortran-options.f90:28:0: Warning: ‘fastcall’ attribute ignored [-Wattributes]

It's for GCC 7.1.0+. Very old versions (4.8.0+) also suffer.
In between 5.1.0 and 6.4.0 I see ICE that was fixed in r246203.

Reply via email to