@@ -38,8 +38,8 @@ applications that operate on large chunks of data. This example demonstrates
3838the generic version of the :ref: `modules_algorithm_argsort ` subroutine by
3939sorting a native Fortran array of native Fortran types using a native Fortran
4040subroutine. The only C interaction needed is to create C pointers to the
41- Fortran array entries and to provide a C-bound comparator that converts those
42- pointers back to native Fortran pointers.
41+ Fortran array entries and to provide a C-bound comparator that
42+ converts those pointers back to native Fortran pointers. [ #c_f_pointer ]_
4343
4444.. literalinclude :: ../example/sort_generic.f90
4545 :linenos:
@@ -60,6 +60,27 @@ provides procedures to:
6060.. literalinclude :: ../example/example_utils.f90
6161 :linenos:
6262
63+
64+ .. rubric :: Footnotes
65+
66+ .. [#c_f_pointer ] Older versions of Gfortran (before GCC-8) fail to compile the
67+ generic sort example because of a bug that incorrectly claims that taking
68+ the C pointer of a scalar Fortran value is a violation of the standard:
69+
70+ .. code-block :: none
71+
72+ ../example/sort_generic.f90:84:38:
73+
74+ call c_f_pointer(cptr=rcptr, fptr=rptr)
75+ 1
76+ Error: TS 29113/TS 18508: Noninteroperable array FPTR at (1) to
77+ C_F_POINTER: Expression is a noninteroperable derived type
78+
79+ See `this bug report `_ for more details.
80+
81+ .. _this bug report : https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84924
82+
83+
6384.. ############################################################################
6485.. end of doc/examples.rst
6586.. ############################################################################
0 commit comments