[Bug fortran/64962] New: Use "nonnull"/"returns_nonnull" attribute annotation for procedures (user code + libgfortran)
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 6 14:24:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64962
Bug ID: 64962
Summary: Use "nonnull"/"returns_nonnull" attribute annotation
for procedures (user code + libgfortran)
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
The middle end supports optimizations (e.g. PR58480) based on the "nonnull" and
"returns_nonnull" (cf.
https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html);
Fortran very often passes pointers around - and in most of the cases the actual
argument is the address of variable and cannot be NULL.
Thus, we should be able to set "nonnull" for almost all arguments. Exception
are mainly OPTIONAL - and TYPE(C_PTR) and POINTER. For the latter, there might
be cases where it cannot be NULL() but has to be a variable (which may point to
NULL or where class->_data or array->data is NULL).
For instance, for return by argument, we always pass the address of a variable.
For libgfortran functions like (internal)PACK etc., we might also be able to
set those attributes, assuming that a NULL pointer is not permitted as input or
that the function doesn't return a NULL.
For libgfortran, the annotations could be done both in the library itself
(libgfortran/*.h) and in the declaration used in the compiler itself
(trans-decl.c).
More information about the Gcc-bugs
mailing list