This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR34429 PR34431 and PR34471 - function type characteristics
- From: Tobias Burnus <burnus at net-b dot de>
- To: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 15 Jan 2008 20:04:03 +0100
- Subject: Re: [Patch, fortran] PR34429 PR34431 and PR34471 - function type characteristics
- References: <339c37f20801141507w5b6b7f9blbe8493dcdc85c0c1@mail.gmail.com>
Hi Paul,
It looks quite good and I failed to find a regression. (Build on
x86-64-linux and tested with testsuite/gfortran* (-m32 and -m64),
libgomp (-m32 and -m64), octopus, CP2K, Fleur, Exciting, Unicomp Fortran
Testuite (Lite)). One should probably also try Tonto - but I did not do it.
Thus, I think it is OK for check in. The failing tests below (which are
no regressions) can be fixed later together with your additional
diagnostics. Of cause, if you prefer, you can also sent an updated
patch. (Note, however, that the release-freeze is approaching; current
regression count: 103.)
Tobias,
who will try to spot more problems.
PS: Dominique, I would not mind if could try it on Darwin and with your
butterfly^h^h^h^h Fortran-code collection to see whether it breaks.
All: I also would not mind if you could have also a look.
> 2008-01-14 Paul Thomas <pault@gcc.gnu.org>
>
> (gfortran.h): Add ST_GET_FCN_CHARACTERISTICS.
Change this to "gfortran.h (gfc_statement):"
The following program should print "2" but it prints "5":
module m
integer, parameter :: l = 2
end module m
program test
implicit none
integer, parameter :: l = 5
character(len=10) :: c
c = f()
contains
character(len=l) function f()
use m
print *, len(f)
! if (len(f) /= 2) call abort
f = "a"
end function f
end program test
! { dg-final { cleanup-modules "m" } }
I think you have to do for character length not the following:
m = char_len_param_value (expr);
+ if (m != MATCH_YES && gfc_matching_function)
+ {
+ gfc_undo_symbols ();
+ m = MATCH_YES;
+ }
+
but you have to postpone it as done for the KIND attribute [and for
TYPE(.)].
Related: Should print 2 but claims that "l" is ambiguous.
module m
character(2) :: l
end module m
implicit none
! character(4) :: l
print *, f()
contains
character(len=len(l)) function f()
use m
f = "4"
if (len(f)==2) f= "2"
end function f
end
By the way, introducing "ST_GET_FCN_CHARACTERISTICS" is a nice idea!