public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/29147]  New: Overflow check in DATA statements
@ 2006-09-20  9:52 anlauf at gmx dot de
  2006-09-20  9:53 ` [Bug fortran/29147] " anlauf at gmx dot de
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: anlauf at gmx dot de @ 2006-09-20  9:52 UTC (permalink / raw)
  To: gcc-bugs

Hi,

a recently introduced range check not only kills
legacy code that I use, but also gives a misleading
error message:

% cat gfcbug42.f
      INTEGER IBALL(4)
      DATA IBALL / Z'FF'        ,
     +             Z'FFFF'      ,
     +             Z'FFFFFF'    ,
     +             Z'FFFFFFFF'  /
      END
% gfortran -c -std=legacy gfcbug42.f
 In file gfcbug42.f:5

     +             Z'FFFFFFFF'  /                                       
                             1
Error: Arithmetic overflow converting INTEGER(8) to INTEGER(4) at (1)


Funny, I even do not see any 8 byte integer around...
-ha


-- 
           Summary: Overflow check in DATA statements
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de
  GCC host triplet: i686-pc-linux-gnu


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


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

* [Bug fortran/29147] Overflow check in DATA statements
  2006-09-20  9:52 [Bug fortran/29147] New: Overflow check in DATA statements anlauf at gmx dot de
@ 2006-09-20  9:53 ` anlauf at gmx dot de
  2006-09-29  0:26 ` [Bug fortran/29147] Bad overflow " kargl at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gmx dot de @ 2006-09-20  9:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from anlauf at gmx dot de  2006-09-20 09:53 -------
Created an attachment (id=12299)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12299&action=view)
Legacy code example

Compiles fine with every other compiler out there.


-- 


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


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

* [Bug fortran/29147] Bad overflow check in DATA statements
  2006-09-20  9:52 [Bug fortran/29147] New: Overflow check in DATA statements anlauf at gmx dot de
  2006-09-20  9:53 ` [Bug fortran/29147] " anlauf at gmx dot de
@ 2006-09-29  0:26 ` kargl at gcc dot gnu dot org
  2006-09-29  3:26 ` kargl at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu dot org @ 2006-09-29  0:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from kargl at gcc dot gnu dot org  2006-09-29 00:25 -------
(In reply to comment #1)
> Created an attachment (id=12299)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12299&action=view) [edit]
> Legacy code example
> 
> Compiles fine with every other compiler out there.
> 

That's because every other compiler out there is broken :-)

The standard is quite clear that the BOZ is converted to an
integer with the kind type with the largest decimal range.
In your case that integer is kind=8, and  Z'FFFFFFFF' = 4294967295
which over flows the range of an integer(kind=4) constant.


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu dot org


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


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

* [Bug fortran/29147] Bad overflow check in DATA statements
  2006-09-20  9:52 [Bug fortran/29147] New: Overflow check in DATA statements anlauf at gmx dot de
  2006-09-20  9:53 ` [Bug fortran/29147] " anlauf at gmx dot de
  2006-09-29  0:26 ` [Bug fortran/29147] Bad overflow " kargl at gcc dot gnu dot org
@ 2006-09-29  3:26 ` kargl at gcc dot gnu dot org
  2006-09-29  4:30 ` kargl at gcc dot gnu dot org
  2006-09-29  4:55 ` kargl at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu dot org @ 2006-09-29  3:26 UTC (permalink / raw)
  To: gcc-bugs



-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |kargl at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-09-29 03:26:51
               date|                            |


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


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

* [Bug fortran/29147] Bad overflow check in DATA statements
  2006-09-20  9:52 [Bug fortran/29147] New: Overflow check in DATA statements anlauf at gmx dot de
                   ` (2 preceding siblings ...)
  2006-09-29  3:26 ` kargl at gcc dot gnu dot org
@ 2006-09-29  4:30 ` kargl at gcc dot gnu dot org
  2006-09-29  4:55 ` kargl at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu dot org @ 2006-09-29  4:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from kargl at gcc dot gnu dot org  2006-09-29 04:30 -------
I failed to not that your assertion that the error message
is misleading is incorrect.  The error message is actually
quite concise and accurate.  See section 5.2.10 of the F95
standard.

I submitted a patch that will allow you to do

gfortran -fno-range-check nonportable_code.f90


-- 


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


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

* [Bug fortran/29147] Bad overflow check in DATA statements
  2006-09-20  9:52 [Bug fortran/29147] New: Overflow check in DATA statements anlauf at gmx dot de
                   ` (3 preceding siblings ...)
  2006-09-29  4:30 ` kargl at gcc dot gnu dot org
@ 2006-09-29  4:55 ` kargl at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu dot org @ 2006-09-29  4:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from kargl at gcc dot gnu dot org  2006-09-29 04:55 -------
Fixed on trunk.  Although the patch would work
on 4.1, it isn't needed because I never fixed range
checking on 4.1.

Use -fno-range-check option.


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.2.0


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


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

end of thread, other threads:[~2006-09-29  4:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-20  9:52 [Bug fortran/29147] New: Overflow check in DATA statements anlauf at gmx dot de
2006-09-20  9:53 ` [Bug fortran/29147] " anlauf at gmx dot de
2006-09-29  0:26 ` [Bug fortran/29147] Bad overflow " kargl at gcc dot gnu dot org
2006-09-29  3:26 ` kargl at gcc dot gnu dot org
2006-09-29  4:30 ` kargl at gcc dot gnu dot org
2006-09-29  4:55 ` kargl at gcc dot gnu dot org

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