User account creation filtered due to spam.

Bug 36462

Summary: [F03] Audit intrinsics for KIND arguments
Product: gcc Reporter: Francois-Xavier Coudert <fxcoudert>
Component: fortranAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, janus, tkoenig
Priority: P3    
Version: 4.4.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2008-06-08 11:20:55
Bug Depends on:    
Bug Blocks: 20585    

Description Francois-Xavier Coudert 2008-06-08 01:22:11 UTC
$ cat a.f90 
  character(10) string
  string = 'ABCDEEDCBA'
  write(*,*) index(string,'A',kind=1)
  end
$ gfortran a.f90 && ./a.out
   10

I suspect we're passing 1 as a logical BACK argument to the library function. Well, I do more than suspect, I checked and that's indeed what we do :)

Work needed in trans-intrinsic.c, probably an easy one. Will need auditing other intrinsics that were added a KIND argument in F2003.
Comment 1 Tobias Burnus 2008-06-08 11:20:55 UTC
Note: Initially found by James Van Buskirk:
http://groups.google.com/group/comp.lang.fortran/msg/e90575a5a6a50e35

Comment 2 Tobias Burnus 2008-06-12 16:16:50 UTC
Fixed for INDEX and SCAN, but leaving open as reminder for the following:

> Will need auditing other intrinsics that were added a KIND argument in F2003.
Comment 3 Tobias Burnus 2008-06-12 16:17:32 UTC
Subject: Bug 36462

Author: burnus
Date: Thu Jun 12 16:16:39 2008
New Revision: 136712

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=136712
Log:
2008-06-12  Tobias Burnus  <burnus@net-b.de>

        PR fortran/36462
        * trans-intrinsic.c (gfc_conv_intrinsic_index_scan_verify):
        Fix passing of the BACK= argument.

2008-06-12  Tobias Burnus  <burnus@net-b.de>

        PR fortran/36462
        * gfortran.dg/index_2.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/index_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-intrinsic.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Daniel Franke 2009-01-04 00:10:15 UTC
See also: PR29600.
Comment 5 Thomas Koenig 2011-01-08 10:07:18 UTC
Adjusting Subject, removing wrong-code.
Comment 6 Francois-Xavier Coudert 2014-06-07 08:11:12 UTC
After a long and tedious look through the F2003 and F2008 standards, it appears we've got this covered.