[EXTERNAL] Re: Regression on character function
Rouson, Damian
rouson@sandia.gov
Tue Feb 7 20:54:00 GMT 2012
Submitted as bug 52158 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52158>.
Damian
On 2/6/12 8:45 AM, "Paul Richard Thomas" <paul.richard.thomas@gmail.com>
wrote:
>Dear Damian,
>
>On Mon, Feb 6, 2012 at 4:47 PM, Rouson, Damian <rouson@sandia.gov> wrote:
>> Gfortran developers,
>>
>> A build from a snapshot of the development branch as of two days ago
>> (installed by macports) appears to have a regression on deferred-length
>> character functions. The text below shows a test that compiles with gcc
>> 4.6.2 but not with 4.7. Should I file a PR?
>
>Yes, please do. I cannot confirm that it compiled with 4.6.2 but it
>definitely does not with 4.6.3.
>
>Interestingly, this compiles:
>module foo_class
> implicit none
> type foo
> end type
>contains
> function bar(this)
> class(foo) :: this
> character(:), allocatable :: bar
> end function
>end module
>
>So it is somehow connected with it being a typebound procedure.
>Indeed, this fixes the problem (not regtested):
>Index: gcc/fortran/resolve.c
>===================================================================
>*** gcc/fortran/resolve.c (revision 183914)
>--- gcc/fortran/resolve.c (working copy)
>*************** resolve_fl_derived0 (gfc_symbol *sym)
>*** 11601,11607 ****
> for ( ; c != NULL; c = c->next)
> {
> /* See PRs 51550, 47545, 48654, 49050, 51075 - and 45170. */
>! if (c->ts.type == BT_CHARACTER && c->ts.deferred)
> {
> gfc_error ("Deferred-length character component '%s' at %L is not "
> "yet supported", c->name, &c->loc);
>--- 11601,11607 ----
> for ( ; c != NULL; c = c->next)
> {
> /* See PRs 51550, 47545, 48654, 49050, 51075 - and 45170. */
>! if (c->ts.type == BT_CHARACTER && c->ts.deferred &&
>!c->attr.function)
> {
> gfc_error ("Deferred-length character component '%s' at %L is not "
> "yet supported", c->name, &c->loc);
>
>
>Thanks for the report.
>
>Paul
>
>>
>> Damian
>>
>> $ cat character_function.F90
>> module foo_class
>> implicit none
>> type foo
>> contains
>> procedure :: bar
>> end type
>> contains
>> function bar(this)
>> class(foo) :: this
>> character(:), allocatable :: bar
>> end function
>> end module
>> $ /opt/local/bin/gfortran-mp-4.6 -c character_function.F90
>> $ /opt/local/bin/gfortran-mp-4.7 -c character_function.F90
>> character_function.F90:9.22:
>>
>> class(foo) :: this
>> 1
>> Error: Deferred-length character component 'bar' at (1) is not yet
>> supported
>> $ /opt/local/bin/gfortran-mp-4.7 --version
>> GNU Fortran (GCC) 4.7.0 20120204 (experimental)
>> Copyright (C) 2012 Free Software Foundation, Inc.
>>
>> GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
>> You may redistribute copies of GNU Fortran
>> under the terms of the GNU General Public License.
>> For more information about these matters, see the file named COPYING
>>
>>
>>
>>
>
>
>
>--
>The knack of flying is learning how to throw yourself at the ground and
>miss.
> --Hitchhikers Guide to the Galaxy
>
More information about the Fortran
mailing list