public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/61628] [MinGW)Write of medium sized or larger matrix fails without error message.
Date: Thu, 03 Jul 2014 16:52:00 -0000	[thread overview]
Message-ID: <bug-61628-4-ooICbdsupU@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-61628-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61628

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #20 from Tobias Burnus <burnus at gcc dot gnu.org> ---
That's a very odd problem. The error message tells us that the size of an array
element (here: 4 byte) does not fit into the SIZE part of the array descriptor.
Obviously, the number "4" (bytes) does fit there.

The questions are:
a) Why does it have the wrong value under Win64 - it should take 4 not some
other value.
b) Why does this message doesn't pop up under Win32 (or Linux)?
c) Why does it fail under Win32?

One thing which looks suspicious is the code for gfc_max_array_element_size; it
should calculate sizeof(ptrdiff_t) - bits used for other purposes. For some
reasons it uses "long" which has no relation to ptrdiff_t and is 32 bytes under
Windows (both 32 and 64 bit Windows). That should be fixed by the following
patch (untested).

However, it still does not explain why it fails with an error message under
Win64 - and only under Win64 and not under Win32. Still, I subspect that the
sizeof(long) == 32 is behind the problems we are seening. Presumably, Cygwin
uses sizeof(long) == 64, which would explain why it only fails with Windows.
(It doesn't explain the other issues.)


[Side remark: I am looking for the new array descriptor to get rid of this
mess. That one has a simple "size_t elem_len", an "int rank" and another
element for the data type.]

--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -956,7 +956,7 @@ gfc_init_types (void)
   n = TYPE_PRECISION (gfc_array_index_type) - GFC_DTYPE_SIZE_SHIFT;
   gfc_max_array_element_size
-    = wide_int_to_tree (long_unsigned_type_node,
+    = wide_int_to_tree (size_type_node,
                        wi::mask (n, UNSIGNED,
-                                 TYPE_PRECISION (long_unsigned_type_node)));
+                                 TYPE_PRECISION (size_type_node)));

   boolean_type_node = gfc_get_logical_type (gfc_default_logical_kind);


  parent reply	other threads:[~2014-07-03 16:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-27 10:49 [Bug fortran/61628] New: A program that reads from a file with stream access and uses pack() suddenly stops arjen.markus895 at gmail dot com
2014-06-27 17:40 ` [Bug fortran/61628] " jvdelisle at gcc dot gnu.org
2014-06-27 17:50 ` dominiq at lps dot ens.fr
2014-06-29 14:39 ` jvdelisle at gcc dot gnu.org
2014-06-29 18:08 ` arjen.markus895 at gmail dot com
2014-06-29 21:28 ` jvdelisle at gcc dot gnu.org
2014-07-01  1:58 ` jvdelisle at gcc dot gnu.org
2014-07-01  7:37 ` arjen.markus895 at gmail dot com
2014-07-01 10:53 ` dominiq at lps dot ens.fr
2014-07-01 10:59 ` dominiq at lps dot ens.fr
2014-07-01 11:35 ` arjen.markus895 at gmail dot com
2014-07-02  1:17 ` jvdelisle at gcc dot gnu.org
2014-07-02  1:55 ` jvdelisle at gcc dot gnu.org
2014-07-02  6:48 ` arjen.markus895 at gmail dot com
2014-07-02 15:03 ` jvdelisle at gcc dot gnu.org
2014-07-03  6:18 ` arjen.markus895 at gmail dot com
2014-07-03 13:33 ` [Bug fortran/61628] [MinGW)Write of medium sized or larger matrix fails without error message jvdelisle at gcc dot gnu.org
2014-07-03 16:52 ` burnus at gcc dot gnu.org [this message]
2014-07-12 19:06 ` burnus at gcc dot gnu.org
2015-02-12  0:40 ` jvdelisle at gcc dot gnu.org

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-61628-4-ooICbdsupU@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).