This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix > 2GB Fortran COMMONs


Jakub Jelinek wrote:

The following testcase segfaults on AMD64 (and I guess any other 64-bit
architecture).  The problem is that offset added to a COMMON is
without this patch cast to (int), so upper bits get discarded and the
offset is sign extended.
I'm not sure if usizetype is the best type to use (especially for
consistency with the rest of F77 frontend).  Is there some better one
(it certainly has to be a type with the same width as pointers)?

ffecom_arrayref_ uses this:


    /* Widen integral arithmetic as desired while preserving
       signedness.  */
      tree_type = TREE_TYPE (element);
      tree_type_x = tree_type;
      if (tree_type
          && GET_MODE_CLASS (TYPE_MODE (tree_type)) == MODE_INT
          && TYPE_PRECISION (tree_type) < TYPE_PRECISION (sizetype))
      tree_type_x = (TREE_UNSIGNED (tree_type) ? usizetype : ssizetype);

IOW, it checks signedness of the index to decide on the signednes of the resulting type to use.

Hope this helps,

--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://gcc.gnu.org/fortran/ (under construction)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]