This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [V4 00/21] Fortran dynamic array support


On Tue, 23 Aug 2016 15:34:09 +0200, Bernhard Heckel wrote:
> created a branch with all stride patches.

users/bheckel/fortran-strides
2c392d41a3f2e38deeb9db5b7a93ca45682bbe3b

> I don't see regression on RH7.1, gcc 4.8.3-9

I see a regression for 32-bit targets (x86_64-m32 or native i686)
on Fedora 24 (gcc-gfortran-6.1.1-3.fc24.x86_64).  I do not see the regression
on CentOS-7.2 (x86_64-m32).

print pvla^M
value requires 4294967288 bytes, which is more than max-value-size^M
(gdb) FAIL: gdb.fortran/vla-stride.exp: print single-element

I have attached a fix.

It is because:
    <115>   DW_AT_lower_bound : 4 byte block: 97 23 10 6        (DW_OP_push_object_address; DW_OP_plus_uconst: 16; DW_OP_deref)
    <11a>   DW_AT_upper_bound : 4 byte block: 97 23 14 6        (DW_OP_push_object_address; DW_OP_plus_uconst: 20; DW_OP_deref)
    <11f>   DW_AT_byte_stride : 6 byte block: 97 23 c 6 34 1e   (DW_OP_push_object_address; DW_OP_plus_uconst: 12; DW_OP_deref; DW_OP_lit4; DW_OP_mul)
	DW_AT_lower_bound == 1
	DW_AT_upper_bound == 1
	DW_AT_byte_stride == (-2) * 4 == -8

I am not sure if gfortran is really wrong or not but a stride does not make
sense for me for a single row array.

Attaching also gdb.fortran/vla-stride.f90 from your branch built with
gcc-gfortran-6.1.1-3.fc24.x86_64 on Fedora 24 x86_64 in -m32 mode.

Besides that I see on all archs
	-FAIL: gdb.pascal/arrays.exp: Print dynamic array of string
	+FAIL: gdb.pascal/arrays.exp: Print dynamic array of string (GDB internal error)
but that testcase is only in Fedora and the Pascal (fpc) support has been not
well maintained so far so I am OK with that.


Thanks,
Jan
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 88801ac..1fbf69a 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1103,10 +1103,12 @@ create_array_type_with_stride (struct type *result_type,
       if (high_bound < low_bound)
 	TYPE_LENGTH (result_type) = 0;
       else if (byte_stride > 0)
-	TYPE_LENGTH (result_type) = byte_stride * (high_bound - low_bound + 1);
+	TYPE_LENGTH (result_type) = (byte_stride * (high_bound - low_bound)
+				     + TYPE_LENGTH (element_type));
       else if (bit_stride > 0)
 	TYPE_LENGTH (result_type) =
-	  (bit_stride * (high_bound - low_bound + 1) + 7) / 8;
+	  ((bit_stride * (high_bound - low_bound) + 7) / 8
+	   + TYPE_LENGTH (element_type));
       else
 	TYPE_LENGTH (result_type) =
 	  TYPE_LENGTH (element_type) * (high_bound - low_bound + 1);

Attachment: vla-stride.s
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]