Bug 42999 - [4.5 Regression] bogus error: Parameter 'i' at (1) has not been declared or is a variable, which does not reduce to a constant expression
Summary: [4.5 Regression] bogus error: Parameter 'i' at (1) has not been declared or i...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.5.0
: P4 normal
Target Milestone: 4.5.0
Assignee: Jerry DeLisle
URL:
Keywords: rejects-valid
Depends on:
Blocks: 32834
  Show dependency treegraph
 
Reported: 2010-02-08 14:50 UTC by Joost VandeVondele
Modified: 2010-02-10 08:52 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.4.2
Known to fail: 4.5.0
Last reconfirmed: 2010-02-09 03:41:40


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2010-02-08 14:50:38 UTC
This could should compile, I believe

 TYPE DD
  INTEGER :: I
 END TYPE DD
 TYPE(DD) :: X(2)=(/(DD(I),I=1,2)/)
 END

but does not with current 4.5 trunk, fails with:

Error: Parameter 'i' at (1) has not been declared or is a variable, which does not reduce to a constant expression
Comment 1 Tobias Burnus 2010-02-08 15:01:28 UTC
I think it regressed between 2010-01-07-r155688 and 2010-01-10-r155780

Jerry, I think that is due to your initializer patch:

r155769 | jvdelisle | 2010-01-09 18:47:04 +0100 (Sat, 09 Jan 2010) | 18 lines
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155769

2010-01-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>

        PR fortran/20923
        PR fortran/32489
[...]
        * resolve.c (gfc_is_expandable_expr): New function that determiners if
        array expressions should have their constructors expanded.
        (gfc_resolve_expr): Use new function to determine whether or not to call
        gfc_expand_constructor.
Comment 2 Dominique d'Humieres 2010-02-08 15:02:30 UTC
The code compiles also with fortran-exp revision 156589.
Comment 3 Jerry DeLisle 2010-02-09 03:41:40 UTC
I was being a bit too aggressive. The following patch fixes it.  The problem does not exist on fortran-exp. I removed my original patch from the branch since handling of constructors is being revamped completely. The fortran-dev branch will pick this up on the next merge from trunk.

Regression tested fine and I will commit tomorrow evening (PST)

Index: array.c
===================================================================
--- array.c	(revision 156592)
+++ array.c	(working copy)
@@ -1522,8 +1522,7 @@ gfc_constant_ac (gfc_expr *e)
   rc = SUCCESS;
 
   if (e->value.constructor
-      && e->value.constructor->expr->expr_type == EXPR_ARRAY 
-      && !e->value.constructor->iterator)
+      && e->value.constructor->expr->expr_type == EXPR_ARRAY)
     {
       /* Expand the constructor.  */
       iter_stack = NULL;
Comment 4 Jerry DeLisle 2010-02-10 03:31:24 UTC
Subject: Bug 42999

Author: jvdelisle
Date: Wed Feb 10 03:31:02 2010
New Revision: 156642

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156642
Log:
2010-02-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR fortran/42999
	* array.c (gfc_constant_ac): Do not prevent expansion of constructors
	with iterators.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/array.c

Comment 5 Jerry DeLisle 2010-02-10 03:34:49 UTC
Subject: Bug 42999

Author: jvdelisle
Date: Wed Feb 10 03:34:33 2010
New Revision: 156643

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156643
Log:
2010-02-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR fortran/42999
	* gfortran.dg/array_constructor_35.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/array_constructor_35.f90
Modified:
    trunk/gcc/testsuite/ChangeLog

Comment 6 Joost VandeVondele 2010-02-10 08:52:57 UTC
closing as fixed after the commit by Jerry DeLisle
Comment 7 hjl@gcc.gnu.org 2010-02-23 17:04:25 UTC
Subject: Bug 42999

Author: hjl
Date: Tue Feb 23 17:02:26 2010
New Revision: 157010

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157010
Log:
Backport testcases from mainline.

2010-02-23  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2010-02-22  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42749
	* gcc.c-torture/compile/pr42749.c: New testcase.

	2010-02-21  Dodji Seketeli  <dodji@redhat.com>

	PR c++/42824
	* g++.dg/template/memclass4.C: New test.

	2010-02-20  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/43111
	* gfortran.dg/internal_pack_8.f90: New test.

	2010-02-18  Jason Merrill  <jason@redhat.com>

	PR c++/43109
	* g++.dg/parse/namespace12.C: New.

	2010-02-18  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/43066
	* gcc.c-torture/compile/pr43066.c: New test.

	2010-02-17  Jason Merrill  <jason@redhat.com>

	PR c++/43069
	* g++.dg/parse/namespace11.C: New.

	PR c++/43093
	* g++.dg/ext/attrib37.C: New.

	PR c++/43079
	* g++.dg/template/ptrmem20.C: New.

	2010-02-16  Jason Merrill  <jason@redhat.com>

	PR c++/43031
	* g++.dg/ext/attrib36.C: New.

	2010-02-15  Richard Guenther  <rguenther@suse.de>

	PR middle-end/43068
	* g++.dg/torture/pr43068.C: New testcase.

	2010-02-11  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42998
	* gcc.c-torture/compile/pr42998.c: New testcase.

	2010-02-10  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/43017
	* gcc.dg/torture/pr43017.c: New testcase.

	2010-02-10  Richard Guenther  <rguenther@suse.de>

	PR c/43007
	* gcc.c-torture/execute/20100209-1.c: New testcase.
	* gcc.dg/fold-div-3.c: Likewise.

	2010-02-09  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/42999
	* gfortran.dg/array_constructor_35.f90: New test.

	2010-02-09  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/43008
	* gcc.c-torture/execute/pr43008.c: New testcase.

	2010-02-09  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/43000
	* gcc.dg/torture/pr43000.c: New testcase.
	* gcc.dg/torture/pr43002.c: Likewise.

	2010-02-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/42742
	* gfortran.dg/fmt_cache_2.f: New test.

	2010-02-03  Jason Merrill  <jason@redhat.com>

	PR c++/42870
	* g++.dg/ext/dllexport3.C: New.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/ext/attrib36.C
      - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/ext/attrib36.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/ext/attrib37.C
      - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/ext/attrib37.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/ext/dllexport3.C
      - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/ext/dllexport3.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/parse/namespace11.C
      - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/parse/namespace11.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/parse/namespace12.C
      - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/parse/namespace12.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/memclass4.C
      - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/template/memclass4.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/ptrmem20.C
      - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/template/ptrmem20.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr43068.C
      - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/torture/pr43068.C
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42749.c
      - copied unchanged from r157009, trunk/gcc/testsuite/gcc.c-torture/compile/pr42749.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42998.c
      - copied unchanged from r157009, trunk/gcc/testsuite/gcc.c-torture/compile/pr42998.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr43066.c
      - copied unchanged from r157009, trunk/gcc/testsuite/gcc.c-torture/compile/pr43066.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/20100209-1.c
      - copied unchanged from r157009, trunk/gcc/testsuite/gcc.c-torture/execute/20100209-1.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr43008.c
      - copied unchanged from r157009, trunk/gcc/testsuite/gcc.c-torture/execute/pr43008.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/fold-div-3.c
      - copied unchanged from r157009, trunk/gcc/testsuite/gcc.dg/fold-div-3.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/pr43000.c
      - copied unchanged from r157009, trunk/gcc/testsuite/gcc.dg/torture/pr43000.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/pr43002.c
      - copied unchanged from r157009, trunk/gcc/testsuite/gcc.dg/torture/pr43002.c
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/array_constructor_35.f90
      - copied unchanged from r157009, trunk/gcc/testsuite/gfortran.dg/array_constructor_35.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/fmt_cache_2.f
      - copied unchanged from r157009, trunk/gcc/testsuite/gfortran.dg/fmt_cache_2.f
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/internal_pack_8.f90
      - copied unchanged from r157009, trunk/gcc/testsuite/gfortran.dg/internal_pack_8.f90
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog