public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35003]  New: spurious warning using -Wconversion, a do loop, and 8 byte integers
@ 2008-01-28 21:53 bcbarnes at gmail dot com
  2008-01-29 10:23 ` [Bug fortran/35003] " fxcoudert at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: bcbarnes at gmail dot com @ 2008-01-28 21:53 UTC (permalink / raw)
  To: gcc-bugs

Part of original report:

I have recently had the chance to compile some code using -Wconversion and a
loop that may iterate more than 2.2 billion times.  There is a compiler warning
of this sort which I cannot resolve:

nell:~/work/bit barnes$ gfortran -Wconversion -o t.x testcase.f
testcase.f:7.16:

      do i=1_8,n
               1
Warning: Conversion from INTEGER(4) to INTEGER(8) at (1)
---
      program testcase
      implicit none
      integer(8) i,n

      n=1_8

      do i=1_8,n
      enddo

      end
---

The only variables in the testcase are 8-byte integers, yet I get that
conversion warning.  I skimmed the gfortran bugzilla and did not notice
anything similar.  If the loop is executed 2.2 billion times (n=2 200 000
000_8), it does run each instance, so I know the do loop is not being truncated
at the limit of a 4-byte integer.

---
nell:~/work/bit barnes$ gfortran -v
Using built-in specs.
Target: i686-apple-darwin8
Configured with: ../gcc-4.2.2/configure --prefix=/sw --prefix=/sw/lib/gcc4.2
--mandir=/sw/share/man --infodir=/sw/share/info
--enable-languages=c,c++,fortran,objc,java --with-arch=nocona
--with-tune=generic --host=i686-apple-darwin8 --with-gmp=/sw
--with-libiconv-prefix=/sw --with-system-zlib --x-includes=/usr/X11R6/include
--x-libraries=/usr/X11R6/lib
Thread model: posix
gcc version 4.2.2


Part of reply from Tobias Burnus (he asked me to file a bug report):

The problem is that the iterator step variable is INTEGER(4) [implicitly added
"1_4" ("gfc_int_expr (1);")]:

  do i = 1_8, n, 1_4


Something like the following should work:


Index: gcc/fortran/match.c
===================================================================
--- gcc/fortran/match.c (revision 131912)
+++ gcc/fortran/match.c (working copy)
@@ -958,6 +965,8 @@ gfc_match_iterator (gfc_iterator *iter,
  if (gfc_match_char (',') != MATCH_YES)
    {
      e3 = gfc_int_expr (1);
+      if (var->ts.type == BT_INTEGER)
+       e3->ts.kind = var->ts.kind;
      goto done;
    }


-- 
           Summary: spurious warning using -Wconversion, a do loop, and 8
                    byte integers
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bcbarnes at gmail dot com


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


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

* [Bug fortran/35003] spurious warning using -Wconversion, a do loop, and 8 byte integers
  2008-01-28 21:53 [Bug fortran/35003] New: spurious warning using -Wconversion, a do loop, and 8 byte integers bcbarnes at gmail dot com
@ 2008-01-29 10:23 ` fxcoudert at gcc dot gnu dot org
  2008-01-29 17:49 ` dfranke at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-01-29 10:23 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-01-29 10:15:13
               date|                            |


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


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

* [Bug fortran/35003] spurious warning using -Wconversion, a do loop, and 8 byte integers
  2008-01-28 21:53 [Bug fortran/35003] New: spurious warning using -Wconversion, a do loop, and 8 byte integers bcbarnes at gmail dot com
  2008-01-29 10:23 ` [Bug fortran/35003] " fxcoudert at gcc dot gnu dot org
@ 2008-01-29 17:49 ` dfranke at gcc dot gnu dot org
  2008-01-30 23:06 ` manu at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-01-29 17:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dfranke at gcc dot gnu dot org  2008-01-29 17:27 -------
See also: PR29458


-- 

dfranke at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/35003] spurious warning using -Wconversion, a do loop, and 8 byte integers
  2008-01-28 21:53 [Bug fortran/35003] New: spurious warning using -Wconversion, a do loop, and 8 byte integers bcbarnes at gmail dot com
  2008-01-29 10:23 ` [Bug fortran/35003] " fxcoudert at gcc dot gnu dot org
  2008-01-29 17:49 ` dfranke at gcc dot gnu dot org
@ 2008-01-30 23:06 ` manu at gcc dot gnu dot org
  2009-03-29  8:05 ` fxcoudert at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-01-30 23:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2008-01-30 22:30 -------
(In reply to comment #1)
> See also: PR29458

Why? Those two bugs have nothing to do with each other.

BTW, how can a conversion from INTEGER(4) to INTEGER(8) change a value? I think
the Wconversion warning is wrong, not the iterator creation.


-- 


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


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

* [Bug fortran/35003] spurious warning using -Wconversion, a do loop, and 8 byte integers
  2008-01-28 21:53 [Bug fortran/35003] New: spurious warning using -Wconversion, a do loop, and 8 byte integers bcbarnes at gmail dot com
                   ` (2 preceding siblings ...)
  2008-01-30 23:06 ` manu at gcc dot gnu dot org
@ 2009-03-29  8:05 ` fxcoudert at gcc dot gnu dot org
  2010-05-09 19:30 ` dfranke at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-03-29  8:05 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
           Keywords|                            |diagnostic


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


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

* [Bug fortran/35003] spurious warning using -Wconversion, a do loop, and 8 byte integers
  2008-01-28 21:53 [Bug fortran/35003] New: spurious warning using -Wconversion, a do loop, and 8 byte integers bcbarnes at gmail dot com
                   ` (3 preceding siblings ...)
  2009-03-29  8:05 ` fxcoudert at gcc dot gnu dot org
@ 2010-05-09 19:30 ` dfranke at gcc dot gnu dot org
  2010-05-10 17:12 ` dfranke at gcc dot gnu dot org
  2010-05-10 19:24 ` dfranke at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-09 19:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dfranke at gcc dot gnu dot org  2010-05-09 19:29 -------
Patch:
    http://gcc.gnu.org/ml/fortran/2010-05/msg00067.html


-- 


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


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

* [Bug fortran/35003] spurious warning using -Wconversion, a do loop, and 8 byte integers
  2008-01-28 21:53 [Bug fortran/35003] New: spurious warning using -Wconversion, a do loop, and 8 byte integers bcbarnes at gmail dot com
                   ` (4 preceding siblings ...)
  2010-05-09 19:30 ` dfranke at gcc dot gnu dot org
@ 2010-05-10 17:12 ` dfranke at gcc dot gnu dot org
  2010-05-10 19:24 ` dfranke at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-10 17:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dfranke at gcc dot gnu dot org  2010-05-10 17:11 -------
Subject: Bug 35003

Author: dfranke
Date: Mon May 10 17:10:53 2010
New Revision: 159238

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159238
Log:
gcc/fortran/:
2010-05-10  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/27866
        PR fortran/35003
        PR fortran/42809
        * intrinsic.c (gfc_convert_type_warn): Be more discriminative
        about conversion warnings.

gcc/testsuite/:
2010-05-08  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/27866
        PR fortran/35003
        PR fortran/42809
        * gfortran.dg/array_constructor_type_17.f03: Updated match string.
        * gfortran.dg/warn_conversion.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/warn_conversion.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/array_constructor_type_17.f03


-- 


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


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

* [Bug fortran/35003] spurious warning using -Wconversion, a do loop, and 8 byte integers
  2008-01-28 21:53 [Bug fortran/35003] New: spurious warning using -Wconversion, a do loop, and 8 byte integers bcbarnes at gmail dot com
                   ` (5 preceding siblings ...)
  2010-05-10 17:12 ` dfranke at gcc dot gnu dot org
@ 2010-05-10 19:24 ` dfranke at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-10 19:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from dfranke at gcc dot gnu dot org  2010-05-10 19:24 -------
Fixed. Closing.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.0


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


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

end of thread, other threads:[~2010-05-10 19:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-28 21:53 [Bug fortran/35003] New: spurious warning using -Wconversion, a do loop, and 8 byte integers bcbarnes at gmail dot com
2008-01-29 10:23 ` [Bug fortran/35003] " fxcoudert at gcc dot gnu dot org
2008-01-29 17:49 ` dfranke at gcc dot gnu dot org
2008-01-30 23:06 ` manu at gcc dot gnu dot org
2009-03-29  8:05 ` fxcoudert at gcc dot gnu dot org
2010-05-09 19:30 ` dfranke at gcc dot gnu dot org
2010-05-10 17:12 ` dfranke at gcc dot gnu dot org
2010-05-10 19:24 ` dfranke 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).