public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <burnus@net-b.de>
To: "'fortran@gcc.gnu.org'" <fortran@gcc.gnu.org>,
	  gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [Fortran, patch] PR33001 - Point to -fno-range-check
Date: Mon, 06 Aug 2007 18:16:00 -0000	[thread overview]
Message-ID: <46B7657F.2070204@net-b.de> (raw)

:ADDPATCH fortran:

Currently, we have in primary.c:
  if (gfc_range_check (e) != ARITH_OK)
    {
      gfc_error ("Integer too big for its kind at %C. This check can be "
                 "disabled with the option -fno-range-check");

As the same problem can also occur with BOZ in DATA statements, I would
suggested to apply the following patch.

Test case:

      INTEGER LARGE(2)
      DATA LARGE(1), LARGE(2) / Z'FFFFFFFF', Z'7FEFFFFF' /
                                          1
Error: Arithmetic overflow converting INTEGER(16) to INTEGER(4) at (1)


The error is correct, however, if the overflow is intended, then
-fno-bounds-check has to be used. As it is not obvious that such an
option exists, I think one should point to that flag in the error
message. Hopeful this will reduce the number of such bug reports and
help increase with user satisfaction.

The following patch was build & regression tested on x86_64. Ok for the
trunk?

Tobias

Index: gcc/fortran/arith.c
===================================================================
--- gcc/fortran/arith.c (Revision 127246)
+++ gcc/fortran/arith.c (Arbeitskopie)
@@ -1981,7 +1981,8 @@ arith_error (arith rc, gfc_typespec *fro
                 gfc_typename (from), gfc_typename (to), where);
       break;
     case ARITH_OVERFLOW:
-      gfc_error ("Arithmetic overflow converting %s to %s at %L",
+      gfc_error ("Arithmetic overflow converting %s to %s at %L. This check "
+                "can be disabled with the option -fno-range-check",
                 gfc_typename (from), gfc_typename (to), where);
       break;
     case ARITH_UNDERFLOW:

             reply	other threads:[~2007-08-06 18:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-06 18:16 Tobias Burnus [this message]
2007-08-09 21:15 ` FX Coudert
2007-08-09 21:31   ` Dave Korn

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=46B7657F.2070204@net-b.de \
    --to=burnus@net-b.de \
    --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).