Support for NOINLINE attribute

Rimvydas Jasinskas rimvydasjas@gmail.com
Fri Feb 10 05:42:47 GMT 2023


Hello everyone,

would it be possible to extend gfortran attribute support to handle
NOINLINE too? Like: "!GCC$ ATTRIBUTES noinline :: ...".

Recent testing with gcc-13 trunk uncovered several issues with LTO
usage and for now it is unknown if it is host specific or something
else.  Given that there is little to no control from the fortran side
to influence how lto1 backend handles symbol manipulations, such
attribute (while not fixing root problems) would allow workaround
compilation issues at source level, since most of LTO usage problems
come from inlining and limits of resources available.

While there, it would be handy to have support for NORETURN and WEAK
attributes too.
In one of the projects just adding 2 NORETURN comment pragmas into
commonly used custom critical abort subroutine interfaces reduced the
number of -Wmaybe-uninitialized diagnostics from 2867 to 2654.   That
is a huge reduction of pure false positives and results in smaller
binaries produced.
Explaining the need for the WEAK attribute is somewhat more
complicated, when it is needed - it is needed (even if that means
compiling to assembly intermediates and sed "/SYM/s/.globl/.weak/"
which is quite fragile).

Attached is a proof of concept patch with some test cases adapted
mainly from already existing C testsuite variants and tested on
x86_64.  These additions are not intrusive and quite useful.
I'm willing to help test/code to get NOINLINE support added,

Best regards,
Rimvydas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fortran-Add-GCC-attributes-NOINLINE-NORETURN-WEAK.patch
Type: text/x-patch
Size: 11135 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20230210/5afba000/attachment.bin>


More information about the Fortran mailing list