Ping: [Patch, fortran] Bug 68241 - [meta-bug] Deferred-length character - PRs50221, 68216, 63932, 66408, 67674 and 49954
Paul Richard Thomas
paul.richard.thomas@gmail.com
Sun Nov 15 08:21:00 GMT 2015
- Previous message (by thread): Ping: [Patch, fortran] Bug 68241 - [meta-bug] Deferred-length character - PRs50221, 68216, 63932, 66408, 67674 and 49954
- Next message (by thread): Ping: [Patch, fortran] Bug 68241 - [meta-bug] Deferred-length character - PRs50221, 68216, 63932, 66408, 67674 and 49954
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Dear Dominique et al.,
This problem I can reproduce :-) I can even see what the problem is,
although I can do nothing about it for an hour or so because I have
updated trunk, ready for the commit, and am rebuilding/regtesting.
print '(">",a,"<")', strings(1:5) produces:
{
struct __st_parameter_dt dt_parm.0;
dt_parm.0.common.filename = &"deferred_character_4.f90"[1]{lb: 1 sz: 1};
dt_parm.0.common.line = 34;
dt_parm.0.format = &"(\">\",a4,\"<\")"[1]{lb: 1 sz: 1};
dt_parm.0.format_len = 12;
dt_parm.0.common.flags = 4096;
dt_parm.0.common.unit = 6;
_gfortran_st_write (&dt_parm.0);
{
struct array1_unknown parm.1;
parm.1.dtype = ((integer(kind=8)) SAVE_EXPR <(sizetype)
NON_LVALUE_EXPR <.strings>> << 6) + 49;
parm.1.dim[0].lbound = 1;
parm.1.dim[0].ubound = 5;
parm.1.dim[0].stride = 1;
parm.1.data = (void *) &(*(character(kind=1)[0:][1:.strings] *
restrict) strings.data)[1 - strings.dim[0].lbound];
parm.1.offset = 0;
_gfortran_transfer_array_write (&dt_parm.0, &parm.1, 1, .strings);
}
_gfortran_st_write_done (&dt_parm.0);
}
This is fine, except for the data pointer offset for 'parm.1', where a
normal array reference is used. This happens in
trans-array.c(gfc_get_dataptr_offset). Line 6403, tmp =
build_array_ref (desc, offset, NULL, NULL); which does not use the
opportunity to pass the backend_decl for 'strings', thereby triggering
the use of pointer arithmetic for the offset.
This has not changed between the versions of the patch, so it is
something of a miracle that it ever worked.
I will check this diagnosis before committing and will put it right,
accordingly. I will also update the testcase to include an array
section.
Cheers
Paul
On 14 November 2015 at 19:55, Dominique d'Humières <dominiq@lps.ens.fr> wrote:
> Dear Paul,
>
> Update with your latest patch. Using the following patch
>
> --- /opt/gcc/work/gcc/testsuite/gfortran.dg/deferred_character_4.f90 2015-11-14 19:28:59.000000000 +0100
> +++ deferred_character_4_db.f90 2015-11-14 19:43:55.000000000 +0100
> @@ -21,6 +21,16 @@ program chk_alloc_string
>
> strings = [character(len=4) :: "A", "C", "ABCDE", "V", "zzzz"]
>
> + print *, len(strings), size(strings, 1)
> + do i = 1, size(strings, 1)
> + print *, "'",strings(i),"'"
> + end do
> + print *, "other print"
> + print *, (strings(i), i= 1, size(strings, 1))
> + print *, "'", strings(1),"' '", strings(2), "' '", strings(3), "' '", strings(4), "' '", strings(5), "'"
> + print *, "'", strings, "'"
> + print '(">",a,"<")', strings
> + print '(">",a,"<")', strings(1:5)
> if (len(strings) .ne. 4) call abort
> if (size(strings, 1) .ne. 5) call abort
> if (any (strings .ne. [character(len=4) :: "A", "C", "ABCD", "V", "zzzz"])) call abort
>
> the output is now correct except the one for print '(">",a,"<")', strings(1:5) which is now
>
>>A <
>>A <
>>A <
>>A <
>>A <
>
> It was correct with the previous patch.
>
> Everything else looks good.
>
> IMO the latest issue may be delayed after a commit!-)
>
> Dominique
>
>> Le 14 nov. 2015 à 19:25, Paul Richard Thomas <paul.richard.thomas@gmail.com> a écrit :
>>
>> Hi Steve,
>>
>> Following an email from Dominique to me, I think not. In the course of
>> fixing PR49954, I put right the setting of the descriptor dtype. Since
>> this gets passed to the IO runtime, I think that this is the reason
>> for the difference in behaviour.
>>
>> I think that another week of effort should put right gfortran's woes
>> with deferred characters. As well as concatenation problems that I
>> think I have fixed, parentheses cause instant death :-(
>>
>> Cheers
>>
>> Paul
--
Outside of a dog, a book is a man's best friend. Inside of a dog it's
too dark to read.
Groucho Marx
- Previous message (by thread): Ping: [Patch, fortran] Bug 68241 - [meta-bug] Deferred-length character - PRs50221, 68216, 63932, 66408, 67674 and 49954
- Next message (by thread): Ping: [Patch, fortran] Bug 68241 - [meta-bug] Deferred-length character - PRs50221, 68216, 63932, 66408, 67674 and 49954
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Fortran
mailing list