[Bug fortran/87495] Warning: ‘fastcall’ attribute ignored [-Wattributes] for !GCC$ ATTRIBUTES

2018-10-22 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87495

--- Comment #10 from Martin Liška  ---
(In reply to rguent...@suse.de from comment #8)
> On Mon, 22 Oct 2018, marxin at gcc dot gnu.org wrote:
> 
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87495
> > 
> > Martin Liška  changed:
> > 
> >What|Removed |Added
> > 
> >  Status|WAITING |REOPENED
> > 
> > --- Comment #7 from Martin Liška  ---
> > OK, the fastcall is a special one, but I see it for all of:
> > 
> > const ext_attr_t ext_attr_list[] = {
> >   { "dllimport",EXT_ATTR_DLLIMPORT,"dllimport" },
> >   { "dllexport",EXT_ATTR_DLLEXPORT,"dllexport" },
> >   { "cdecl",EXT_ATTR_CDECL,"cdecl" },
> >   { "stdcall",  EXT_ATTR_STDCALL,  "stdcall"   },
> >   { "fastcall", EXT_ATTR_FASTCALL, "fastcall"  },
> >   { "no_arg_check", EXT_ATTR_NO_ARG_CHECK, NULL},
> >   { NULL,   EXT_ATTR_LAST, NULL}
> > };
> > 
> > gfortran f.f90
> > f.f90:1:0:
> > 
> >  elemental real function sin(arg)
> > 
> > Warning: ‘cdecl’ attribute ignored [-Wattributes]
> 
> But that's in the same ballpark.  All of them seem to be...
> (just check on a C testcase with -Wall).

Ah, sorry, now I see it!

[Bug fortran/87495] Warning: ‘fastcall’ attribute ignored [-Wattributes] for !GCC$ ATTRIBUTES

2018-10-22 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87495

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|REOPENED|NEW

--- Comment #9 from Dominique d'Humieres  ---
This PR has never been closed.

[Bug fortran/87495] Warning: ‘fastcall’ attribute ignored [-Wattributes] for !GCC$ ATTRIBUTES

2018-10-22 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87495

--- Comment #8 from rguenther at suse dot de  ---
On Mon, 22 Oct 2018, marxin at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87495
> 
> Martin Liška  changed:
> 
>What|Removed |Added
> 
>  Status|WAITING |REOPENED
> 
> --- Comment #7 from Martin Liška  ---
> OK, the fastcall is a special one, but I see it for all of:
> 
> const ext_attr_t ext_attr_list[] = {
>   { "dllimport",EXT_ATTR_DLLIMPORT,"dllimport" },
>   { "dllexport",EXT_ATTR_DLLEXPORT,"dllexport" },
>   { "cdecl",EXT_ATTR_CDECL,"cdecl" },
>   { "stdcall",  EXT_ATTR_STDCALL,  "stdcall"   },
>   { "fastcall", EXT_ATTR_FASTCALL, "fastcall"  },
>   { "no_arg_check", EXT_ATTR_NO_ARG_CHECK, NULL},
>   { NULL,   EXT_ATTR_LAST, NULL}
> };
> 
> gfortran f.f90
> f.f90:1:0:
> 
>  elemental real function sin(arg)
> 
> Warning: ‘cdecl’ attribute ignored [-Wattributes]

But that's in the same ballpark.  All of them seem to be...
(just check on a C testcase with -Wall).

[Bug fortran/87495] Warning: ‘fastcall’ attribute ignored [-Wattributes] for !GCC$ ATTRIBUTES

2018-10-22 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87495

Martin Liška  changed:

   What|Removed |Added

 Status|WAITING |REOPENED

--- Comment #7 from Martin Liška  ---
OK, the fastcall is a special one, but I see it for all of:

const ext_attr_t ext_attr_list[] = {
  { "dllimport",EXT_ATTR_DLLIMPORT,"dllimport" },
  { "dllexport",EXT_ATTR_DLLEXPORT,"dllexport" },
  { "cdecl",EXT_ATTR_CDECL,"cdecl" },
  { "stdcall",  EXT_ATTR_STDCALL,  "stdcall"   },
  { "fastcall", EXT_ATTR_FASTCALL, "fastcall"  },
  { "no_arg_check", EXT_ATTR_NO_ARG_CHECK, NULL},
  { NULL,   EXT_ATTR_LAST, NULL}
};

gfortran f.f90
f.f90:1:0:

 elemental real function sin(arg)

Warning: ‘cdecl’ attribute ignored [-Wattributes]

[Bug fortran/87495] Warning: ‘fastcall’ attribute ignored [-Wattributes] for !GCC$ ATTRIBUTES

2018-10-21 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87495

Dominique d'Humieres  changed:

   What|Removed |Added

   Priority|P3  |P5
 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2018-10-21
 Ever confirmed|0   |1
   Severity|normal  |enhancement

--- Comment #6 from Dominique d'Humieres  ---
> Martin: Can we close this as INVALID or WORKSFORME?
>
> Or is there still an issue? - At least it seems to work for -m32 and
> -m64 is not supported by construction of the x86_64 ABI.

May be this should be better documented in section '7.2.1 ATTRIBUTES directive'
of the Fortran manual.

[Bug fortran/87495] Warning: ‘fastcall’ attribute ignored [-Wattributes] for !GCC$ ATTRIBUTES

2018-10-16 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87495

--- Comment #5 from Tobias Burnus  ---
Martin: Can we close this as INVALID or WORKSFORME?

Or is there still an issue? - At least it seems to work for -m32 and -m64 is
not supported by construction of the x86_64 ABI.

(In reply to Martin Liška from comment #0)
> Looks GCC ATTRIBUTES are broken:

(In reply to Tobias Burnus from comment #3)
> At least, if I use "-m32", it compiles without warning – while -m64 shows
> the warning on my 86-64-gnu-linux.

(In reply to rguent...@suse.de from comment #4)
> fastcall is definitely a -m32 attribute only (on x86_64 arguments
> are already passed by registers)

[Bug fortran/87495] Warning: ‘fastcall’ attribute ignored [-Wattributes] for !GCC$ ATTRIBUTES

2018-10-16 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87495

--- Comment #4 from rguenther at suse dot de  ---
On Mon, 15 Oct 2018, burnus at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87495
> 
> Tobias Burnus  changed:
> 
>What|Removed |Added
> 
>  CC||burnus at gcc dot gnu.org
> 
> --- Comment #3 from Tobias Burnus  ---
> I wonder whether that's an ABI problem.
> 
> At least, if I use "-m32", it compiles without warning – while -m64 shows the
> warning on my 86-64-gnu-linux.
> 
> I also see the following in doc/extend.texi:
> 
> @item fastcall
> @cindex @code{fastcall} function attribute, x86-32
> @cindex functions that pop the argument stack on x86-32
> On x86-32 targets, the @code{fastcall} attribute causes the compiler to
> pass the first argument (if of integral type) in the register ECX and
> the second argument (if of integral type) in the register EDX@.  Subsequent
> and other typed arguments are passed on the stack.  The called function
> pops the arguments off the stack.  If the number of arguments is variable all
> arguments are pushed on the stack.
> 
> Side note: on Microsoft's page, I do see a __fastcall for x64 Windows:
> https://msdn.microsoft.com/en-us/library/ms235286.aspx

fastcall is definitely a -m32 attribute only (on x86_64 arguments
are already passed by registers)

[Bug fortran/87495] Warning: ‘fastcall’ attribute ignored [-Wattributes] for !GCC$ ATTRIBUTES

2018-10-15 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87495

Tobias Burnus  changed:

   What|Removed |Added

 CC||burnus at gcc dot gnu.org

--- Comment #3 from Tobias Burnus  ---
I wonder whether that's an ABI problem.

At least, if I use "-m32", it compiles without warning – while -m64 shows the
warning on my 86-64-gnu-linux.

I also see the following in doc/extend.texi:

@item fastcall
@cindex @code{fastcall} function attribute, x86-32
@cindex functions that pop the argument stack on x86-32
On x86-32 targets, the @code{fastcall} attribute causes the compiler to
pass the first argument (if of integral type) in the register ECX and
the second argument (if of integral type) in the register EDX@.  Subsequent
and other typed arguments are passed on the stack.  The called function
pops the arguments off the stack.  If the number of arguments is variable all
arguments are pushed on the stack.

Side note: on Microsoft's page, I do see a __fastcall for x64 Windows:
https://msdn.microsoft.com/en-us/library/ms235286.aspx

[Bug fortran/87495] Warning: ‘fastcall’ attribute ignored [-Wattributes] for !GCC$ ATTRIBUTES

2018-10-04 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87495

--- Comment #2 from Martin Liška  ---
No, fails for so simple example as:

$ cat use2.f90
elemental real function sin(arg)
  !GCC$ attributes FASTCALL :: sin
  real, intent(in) :: arg
  sin = -42.0
end function

program test_overloaded_intrinsic
  real(4) :: x(3200), y(3200)
  y = sin(x)
  print *, y
end

$ gfortran use2.f90 -c
use2.f90:1:0:

 elemental real function sin(arg)

Warning: ‘fastcall’ attribute ignored [-Wattributes]

[Bug fortran/87495] Warning: ‘fastcall’ attribute ignored [-Wattributes] for !GCC$ ATTRIBUTES

2018-10-04 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87495

--- Comment #1 from Richard Biener  ---
I think you get diagnostics for the procedure pointer and pointer assignment
ones which I guess are technically OK?