public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40142]  New: integer constants not promoted with -fdefault-integer-8
@ 2009-05-14  9:41 ajmay81 at googlemail dot com
  2009-05-14 14:52 ` [Bug fortran/40142] " kargl at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ajmay81 at googlemail dot com @ 2009-05-14  9:41 UTC (permalink / raw)
  To: gcc-bugs

Fortran code:

      program test
      implicit none
      character*2 a(1)
      character*24 trop
      integer i,j
      i=1
      j=2

      trop='b'//a(1)(i:j) ! fine
      trop='b'//a(1)(1:2) ! warning
      trop=a(1)(1:2)//'b' ! warning
      trop=a(1)(1:2) ! fine
      end

Compiled with:

gfortran -Wconversion test.f

produces no warnings, but with 8-byte integers:

gfortran -Wconversion -fdefault-integer-8 test.f
test.f:10.23:

      trop='b'//a(1)(1:2) ! warning
                      1
Warning: Conversion from INTEGER(4) to INTEGER(8) at (1)
test.f:11.18:

      trop=a(1)(1:2)//'b' ! warning
                 1
Warning: Conversion from INTEGER(4) to INTEGER(8) at (1)

Using gfortran build that ships with openSuSE 11.1:

Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.3
--enable-ssp --disable-libssp --with-bugurl=http://bugs.opensuse.org/
--with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap
--with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--enable-version-specific-runtime-libs --program-suffix=-4.3
--enable-linux-futex --without-system-libunwind --with-cpu=generic
--build=x86_64-suse-linux
Thread model: posix
gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux)


-- 
           Summary: integer constants not promoted with -fdefault-integer-8
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ajmay81 at googlemail dot com


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


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

* [Bug fortran/40142] integer constants not promoted with -fdefault-integer-8
  2009-05-14  9:41 [Bug fortran/40142] New: integer constants not promoted with -fdefault-integer-8 ajmay81 at googlemail dot com
@ 2009-05-14 14:52 ` kargl at gcc dot gnu dot org
  2009-05-14 14:56 ` kargl at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu dot org @ 2009-05-14 14:52 UTC (permalink / raw)
  To: gcc-bugs



-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Priority|P3                          |P5


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


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

* [Bug fortran/40142] integer constants not promoted with -fdefault-integer-8
  2009-05-14  9:41 [Bug fortran/40142] New: integer constants not promoted with -fdefault-integer-8 ajmay81 at googlemail dot com
  2009-05-14 14:52 ` [Bug fortran/40142] " kargl at gcc dot gnu dot org
@ 2009-05-14 14:56 ` kargl at gcc dot gnu dot org
  2009-05-17 10:57 ` fxcoudert at gcc dot gnu dot org
  2009-05-17 12:59 ` jvdelisle at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu dot org @ 2009-05-14 14:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from kargl at gcc dot gnu dot org  2009-05-14 14:56 -------
Looks like a false positive.

REMOVE:kargl[230] cat kj.f90
      program test
      implicit none
      integer i,j
      i = 1234567899876
      print *, i
      end
REMOVE:kargl[231] gfc4x -o z kj.f90
kj.f90:4.23:

      i = 1234567899876
                       1
Error: Integer too big for its kind at (1). This check can be disabled
with the option -fno-range-check
REMOVE:kargl[232] gfc4x -o z -fdefault-integer-8 kj.f90
REMOVE:kargl[233] ./z
        1234567899876


-- 


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


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

* [Bug fortran/40142] integer constants not promoted with -fdefault-integer-8
  2009-05-14  9:41 [Bug fortran/40142] New: integer constants not promoted with -fdefault-integer-8 ajmay81 at googlemail dot com
  2009-05-14 14:52 ` [Bug fortran/40142] " kargl at gcc dot gnu dot org
  2009-05-14 14:56 ` kargl at gcc dot gnu dot org
@ 2009-05-17 10:57 ` fxcoudert at gcc dot gnu dot org
  2009-05-17 12:59 ` jvdelisle at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-05-17 10:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from fxcoudert at gcc dot gnu dot org  2009-05-17 10:57 -------
Character lengths are integers of kind value 4. This is not modified by
-fdefault-integer-8. Thus, when converting the index, which has kind value 8,
to the type of a character length, you get the warning with -Wconversion.

I don't think we should modify the behaviour of gfortran. The only possible
course of action would be to make character length have kind value 8 when
-fdefault-integer-8 is used, but that means we would have to compile
specialized versions of all libgfortran routines that take strings as arguments
(or return strings). This looks way too much effort to support a questionable
combination of options (one of which asks for pedantic handling of types, and
one of which is designed to help people compile code that is sloppy with
respect to types).

If a mainainer concurs, please close this as WONTFIX.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-05-17 10:57:07
               date|                            |


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


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

* [Bug fortran/40142] integer constants not promoted with -fdefault-integer-8
  2009-05-14  9:41 [Bug fortran/40142] New: integer constants not promoted with -fdefault-integer-8 ajmay81 at googlemail dot com
                   ` (2 preceding siblings ...)
  2009-05-17 10:57 ` fxcoudert at gcc dot gnu dot org
@ 2009-05-17 12:59 ` jvdelisle at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-05-17 12:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jvdelisle at gcc dot gnu dot org  2009-05-17 12:58 -------
Concur. Rather than use -fdefault-integer-8, consider using selected_int_kind
and explicitly declaring size of integers. 


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX


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


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

end of thread, other threads:[~2009-05-17 12:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-14  9:41 [Bug fortran/40142] New: integer constants not promoted with -fdefault-integer-8 ajmay81 at googlemail dot com
2009-05-14 14:52 ` [Bug fortran/40142] " kargl at gcc dot gnu dot org
2009-05-14 14:56 ` kargl at gcc dot gnu dot org
2009-05-17 10:57 ` fxcoudert at gcc dot gnu dot org
2009-05-17 12:59 ` jvdelisle 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).