public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Koenig <tkoenig@netcologne.de>
To: Janne Blomqvist <blomqvist.janne@gmail.com>
Cc: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch, libfortran] Use flexible array members for array descriptor
Date: Tue, 06 Feb 2018 22:28:00 -0000	[thread overview]
Message-ID: <ccd17194-1cae-e25c-2107-34a4f87699b5@netcologne.de> (raw)
In-Reply-To: <CAO9iq9Hu3Cs=G8Z4xBgMnxcSSof+cohSLs6rpRgzZo40Q7pTRA@mail.gmail.com>

Am 06.02.2018 um 09:53 schrieb Janne Blomqvist:
>>>      /* Make the INTEGER*4 array for passing to date_and_time.  */
>>> -  gfc_array_i4 *avalues = xmalloc (sizeof (gfc_array_i4));
>>> +  gfc_array_i4 *avalues = xmalloc (sizeof (gfc_full_array_i4));
>>>
>>>
>>> Since date_and_time requires the values array to always be rank 1,
>>> can't this be "xmalloc (sizeof (gfc_array_i4) +
>>> sizeof(dimension_data))" ?
>>
>> I think we can be fairly sure that this would be OK at the moment, since
>> (I think) there are no gaps in our descriptors at the moment. Anybody
>> invents an architecture where this is not the case, we introduce
>> a bug. This way is safer.
> According to the C standard (C11 6.7.2.1.18 and example 6.7.2.1.20),
> this is guaranteed to work.

OK, I didn't know that, and I see how that would save memory.
I'll make that change (with a comment) if this patch ends up being
committed.

Regards

	Thomas

  reply	other threads:[~2018-02-06 22:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-04 19:49 Thomas Koenig
2018-02-05 12:09 ` Janne Blomqvist
2018-02-05 20:53   ` Thomas Koenig
2018-02-06  8:53     ` Janne Blomqvist
2018-02-06 22:28       ` Thomas Koenig [this message]
2018-02-08 11:27   ` Richard Biener
2018-02-12 19:42     ` Thomas Koenig
2018-02-12 19:47       ` Janne Blomqvist
2018-02-12 20:49       ` Jakub Jelinek
2018-02-12 21:50         ` Thomas Koenig

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=ccd17194-1cae-e25c-2107-34a4f87699b5@netcologne.de \
    --to=tkoenig@netcologne.de \
    --cc=blomqvist.janne@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /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).