Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Bernhard Heckel <bernhard.heckel@intel.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: "Weinmann, Christoph T" <christoph.t.weinmann@intel.com>,
	gdb-patches@sourceware.org
Subject: Re: [V4 00/21] Fortran dynamic array support
Date: Fri, 02 Sep 2016 13:44:00 -0000	[thread overview]
Message-ID: <57C9822F.1020800@intel.com> (raw)
In-Reply-To: <20160825170626.GA29717@host1.jankratochvil.net>

On 25/08/2016 19:06, Jan Kratochvil wrote:
> 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
Hi Jan,

found the root cause of the issue on 32bit inferior.
According to DWARF4 (Page 100) strides can be negative but evaluation of 
dynamic properties in GDB is done via CORE_ADDR which is unsigned.
This causes the issue that the type length seems to be way to big.

The following code is not claimed to be a fix, just want to point you to 
the right direction.
In gdbtypes.c:
   prop = &TYPE_RANGE_DATA (dyn_range_type)->stride;
   if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
     {
       /* if target is 32bit, execute next if clause  */
       if (value > (2^31))
     value += 2^32;

       stride.kind = PROP_CONST;
       stride.data.const_val = value;
     }
Also, in dwarf2read.c all DW_AT_...STRIDE 's are handles as unsigned. 
This has to be fixed as well.

I will investigate more on the stride topic next week.


Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


  parent reply	other threads:[~2016-09-02 13:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <88072818E0A3D742B2B1AF16BBEC65A7263D8247@IRSMSX107.ger.corp.intel.com>
     [not found] ` <20160707095439.GA6792@host1.jankratochvil.net>
     [not found]   ` <88072818E0A3D742B2B1AF16BBEC65A7263D990E@IRSMSX107.ger.corp.intel.com>
     [not found]     ` <20160714182743.GA10672@host1.jankratochvil.net>
     [not found]       ` <88072818E0A3D742B2B1AF16BBEC65A7263E6F2E@IRSMSX107.ger.corp.intel.com>
     [not found]         ` <20160715091352.GA8059@host1.jankratochvil.net>
     [not found]           ` <88072818E0A3D742B2B1AF16BBEC65A7263E8FD9@IRSMSX107.ger.corp.intel.com>
     [not found]             ` <20160716151310.GA14331@host1.jankratochvil.net>
     [not found]               ` <20160716151837.GA797@host1.jankratochvil.net>
     [not found]                 ` <88072818E0A3D742B2B1AF16BBEC65A7263F0988@IRSMSX107.ger.corp.intel.com>
2016-08-16 13:59                   ` Jan Kratochvil
2016-08-19  9:58                     ` Bernhard Heckel
2016-08-21 17:04                       ` Jan Kratochvil
2016-08-23 13:34                         ` Bernhard Heckel
2016-08-25 17:06                           ` Jan Kratochvil
2016-08-25 17:22                             ` Jan Kratochvil
2016-08-26  7:17                               ` Jan Kratochvil
2016-09-01 10:11                                 ` Bernhard Heckel
2016-09-02 13:44                             ` Bernhard Heckel [this message]
2016-09-04 17:15                               ` Jan Kratochvil
2016-09-07 10:29                                 ` Bernhard Heckel
2016-09-07 20:05                                   ` Jan Kratochvil
2016-09-12 21:05                                   ` Jan Kratochvil
2016-09-14  7:24                                     ` Bernhard Heckel
2016-09-14 12:53                                       ` Jan Kratochvil
2016-09-07 20:24                                 ` Jan Kratochvil
2016-09-01  9:48                           ` Jan Kratochvil
2015-01-14 13:49 Keven Boell
2015-05-28 20:36 ` Jan Kratochvil
2015-05-28 20:52   ` Joel Brobecker
2015-06-14  8:15 ` Jan Kratochvil
2015-06-17 11:42   ` Boell, Keven
2015-07-01 12:43     ` Keven Boell
2016-07-07  8:30 ` Jan Kratochvil
2016-07-07  9:16   ` Bernhard Heckel
2016-07-07  9:23     ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57C9822F.1020800@intel.com \
    --to=bernhard.heckel@intel.com \
    --cc=christoph.t.weinmann@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox