Bug 29600 - [F03] MINLOC, MAXLOC and SHAPE take an optional KIND argument
[F03] MINLOC, MAXLOC and SHAPE take an optional KIND argument
Status: NEW
Product: gcc
Classification: Unclassified
Component: fortran
4.3.0
: P3 enhancement
: ---
Assigned To: Not yet assigned to anyone
: rejects-valid
Depends on:
Blocks: 20585
  Show dependency treegraph
 
Reported: 2006-10-26 08:22 UTC by Francois-Xavier Coudert
Modified: 2013-12-14 11:34 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-01-13 19:24:06


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francois-Xavier Coudert 2006-10-26 08:22:04 UTC
The following intrinsics were given an additional (optional) KIND argument by F2003: ACHAR, COUNT, IACHAR, ICHAR, INDEX, LBOUND, LEN, LEN_TRIM, MAXLOC, MINLOC, SCAN, SHAPE, SIZE, UBOUND, VERIFY
Comment 1 Francois-Xavier Coudert 2007-08-08 17:37:36 UTC
The following are easy to fix (I have a patch that just needs writing doc, I'll submit later today): COUNT, IACHAR, ICHAR, INDEX, LBOUND, LEN, LEN_TRIM, SCAN, SIZE, UBOUND, VERIFY.

This will leave: ACHAR (not so hard), MAXLOC, MINLOC and SHAPE. The last three are a bit more tricky if we want to avoid combinatorial explosion of the library routines ;-)
Comment 2 Francois-Xavier Coudert 2007-08-12 19:57:13 UTC
Subject: Bug 29600

Author: fxcoudert
Date: Sun Aug 12 19:57:01 2007
New Revision: 127380

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127380
Log:
	PR fortran/29600

	* intrinsic.c (add_functions): Add KIND arguments to COUNT,
	IACHAR, ICHAR, INDEX, LBOUND, LEN, LEN_TRIM, SCAN, SIZE, UBOUND
	and VERIFY.
	* iresolve.c (gfc_resolve_count): Add kind argument.
	(gfc_resolve_iachar): New function.
	(gfc_resolve_ichar): Add kind argument.
	(gfc_resolve_index_func): Likewise.
	(gfc_resolve_lbound): Likewise.
	(gfc_resolve_len): Likewise.
	(gfc_resolve_len_trim): Likewise.
	(gfc_resolve_scan): Likewise.
	(gfc_resolve_size): New function.
	(gfc_resolve_ubound): Add kind argument.
	(gfc_resolve_verify): Likewise.
	* trans-decl.c (gfc_get_extern_function_decl): Allow specific
	intrinsics to have 4 arguments.
	* check.c (gfc_check_count): Add kind argument.
	(gfc_check_ichar_iachar): Likewise.
	(gfc_check_index): Likewise.
	(gfc_check_lbound): Likewise.
	(gfc_check_len_lentrim): New function.
	(gfc_check_scan): Add kind argument.
	(gfc_check_size): Likewise.
	(gfc_check_ubound): Likewise.
	(gfc_check_verify): Likewise.
	* intrinsic.texi: Update documentation for COUNT, IACHAR, ICHAR,
	INDEX, LBOUND, LEN, LEN_TRIM, SCAN, SIZE, UBOUND and VERIFY.
	* simplify.c (get_kind): Whitespace fix.
	(int_expr_with_kind): New function.
	(gfc_simplify_iachar): Add kind argument.
	(gfc_simplify_iachar): Likewise.
	(gfc_simplify_ichar): Likewise.
	(gfc_simplify_index): Likewise.
	(simplify_bound_dim): Likewise.
	(simplify_bound): Likewise.
	(gfc_simplify_lbound): Likewise.
	(gfc_simplify_len): Likewise.
	(gfc_simplify_len_trim): Likewise.
	(gfc_simplify_scan): Likewise.
	(gfc_simplify_shape): Pass NULL as kind argument to gfc_simplify_size.
	(gfc_simplify_size): Add kind argument.
	(gfc_simplify_ubound): Likewise.
	(gfc_simplify_verify): Likewise.
	* intrinsic.h: Update prototypes and add new ones.
	* trans-intrinsic.c (gfc_conv_intrinsic_index): Rename into
	gfc_conv_intrinsic_index_scan_verify.
	(gfc_conv_intrinsic_scan, gfc_conv_intrinsic_verify): Remove.
	(gfc_conv_intrinsic_function): Call
	gfc_conv_intrinsic_index_scan_verify to translate the INDEX,
	SCAN and VERIFY intrinsics.

	* gfortran.dg/intrinsics_kind_argument_1.f90: New test.
	* gfortran.dg/pure_dummy_length_1.f90: Adapt to new error wording.

Added:
    trunk/gcc/testsuite/gfortran.dg/intrinsics_kind_argument_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/check.c
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/intrinsic.h
    trunk/gcc/fortran/intrinsic.texi
    trunk/gcc/fortran/iresolve.c
    trunk/gcc/fortran/simplify.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/fortran/trans-intrinsic.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/pure_dummy_length_1.f90

Comment 3 Francois-Xavier Coudert 2007-08-12 21:21:25 UTC
Subject: Bug 29600

Author: fxcoudert
Date: Sun Aug 12 21:21:08 2007
New Revision: 127385

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127385
Log:
	PR fortran/29600

	* intrinsic.c (add_functions): Add optional KIND argument to ACHAR.
	* iresolve.c (gfc_resolve_achar): Handle the KIND argument.
	* check.c (gfc_check_achar): Check for the optional KIND argument.
	* simplify.c (gfc_simplify_achar): Use KIND argument.
	* intrinsic.h (gfc_check_achar, gfc_simplify_achar,
	gfc_resolve_achar): Adjust prototypes.

	* gfortran.dg/intrinsics_kind_argument_1.f90: Add test for ACHAR
	intrinsic.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/check.c
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/intrinsic.h
    trunk/gcc/fortran/iresolve.c
    trunk/gcc/fortran/simplify.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/intrinsics_kind_argument_1.f90

Comment 4 Francois-Xavier Coudert 2007-08-12 21:26:42 UTC
Updated summary to reflect current state: only MINLOC, MAXLOC and SHAPE needs to be done. I'm not working on it any more.
Comment 5 Thomas Koenig 2008-01-20 09:50:52 UTC
I'll take a shot at this.
Comment 6 Janne Blomqvist 2008-05-22 18:13:36 UTC
The "proper" solution, which as a side effect would take care of the combinatorial explosion issue as well, would be to inline these intrinsics. See also PR 31067.
Comment 7 Thomas Koenig 2008-06-04 19:06:03 UTC
No time for now (Real Time is catching up with me big time).

Unassigning (for now).
Comment 8 Daniel Franke 2009-01-04 00:10:17 UTC
See also: PR36462.
Comment 9 Daniel Franke 2009-03-31 19:44:35 UTC
Patch:
  http://gcc.gnu.org/ml/fortran/2009-03/msg00142.html

Rejected due to concerns about additional bloat of the library (see also #6).
The frontend-changes are (probably) ok.

Unassigning myself.