Bug 36462

Summary: [F03] Audit intrinsics for KIND arguments
Product: gcc Reporter: Francois-Xavier Coudert <fxcoudert>
Component: fortranAssignee: Not yet assigned to anyone <unassigned>
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)
$ gfortran a.f90 && ./a.out

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:

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


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.