public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Fortran, patch] PR33001 - Point to -fno-range-check
@ 2007-08-06 18:16 Tobias Burnus
  2007-08-09 21:15 ` FX Coudert
  0 siblings, 1 reply; 3+ messages in thread
From: Tobias Burnus @ 2007-08-06 18:16 UTC (permalink / raw)
  To: 'fortran@gcc.gnu.org', gcc-patches

: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:

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Fortran, patch] PR33001 - Point to -fno-range-check
  2007-08-06 18:16 [Fortran, patch] PR33001 - Point to -fno-range-check Tobias Burnus
@ 2007-08-09 21:15 ` FX Coudert
  2007-08-09 21:31   ` Dave Korn
  0 siblings, 1 reply; 3+ messages in thread
From: FX Coudert @ 2007-08-09 21:15 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: 'fortran@gcc.gnu.org', gcc-patches

:REVIEWMAIL:

> 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:

OK, noone seems to have any objection and I find it nice.

FX

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [Fortran, patch] PR33001 - Point to -fno-range-check
  2007-08-09 21:15 ` FX Coudert
@ 2007-08-09 21:31   ` Dave Korn
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Korn @ 2007-08-09 21:31 UTC (permalink / raw)
  To: 'FX Coudert', 'Tobias Burnus'
  Cc: fortran, 'gcc-patches'

On 09 August 2007 22:15, FX Coudert wrote:

>> REVIEWMAIL:
> 
>> 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:
> 
> OK, noone seems to have any objection and I find it nice.
> 
> FX

  Dunno if you guys are interested in a random suggestion but it might be even
nicer if the second sentence was only printed the first time per run.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-09 21:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-06 18:16 [Fortran, patch] PR33001 - Point to -fno-range-check Tobias Burnus
2007-08-09 21:15 ` FX Coudert
2007-08-09 21:31   ` Dave Korn

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).