Bug 25099 - Conformance of arguments to ELEMENTAL subroutines
Summary: Conformance of arguments to ELEMENTAL subroutines
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid, ice-on-invalid-code
: 25100 (view as bug list)
Depends on: 22146
Blocks:
  Show dependency treegraph
 
Reported: 2005-11-26 18:07 UTC by Joost VandeVondele
Modified: 2006-05-08 06:27 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-03-01 02:14:22


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2005-11-26 18:07:50 UTC
using GNU Fortran 95 (GCC) 4.1.0 20051126 (prerelease)  with '-g -pedantic -std=f95', I get a bad / no diagnostic for the following invalid code:

integer :: I(2,2),J(2)
CALL S(I,J)
CONTAINS
ELEMENTAL SUBROUTINE S(I,J)
  INTEGER, INTENT(IN) :: I,J
END SUBROUTINE S
END
Comment 1 eedelman 2005-11-30 11:33:00 UTC
Currently gfortran crashes on this code, because of PR 22146. I'll leave this PR (rather than marking it as a duplicate) as a reminder that, when we fix PR 22146, we need to check conformance of arguments as well.
Comment 2 eedelman 2005-11-30 13:23:27 UTC
*** Bug 25100 has been marked as a duplicate of this bug. ***
Comment 3 Andrew Pinski 2006-03-01 02:14:22 UTC
This ICEs for me on the mainline, backtrace:
#0  integer_onep (expr=0x0) at /Users/pinskia/src/gcc/local/gcc/gcc/tree.c:1226
#1  0x0006bf90 in gfc_conv_loop_setup (loop=0xbffff7d8) at /Users/pinskia/src/gcc/local/gcc/gcc/fortran/trans-array.c:2738
#2  0x0008d698 in gfc_trans_call (code=0x42b01350) at /Users/pinskia/src/gcc/local/gcc/gcc/fortran/trans-stmt.c:268
#3  0x00064fe8 in gfc_trans_code (code=0x42b01350) at /Users/pinskia/src/gcc/local/gcc/gcc/fortran/trans.c:495
#4  0x000759c4 in gfc_generate_function_code (ns=0x42b01350) at /Users/pinskia/src/gcc/local/gcc/gcc/fortran/trans-decl.c:2902
#5  0x00043150 in gfc_parse_file () at /Users/pinskia/src/gcc/local/gcc/gcc/fortran/parse.c:3195
#6  0x00063e3c in gfc_be_parse_file (set_yydebug=0) at /Users/pinskia/src/gcc/local/gcc/gcc/fortran/f95-lang.c:298
#7  0x000d9430 in toplev_main (argc=6615784, argv=0x64f3bc) at /Users/pinskia/src/gcc/local/gcc/gcc/toplev.c:999
#8  0x00001c10 in _start (argc=6615996, argv=0x64f858, envp=0x1) at /SourceCache/Csu/Csu-46/crt.c:267
Comment 4 patchapp@dberlin.org 2006-04-21 16:15:26 UTC
Subject: Bug number PR25099

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-04/msg00802.html
Comment 5 Paul Thomas 2006-04-23 11:56:43 UTC
Subject: Bug 25099

Author: pault
Date: Sun Apr 23 11:56:37 2006
New Revision: 113194

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113194
Log:
2006-04-23  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/25099
	* resolve.c (resolve_call): Check conformity of elemental
	subroutine actual arguments.

2006-04-23  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/25099
	* gfortran.dg/elemental_subroutine_4.f90: New test.
	* gfortran.dg/assumed_size_refs_1.f90: Add error to non-conforming
	call sub (m, x).

Added:
    trunk/gcc/testsuite/gfortran.dg/elemental_subroutine_4.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/assumed_size_refs_1.f90

Comment 6 Paul Thomas 2006-05-08 05:02:13 UTC
Subject: Bug 25099

Author: pault
Date: Mon May  8 05:01:56 2006
New Revision: 113618

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113618
Log:
2006-05-08  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/24813
	* trans-array.c (get_array_ctor_strlen): Remove static attribute.
	* trans.h: Add prototype for get_array_ctor_strlen.
	* trans-intrinsic.c (gfc_conv_intrinsic_len): Switch on EXPR_ARRAY
	and call get_array_ctor_strlen.

	PR fortran/27269
	* module.c: Add static flag in_load_equiv.
	(mio_expr_ref): Return if no symtree and in_load_equiv.
	(load_equiv): If any of the equivalence members have no symtree, free
	the equivalence and the associated expressions.

	PR fortran/27324
	* trans-common.c (gfc_trans_common): Invert the order of calls to
	finish equivalences and gfc_commit_symbols.

	PR fortran/25099
	* resolve.c (resolve_call): Check conformity of elemental
	subroutine actual arguments.

2006-05-08  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/24813
	* gfortran.dg/char_cons_len.f90: New test.

	PR fortran/27269
	PR fortran/27324
	* gfortran.dg/module_equivalence_2.f90: New test.

	PR fortran/25099
	* gfortran.dg/elemental_subroutine_4.f90: New test.
	* gfortran.dg/assumed_size_refs_1.f90: Add error to non-conforming
	call sub (m, x).



Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/char_cons_len.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/elemental_subroutine_4.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/module_equivalence_2.f90
Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/module.c
    branches/gcc-4_1-branch/gcc/fortran/resolve.c
    branches/gcc-4_1-branch/gcc/fortran/trans-array.c
    branches/gcc-4_1-branch/gcc/fortran/trans-common.c
    branches/gcc-4_1-branch/gcc/fortran/trans-intrinsic.c
    branches/gcc-4_1-branch/gcc/fortran/trans.h
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/assumed_size_refs_1.f90

Comment 7 Paul Thomas 2006-05-08 06:27:05 UTC
Fixed on trunk and 4.1

Paul