@@ -38,8 +38,8 @@ applications that operate on large chunks of data. This example demonstrates
38
38
the generic version of the :ref: `modules_algorithm_argsort ` subroutine by
39
39
sorting a native Fortran array of native Fortran types using a native Fortran
40
40
subroutine. 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 ]_
43
43
44
44
.. literalinclude :: ../example/sort_generic.f90
45
45
:linenos:
@@ -60,6 +60,27 @@ provides procedures to:
60
60
.. literalinclude :: ../example/example_utils.f90
61
61
:linenos:
62
62
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
+
63
84
.. ############################################################################
64
85
.. end of doc/examples.rst
65
86
.. ############################################################################
0 commit comments