Bug 25054 - nonconstant bounds array cannot appear in a namelist
Summary: nonconstant bounds array cannot appear in a namelist
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: 4.1.1
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2005-11-26 17:47 UTC by Joost VandeVondele
Modified: 2006-03-07 02:23 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-11-26 19:13:50


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2005-11-26 17:47:02 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:

SUBROUTINE S1(I)
 integer :: a,b(I)
 NAMELIST /NLIST/ a,b
 a=1 ; b=2
 write(6,NML=NLIST)
END SUBROUTINE S1
END
Comment 1 Francois-Xavier Coudert 2005-11-26 19:13:50 UTC
## g95 ##
In file foo.f90:3

 NAMELIST /NLIST/ a,b
                     1
Error: Variable 'b' at (1) must have constant bounds to be in a NAMELIST
## Intel ##
fortcom: Warning: foo.f90, line 2: This name has not been given an explicit type.   [I]
 integer :: a,b(I)
----------------^
fortcom: Error: foo.f90, line 3: A NAMELIST group object must not be an array with nonconstant bounds.   [B]
 NAMELIST /NLIST/ a,b
--------------------^
compilation aborted for foo.f90 (code 1)
## Portland ##
PGF90-S-0108-Illegal variable, b, in NAMELIST group nlist (foo.f90: 3)
  0 inform,   0 warnings,   1 severes, 0 fatal for s1
## Sun ##

 integer :: a,b(I)
              ^
"foo.f90", Line = 2, Column = 15: ERROR: "B" is a namelist-group-object, therefore it must not be declared as an explicit-shape array with nonconstant bounds.
Comment 2 patchapp@dberlin.org 2006-02-15 18:15:38 UTC
Subject: Bug number PR25054

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-02/msg01263.html
Comment 3 Paul Thomas 2006-02-19 15:24:30 UTC
Subject: Bug 25054

Author: pault
Date: Sun Feb 19 15:24:26 2006
New Revision: 111268

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111268
Log:
2005-02-19  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/25054
	* resolve.c (is_non_constant_shape_array): New function.
	(resolve_fl_variable): Remove code for the new function and call it.
	(resolve_fl_namelist): New function.  Add test for namelist array
	with non-constant shape, using is_non_constant_shape_array.
	(resolve_symbol): Remove code for resolve_fl_namelist and call it.

	PR fortran/25089
	* match.c (match_namelist): Increment the refs field of an accepted
	namelist object symbol.
	* resolve.c (resolve_fl_namelist): Test namelist objects for a conflict
	with contained or module procedures.

2005-02-19  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/25054
	* gfortran.dg/namelist_5.f90: New test.

	PR fortran/25089
	* gfortran.dg/namelist_4.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/namelist_4.f90
    trunk/gcc/testsuite/gfortran.dg/namelist_5.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/match.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Paul Thomas 2006-02-19 16:24:44 UTC
Fixed on trunk - ready for 4.1 just as soon as it reopens.

Paul 
Comment 5 Paul Thomas 2006-03-07 00:06:54 UTC
Subject: Bug 25054

Author: pault
Date: Tue Mar  7 00:06:37 2006
New Revision: 111796

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

	PR fortran/26107
	* resolve.c (resolve_function): Add name after test for pureness.

	* iresolve.c (gfc_resolve_dot_product):  Remove any difference in
	treatment of logical types.
	* trans-intrinsic.c (gfc_conv_intrinsic_dot_product):  New function. 

	PR fortran/26393
	* trans-decl.c (gfc_get_symbol_decl): Extend condition that symbols
	must be referenced to include unreferenced symbols in an interface
	body. 

	PR fortran/20938
	* trans-array.c (gfc_conv_resolve_dependencies): Add call to
	gfc_are_equivalenced_arrays.
	* symbol.c (gfc_free_equiv_infos, gfc_free_equiv_lists): New
	functions. (gfc_free_namespace): Call them.
	* trans-common.c (copy_equiv_list_to_ns): New function.
	(add_equivalences): Call it.
	* gfortran.h: Add equiv_lists to gfc_namespace and define
	gfc_equiv_list and gfc_equiv_info.
	* dependency.c (gfc_are_equivalenced_arrays): New function.
	(gfc_check_dependency): Call it.
	* dependency.h: Prototype for gfc_are_equivalenced_arrays.

	PR fortran/24519
	* dependency.c (gfc_is_same_range): Correct typo.
	(gfc_check_section_vs_section): Call gfc_is_same_range.

	PR fortran/25395
	* trans-common.c (add_equivalences): Add a new flag that is set when
	an equivalence is seen that prevents more from being reset until the
	start of a new traversal of the list, thus ensuring completion of
	all the equivalences.

	PR fortran/25054
	* resolve.c (is_non_constant_shape_array): New function.
	(resolve_fl_variable): Remove code for the new function and call it.
	(resolve_fl_namelist): New function.  Add test for namelist array
	with non-constant shape, using is_non_constant_shape_array.
	(resolve_symbol): Remove code for resolve_fl_namelist and call it.

	PR fortran/25089
	* match.c (match_namelist): Increment the refs field of an accepted
	namelist object symbol.
	* resolve.c (resolve_fl_namelist): Test namelist objects for a conflict
	with contained or module procedures.

	PR fortran/24557
	* trans-expr.c (gfc_add_interface_mapping): Use the actual argument
	for character(*) arrays, rather than casting to the type and kind
	parameters of the formal argument.

2006-03-07  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/26107
	* resolve.c (resolve_function): Add name after test for pureness.

	* gfortran.dg/logical_dot_product.f90: New test. 

	PR fortran/26393
	* gfortran.dg/used_interface_ref.f90: New test.

	PR fortran/20938
	* gfortran.dg/dependency_2.f90: New test.
	* gfortran.fortran-torture/execute/where17.f90: New test.
	* gfortran.fortran-torture/execute/where18.f90: New test.
	* gfortran.fortran-torture/execute/where19.f90: New test.
	* gfortran.fortran-torture/execute/where20.f90: New test.

	PR fortran/24519
	* gfortran.dg/dependency_3.f90: New test.
	* gfortran.fortran-torture/execute/vect-3.f90: Remove two of the
	XFAILs.

	PR fortran/25395
	* gfortran.dg/equiv_6.f90: New test.

	PR fortran/25054
	* gfortran.dg/namelist_5.f90: New test.

	PR fortran/25089
	* gfortran.dg/namelist_4.f90: New test.

	PR fortran/24557
	* gfortran.dg/assumed_charlen_needed_1.f90: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/assumed_charlen_needed_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/dependency_2.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/dependency_3.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/equiv_6.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/logical_dot_product.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_4.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_5.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/pure_dummy_length_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/used_interface_ref.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.fortran-torture/execute/where17.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.fortran-torture/execute/where18.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.fortran-torture/execute/where19.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.fortran-torture/execute/where20.f90
Modified:
    branches/gcc-4_1-branch/MAINTAINERS
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/dependency.c
    branches/gcc-4_1-branch/gcc/fortran/dependency.h
    branches/gcc-4_1-branch/gcc/fortran/dump-parse-tree.c
    branches/gcc-4_1-branch/gcc/fortran/gfortran.h
    branches/gcc-4_1-branch/gcc/fortran/iresolve.c
    branches/gcc-4_1-branch/gcc/fortran/match.c
    branches/gcc-4_1-branch/gcc/fortran/resolve.c
    branches/gcc-4_1-branch/gcc/fortran/symbol.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-decl.c
    branches/gcc-4_1-branch/gcc/fortran/trans-expr.c
    branches/gcc-4_1-branch/gcc/fortran/trans-intrinsic.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/vect/vect-3.f90