public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jvdelisle at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/53796] I/O INQUIRE of RECL:  If not specified in OPEN,  the default value should be returned (sequential access)
Date: Sat, 30 Jun 2012 00:32:00 -0000	[thread overview]
Message-ID: <bug-53796-4-iE9VL4dEvf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53796-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53796

--- Comment #10 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2012-06-30 00:32:29 UTC ---
For completeness, in the case I give in Comment #9, I get

Operating system error: Cannot allocate memory
Memory allocation failed

I have instrumented a few places to see what we are getting with the original
test case included here:

integer(kind=8) :: s, r
open(unit=1, file='testsize.f90', status='old')
inquire(unit=1, size=s, recl=r)
print *, 'size=', s, ' recl=', r
end

And I get:

$ ./a.out 
In init_units()
max_offset set to 4294967295
In newunit(): 4294967295
Ping! recl=4294967295
 size=                  135  recl=                   -1

This confirms that we are setting the unit recl to a large number which is
printed as -1 when using signed output, but unsigned is what we might expect.

max_offset is calculated at run time as follows:

  /* Calculate the maximum file offset in a portable manner.
     max will be the largest signed number for the type gfc_offset.
     set a 1 in the LSB and keep a running sum, stopping at MSB-1 bit.  */
  max_offset = 0;
  for (i = 0; i < sizeof (max_offset) * 8 - 1; i++)
    max_offset = max_offset + ((gfc_offset) 1 << i);
  printf("max_offset set to %u\n", max_offset);

I think we can decide what to do differently after we get Comment #7 feedback.

In the meantime, I will be looking at what we are doing wrong in the case of
Comment #9, maybe a separate bug.


  parent reply	other threads:[~2012-06-30  0:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-28 10:26 [Bug fortran/53796] New: " burnus at gcc dot gnu.org
2012-06-28 15:42 ` [Bug fortran/53796] " burnus at gcc dot gnu.org
2012-06-28 18:22 ` clivegpage at gmail dot com
2012-06-29  9:56 ` jvdelisle at gcc dot gnu.org
2012-06-29 10:00 ` clivegpage at gmail dot com
2012-06-29 10:07 ` burnus at gcc dot gnu.org
2012-06-29 10:13 ` jvdelisle at gcc dot gnu.org
2012-06-29 13:29 ` burnus at gcc dot gnu.org
2012-06-29 15:05 ` burnus at gcc dot gnu.org
2012-06-29 23:43 ` jvdelisle at gcc dot gnu.org
2012-06-30  0:32 ` jvdelisle at gcc dot gnu.org [this message]
2012-06-30  1:35 ` jvdelisle at gcc dot gnu.org
2012-06-30  8:40 ` clivegpage at gmail dot com
2012-06-30 20:10 ` jb at gcc dot gnu.org
2015-10-20 17:14 ` dominiq at lps dot ens.fr
2015-10-20 17:58 ` jb at gcc dot gnu.org
2015-10-20 18:57 ` dominiq at lps dot ens.fr

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=bug-53796-4-iE9VL4dEvf@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).