http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52843
Bug #: 52843
Summary: Unexpected rejection of pure recursive function
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 27074
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27074
Sample code for bug
When a functions returns a string declared as character(len=:), allocatable the
compiler complains about the function not allowed to be pure or recursive.
The attached file produces the following diagnostics (note that messages appear
twice):
fmmf@porfmmf:~/gfortran_bugs/pure_returns_character_allocatable$
/opt/gcc-4.7/bin/gfortran -c m_module.f90
m_module.f90:31:
pure function f_p( x ) result(res)
1
Error: CHARACTER(*) function 'f_p' at (1) cannot be pure
m_module.f90:20:
recursive function f_r( x ) result(res)
1
Error: CHARACTER(*) function 'f_r' at (1) cannot be recursive
m_module.f90:8:
recursive pure function f_r_p( x ) result(res)
1
Error: CHARACTER(*) function 'f_r_p' at (1) cannot be pure
m_module.f90:8:
recursive pure function f_r_p( x ) result(res)
1
Error: CHARACTER(*) function 'f_r_p' at (1) cannot be recursive
m_module.f90:31:
pure function f_p( x ) result(res)
1
Error: CHARACTER(*) function 'f_p' at (1) cannot be pure
m_module.f90:20:
recursive function f_r( x ) result(res)
1
Error: CHARACTER(*) function 'f_r' at (1) cannot be recursive
m_module.f90:8:
recursive pure function f_r_p( x ) result(res)
1
Error: CHARACTER(*) function 'f_r_p' at (1) cannot be pure
m_module.f90:8:
recursive pure function f_r_p( x ) result(res)
1
Error: CHARACTER(*) function 'f_r_p' at (1) cannot be recursive