public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/61002] Can't divide by 0
Date: Fri, 02 May 2014 14:24:00 -0000	[thread overview]
Message-ID: <bug-61002-4-WNs4UIXUBM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-61002-4@http.gcc.gnu.org/bugzilla/>

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sgk at troutmask dot apl.washingto
                   |                            |n.edu

--- Comment #7 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> I think we should do what we did elsewhere, namely:
>
> "This check can be disabled with the option -fno-range-check"

Along the following patch

--- ../_clean/gcc/fortran/arith.c    2014-04-27 12:52:10.000000000 +0200
+++ gcc/fortran/arith.c    2014-05-02 15:55:19.000000000 +0200
@@ -104,7 +104,8 @@ gfc_arith_error (arith code)
       p = _("Arithmetic NaN at %L");
       break;
     case ARITH_DIV0:
-      p = _("Division by zero at %L");
+      p = _("Division by zero at %L. This check "
+        "can be disabled with the option -fno-range-check");
       break;
     case ARITH_INCOMMENSURATE:
       p = _("Array operands are incommensurate at %L");
@@ -1929,7 +1930,8 @@ arith_error (arith rc, gfc_typespec *fro
          gfc_typename (from), gfc_typename (to), where);
       break;
     case ARITH_DIV0:
-      gfc_error ("Division by zero converting %s to %s at %L",
+      gfc_error ("Division by zero 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_INCOMMENSURATE:

? This only works for floating point values:

/opt/gcc/work/gcc/testsuite/gfortran.dg/arith_divide.f:10.14:

        j = 10/0! { dg-error "Division by zero at" }                    
              1
Error: Division by zero at (1). This check can be disabled with the option
-fno-range-check

What is the best way to avoid the misleading "This check can be disabled with
the option -fno-range-check" for integers? Use "This check can be disabled for
floating point values with the option -fno-range-check"? or pass an extra
argument to gfc_arith_error?

While I am at it, should I do the same thing for "Arithmetic overflow" and
friends? Should not "This check can be disabled with the option
-fno-range-check" ends with a dot?


  parent reply	other threads:[~2014-05-02 14:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-29 13:52 [Bug fortran/61002] New: " fkrogh#gcc at mathalacarte dot com
2014-04-29 14:06 ` [Bug fortran/61002] " dominiq at lps dot ens.fr
2014-04-29 14:53 ` fkrogh#gcc at mathalacarte dot com
2014-05-01 22:17 ` dominiq at lps dot ens.fr
2014-05-01 22:22 ` fkrogh#gcc at mathalacarte dot com
2014-05-01 22:27 ` dominiq at lps dot ens.fr
2014-05-02 12:08 ` burnus at gcc dot gnu.org
2014-05-02 14:24 ` dominiq at lps dot ens.fr [this message]
2014-05-03  7:21 ` schwab@linux-m68k.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-61002-4-WNs4UIXUBM@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).