public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Kempke, Nils-Christian" <nils-christian.kempke@intel.com>
To: Simon Marchi <simark@simark.ca>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: "tom@tromey.com" <tom@tromey.com>
Subject: RE: [PATCH 4/4] gdb/fortran: Fix sizeof intrinsic for Fortran
Date: Mon, 26 Sep 2022 17:24:38 +0000	[thread overview]
Message-ID: <CY4PR1101MB20717245E55C7A9FEA0DECA1B8529@CY4PR1101MB2071.namprd11.prod.outlook.com> (raw)
In-Reply-To: <509056c3-8388-6db8-d82d-1f7dac55ed6c@simark.ca>

> -----Original Message-----
> From: Simon Marchi <simark@simark.ca>
> Sent: Monday, September 26, 2022 7:07 PM
> To: Kempke, Nils-Christian <nils-christian.kempke@intel.com>; gdb-
> patches@sourceware.org
> Cc: tom@tromey.com
> Subject: Re: [PATCH 4/4] gdb/fortran: Fix sizeof intrinsic for Fortran
> 
> 
> 
> On 2022-09-20 03:26, Nils-Christian Kempke via Gdb-patches wrote:
> > The sizeof operator in Fortran behaves differently from e.g. C/Cpp in
> > that it can be applied to pointers.  We thus dereference pointers before
> > evaluating their size.  A test has been added for the Fortran sizeof
> > operator.
> > ---
> >  gdb/eval.c                           |   3 +
> >  gdb/testsuite/gdb.fortran/sizeof.exp | 110
> +++++++++++++++++++++++++++
> >  gdb/testsuite/gdb.fortran/sizeof.f90 | 108
> ++++++++++++++++++++++++++
> >  3 files changed, 221 insertions(+)
> >  create mode 100644 gdb/testsuite/gdb.fortran/sizeof.exp
> >  create mode 100644 gdb/testsuite/gdb.fortran/sizeof.f90
> >
> > diff --git a/gdb/eval.c b/gdb/eval.c
> > index ce1d883aa86..bb6b757d452 100644
> > --- a/gdb/eval.c
> > +++ b/gdb/eval.c
> > @@ -2730,6 +2730,9 @@ evaluate_subexp_for_sizeof_base (struct
> expression *exp, struct type *type)
> >    if (exp->language_defn->la_language == language_cplus
> >        && (TYPE_IS_REFERENCE (type)))
> >      type = check_typedef (TYPE_TARGET_TYPE (type));
> > +  else if (exp->language_defn->la_language == language_fortran
> > +	   && type->code () == TYPE_CODE_PTR)
> > +    type = check_typedef (TYPE_TARGET_TYPE (type));
> 
> Do you need yo handle TYPE_CODE_REF for fortran too?

I believe no - there is not concept for references in Fortran and such
a type having a TYPE_CODE_REF in Fortran would seem quite unexpected.

Nils
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

      parent reply	other threads:[~2022-09-26 17:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20  7:26 [PATCH 0/4] Dynamic properties of pointers Nils-Christian Kempke
2022-09-20  7:26 ` [PATCH 1/4] gdb, testsuite: handle icc and icpc deprecated remarks Nils-Christian Kempke
2022-09-26 14:32   ` Simon Marchi
2022-09-20  7:26 ` [PATCH 2/4] gdb/types: Resolve pointer types dynamically Nils-Christian Kempke
2022-09-26 15:33   ` Simon Marchi
2022-09-29 12:39     ` Kempke, Nils-Christian
2022-09-20  7:26 ` [PATCH 3/4] gdb, typeprint: fix pointer/reference typeprint for icc/ifort Nils-Christian Kempke
2022-09-26 16:02   ` Simon Marchi
2022-09-26 17:18     ` Kempke, Nils-Christian
2022-09-27  9:14       ` Zaric, Zoran (Zare)
2022-09-27 12:48         ` Simon Marchi
2022-09-20  7:26 ` [PATCH 4/4] gdb/fortran: Fix sizeof intrinsic for Fortran Nils-Christian Kempke
2022-09-26 17:06   ` Simon Marchi
2022-09-26 17:22     ` Kempke, Nils-Christian
2022-09-26 17:24     ` Kempke, Nils-Christian [this message]

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=CY4PR1101MB20717245E55C7A9FEA0DECA1B8529@CY4PR1101MB2071.namprd11.prod.outlook.com \
    --to=nils-christian.kempke@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    --cc=tom@tromey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).