public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer
@ 2011-02-22 17:09 burnus at gcc dot gnu.org
  2011-02-22 17:36 ` [Bug fortran/47850] " burnus at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-02-22 17:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

           Summary: [4.6 Regression] ICE in gfc_conv_array_initializer
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


The following program is based on James' program at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/625faf82578e9af8

The only difference is that I replaced "(*)" by the bounds as otherwise one
cannot compile it with 4.5.


$ gfortran-4.5 test.f90 && ./a.out
SENSOR_CHANNEL =   10, 12, 17, 20, 22, 30, 33, 34
NLTE_CHANNEL =     20, 22, 34
N_NLTE_CHANNELS =   3
N_CHANNELS =        8
C_INDEX =           0,  0,  0,  1,  2,  0,  0,  3

$ gfortran-4.6 test.f90 && ./a.out
test.f90: In function ‘cindex’:
test.f90:23:0: internal compiler error: in gfc_conv_array_initializer, at
fortran/trans-array.c:4576


That's gfc_conv_array_initializer's
  switch (expr->expr_type)
    {
[...]
    default:
      gcc_unreachable ();

Where:

(gdb) p expr->expr_type
$1 = EXPR_FUNCTION
(gdb) p expr->value.function.isym->name
$4 = 0x2aaaaab42858 "unpack"

Thus, for some reason the unpack has not been simplified in 4.6.




program Cindex
   implicit none
   integer,parameter :: SENSOR_CHANNEL(8) = &
      [10,12,17,20,22,30,33,34]
   integer,parameter :: NLTE_CHANNEL(3) = [20,22,34]
   integer,parameter :: N_NLTE_CHANNELS = size(NLTE_CHANNEL)
   integer,parameter :: N_CHANNELS = size(SENSOR_CHANNEL)
   integer i
   integer,parameter :: C_INDEX(8) = unpack( &
      vector = [(i,i=1,size(SENSOR_CHANNEL))], &
      mask = [(any(SENSOR_CHANNEL(i) == NLTE_CHANNEL), &
         i=lbound(SENSOR_CHANNEL,1),ubound(SENSOR_CHANNEL,1))], &
      field = 0)
   character(20) fmt

   write(fmt,'(a,i0,a)') '(a,t19,',size(SENSOR_CHANNEL),'(i3:","))'
   write(*,fmt) 'SENSOR_CHANNEL = ',SENSOR_CHANNEL
   write(fmt,'(a,i0,a)') '(a,t19,',size(NLTE_CHANNEL),'(i3:","))'
   write(*,fmt) 'NLTE_CHANNEL = ',NLTE_CHANNEL
   write(*,'(a,t19,i3)') 'N_NLTE_CHANNELS = ',N_NLTE_CHANNELS
   write(*,'(a,t19,i3)') 'N_CHANNELS = ',N_CHANNELS
   write(fmt,'(a,i0,a)') '(a,t19,',size(C_INDEX),'(i3:","))'
   write(*,fmt) 'C_INDEX = ',C_INDEX
end program Cindex


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
@ 2011-02-22 17:36 ` burnus at gcc dot gnu.org
  2011-02-23  9:25 ` burnus at gcc dot gnu.org
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-02-22 17:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
   Target Milestone|---                         |4.6.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
  2011-02-22 17:36 ` [Bug fortran/47850] " burnus at gcc dot gnu.org
@ 2011-02-23  9:25 ` burnus at gcc dot gnu.org
  2011-02-23 15:18 ` pault at gcc dot gnu.org
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-02-23  9:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-02-23 09:04:03 UTC ---
The problem is that for 

   integer,parameter :: C_INDEX(8) = unpack( &
      vector = [(i,i=1,size(SENSOR_CHANNEL))], &
      mask = [(any(SENSOR_CHANNEL(i) == NLTE_CHANNEL), &
         i=lbound(SENSOR_CHANNEL,1),ubound(SENSOR_CHANNEL,1))], &

the mask is not regarded as gfc_is_constant_expr -> gfc_constant_ac.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
  2011-02-22 17:36 ` [Bug fortran/47850] " burnus at gcc dot gnu.org
  2011-02-23  9:25 ` burnus at gcc dot gnu.org
@ 2011-02-23 15:18 ` pault at gcc dot gnu.org
  2011-02-26 11:19 ` pault at gcc dot gnu.org
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pault at gcc dot gnu.org @ 2011-02-23 15:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu.org

--- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> 2011-02-23 15:00:20 UTC ---
(In reply to comment #1)
> The problem is that for 
> 
>    integer,parameter :: C_INDEX(8) = unpack( &
>       vector = [(i,i=1,size(SENSOR_CHANNEL))], &
>       mask = [(any(SENSOR_CHANNEL(i) == NLTE_CHANNEL), &
>          i=lbound(SENSOR_CHANNEL,1),ubound(SENSOR_CHANNEL,1))], &
> 
> the mask is not regarded as gfc_is_constant_expr -> gfc_constant_ac.

I just found the same thing! That's what comes of not refreshing the page :-)

Paul


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-02-23 15:18 ` pault at gcc dot gnu.org
@ 2011-02-26 11:19 ` pault at gcc dot gnu.org
  2011-03-01 10:00 ` dominiq at lps dot ens.fr
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pault at gcc dot gnu.org @ 2011-02-26 11:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> 2011-02-26 11:09:41 UTC ---
(In reply to comment #2)
> (In reply to comment #1)

It appears to be ANY that is not simplified.

program Cindex
   integer,parameter :: sc(3) =  [10,12,17], nc(2) = [10,17]
   logical, parameter :: buf(3) = [(any(sc(i) ==nc), i = 1, 3)]
   print *, buf
end program Cindex

produces:

pr47850.f90:5:0: internal compiler error: in record_reference, at
cgraphbuild.c:60

and the -fdump-tree-original shows that any has not been simplified.

-std=f95 no longer generates the error that it should:

   logical, parameter :: buf(3) = [(any(sc(i) ==nc), i = 1, 3)]
                                    1
Error: transformational intrinsic 'any' at (1) is not permitted in an
initialization expression

Paul


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-02-26 11:19 ` pault at gcc dot gnu.org
@ 2011-03-01 10:00 ` dominiq at lps dot ens.fr
  2011-03-01 10:39 ` burnus at gcc dot gnu.org
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: dominiq at lps dot ens.fr @ 2011-03-01 10:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-03-01 10:00:01 UTC ---
The regression appeared between revisions 158105 and 159105.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-03-01 10:00 ` dominiq at lps dot ens.fr
@ 2011-03-01 10:39 ` burnus at gcc dot gnu.org
  2011-03-01 10:49 ` pault at gcc dot gnu.org
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-03-01 10:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-03-01 10:39:21 UTC ---
(In reply to comment #3)
> -std=f95 no longer generates the error that it should:
>    logical, parameter :: buf(3) = [(any(sc(i) ==nc), i = 1, 3)]
>                                     1
> Error: transformational intrinsic 'any' at (1) is not permitted in an
> initialization expression

Ignoring the issue of [ ] vs. (/ /) which kicks in first: gfortran 4.4
diagnoses this, 4.5/4.6 do not.

I think one reason that the error no longer is shown is the change with regards
to constant vs. initialization expression. Fortran 2003 merged the two concepts
to the name "initialization expressions" (which were renamed to "constant
expressions" in F2008) - but in Fortran 95 not every constant expression was an
initialization expression and some places mandated an initialization
expression. F95 had:

"7.1.6.1 Constant expression"
"A constant expression is an expression in which each operation is intrinsic
and each primary is [...] (5) A transformational intrinsic function reference
where each argument is a constant
expression,"

In the same section, "initialization expressions" are defined, which do not
allows the transformational function NULL - and no other one.

Thus, it might be that the missing diagnosis is a side effect of the
F2003/F2008 support. (I think one needs to revamp that area as there are
several bugs; unfortunately, it is a tedious task.)

 * * *

Regarding the simplification, I tried the following patch, but that fails due
to the above mentioned bug/mess with gfortran's implementation of init-expr vs.
const-expr.

In particular: The gfc_is_constant_expr(e) returns false as e->value.op.op1 is
EXPR_VARIABLE (of attr.flavor FL_PARAMETER) and that function simply returns
"0" if it encounters EXPR_VARIABLE.

I sincerely believe the we do not want to touch the const/init-expr mess when
the 4.6 release is imminent.

--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -231,9 +231,17 @@ is_constant_array_expr (gfc_expr *e)
   if (e == NULL)
     return true;

-  if (e->expr_type != EXPR_ARRAY || !gfc_is_constant_expr (e))
+  if (!gfc_is_constant_expr (e))
     return false;

+  if (e->expr_type != EXPR_ARRAY)
+    {
+      if (gfc_simplify_expr (e,1) != SUCCESS)
+       return false;
+      if (e->expr_type != EXPR_ARRAY)
+       return false;
+    }
+
   for (c = gfc_constructor_first (e->value.constructor);
        c; c = gfc_constructor_next (c))
     if (c->expr->expr_type != EXPR_CONSTANT


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2011-03-01 10:39 ` burnus at gcc dot gnu.org
@ 2011-03-01 10:49 ` pault at gcc dot gnu.org
  2011-03-01 12:45 ` pault at gcc dot gnu.org
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pault at gcc dot gnu.org @ 2011-03-01 10:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |franke.daniel at gmail dot
                   |                            |com

--- Comment #6 from Paul Thomas <pault at gcc dot gnu.org> 2011-03-01 10:48:46 UTC ---
(In reply to comment #4)
> The regression appeared between revisions 158105 and 159105.

(In reply to comment #4)
> The regression appeared between revisions 158105 and 159105.

In the above revision range r158253 looks by far the most likely candidate for
this regression.  It carrys the handles jvdelisle@gcc.gnu.org and
franke.daniel@gmail.com.

I have CC'd Daniel as the principal author.

Paul


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2011-03-01 10:49 ` pault at gcc dot gnu.org
@ 2011-03-01 12:45 ` pault at gcc dot gnu.org
  2011-03-02 13:22 ` dominiq at lps dot ens.fr
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pault at gcc dot gnu.org @ 2011-03-01 12:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

--- Comment #7 from Paul Thomas <pault at gcc dot gnu.org> 2011-03-01 12:45:34 UTC ---
(In reply to comment #5)
> (In reply to comment #3)
> > -std=f95 no longer generates the error that it should:
> >    logical, parameter :: buf(3) = [(any(sc(i) ==nc), i = 1, 3)]
> >                                     1
> > Error: transformational intrinsic 'any' at (1) is not permitted in an
> > initialization expression
> 
> Ignoring the issue of [ ] vs. (/ /) which kicks in first: gfortran 4.4
> diagnoses this, 4.5/4.6 do not.
> 
> I think one reason that the error no longer is shown is the change with regards
> to constant vs. initialization expression. Fortran 2003 merged the two concepts
> to the name "initialization expressions" (which were renamed to "constant
> expressions" in F2008) - but in Fortran 95 not every constant expression was an
> initialization expression and some places mandated an initialization
> expression. F95 had:

Well regardless of the evolution of the standard, I expect that -std=f95 would
know the difference between the two.

Cheers

Paul


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2011-03-01 12:45 ` pault at gcc dot gnu.org
@ 2011-03-02 13:22 ` dominiq at lps dot ens.fr
  2011-03-05 19:13 ` jvdelisle at gcc dot gnu.org
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: dominiq at lps dot ens.fr @ 2011-03-02 13:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-03-02 13:22:14 UTC ---
(In reply to comment #6)
> (In reply to comment #4)
> > The regression appeared between revisions 158105 and 159105.
>
> In the above revision range r158253 looks by far the most likely candidate for
> this regression. 

Revision 158253 is indeed the cause of this pr: the tests compile and run with
r158252, but yields ICEs with 158253.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2011-03-02 13:22 ` dominiq at lps dot ens.fr
@ 2011-03-05 19:13 ` jvdelisle at gcc dot gnu.org
  2011-03-05 19:18 ` jvdelisle at gcc dot gnu.org
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-03-05 19:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jvdelisle at gcc dot
                   |                            |gnu.org

--- Comment #9 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-03-05 19:13:36 UTC ---
This is suspicious.  I don't see it in the ChangeLog and is probably a merge
artifact.

http://gcc.gnu.org/viewcvs/trunk/gcc/fortran/arith.c?r1=155179&r2=158253&pathrev=158253


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2011-03-05 19:13 ` jvdelisle at gcc dot gnu.org
@ 2011-03-05 19:18 ` jvdelisle at gcc dot gnu.org
  2011-03-06 14:59 ` jvdelisle at gcc dot gnu.org
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-03-05 19:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

--- Comment #10 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-03-05 19:17:58 UTC ---
(In reply to comment #9)
> This is suspicious.  I don't see it in the ChangeLog and is probably a merge
> artifact.
> 
> http://gcc.gnu.org/viewcvs/trunk/gcc/fortran/arith.c?r1=155179&r2=158253&pathrev=158253

Sorry, I now see it further down in the Log, however it does touch on OP stuff
so it still may be related.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2011-03-05 19:18 ` jvdelisle at gcc dot gnu.org
@ 2011-03-06 14:59 ` jvdelisle at gcc dot gnu.org
  2011-03-06 15:17 ` jvdelisle at gcc dot gnu.org
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-03-06 14:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

--- Comment #11 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-03-06 14:59:05 UTC ---
Info: Does not fix it but why this behavior with the test case?

Index: expr.c
===================================================================
--- expr.c    (revision 170543)
+++ expr.c    (working copy)
@@ -946,6 +946,7 @@ gfc_is_constant_expr (gfc_expr *e)
       return 1;

     case EXPR_ARRAY:
+      /* return 1 here and it works. */
       return gfc_constant_ac (e);

     default:


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2011-03-06 14:59 ` jvdelisle at gcc dot gnu.org
@ 2011-03-06 15:17 ` jvdelisle at gcc dot gnu.org
  2011-03-06 16:19 ` pault at gcc dot gnu.org
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-03-06 15:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

--- Comment #12 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-03-06 15:16:46 UTC ---
Passes:
    case EXPR_ARRAY:
      /* return 1 here and it works. */
      /* gfc_constant_ac (e); */
      return 1;
Fails:
    case EXPR_ARRAY:
      /* return 1 here and it works. */
      gfc_constant_ac (e);
      return 1;


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2011-03-06 15:17 ` jvdelisle at gcc dot gnu.org
@ 2011-03-06 16:19 ` pault at gcc dot gnu.org
  2011-03-06 20:15 ` pault at gcc dot gnu.org
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pault at gcc dot gnu.org @ 2011-03-06 16:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

--- Comment #13 from Paul Thomas <pault at gcc dot gnu.org> 2011-03-06 16:19:02 UTC ---
(In reply to comment #12)
Jerry,

Based in this and comment #11, I noted that the place where this was failing
was iterator-free EXPR_ARRAYs.  I then leapt to the following patch, which is
just now regtesting (it's up to typebound_generic_4.f03):

Index: /svn/trunk/gcc/fortran/expr.c
===================================================================
*** /svn/trunk/gcc/fortran/expr.c    (revision 170337)
--- /svn/trunk/gcc/fortran/expr.c    (working copy)
*************** gfc_is_constant_expr (gfc_expr *e)
*** 937,952 ****
        return e->ref == NULL || (gfc_is_constant_expr (e->ref->u.ss.start)
                  && gfc_is_constant_expr (e->ref->u.ss.end));

      case EXPR_STRUCTURE:
!       for (c = gfc_constructor_first (e->value.constructor);
!        c; c = gfc_constructor_next (c))
      if (!gfc_is_constant_expr (c->expr))
        return 0;

        return 1;

-     case EXPR_ARRAY:
-       return gfc_constant_ac (e);

      default:
        gfc_internal_error ("gfc_is_constant_expr(): Unknown expression type");
--- 937,954 ----
        return e->ref == NULL || (gfc_is_constant_expr (e->ref->u.ss.start)
                  && gfc_is_constant_expr (e->ref->u.ss.end));

+     case EXPR_ARRAY:
      case EXPR_STRUCTURE:
!       c = gfc_constructor_first (e->value.constructor);
!       if ((e->expr_type == EXPR_ARRAY) && c && c->iterator)
!         return gfc_constant_ac (e);
! 
!       for (; c; c = gfc_constructor_next (c))
      if (!gfc_is_constant_expr (c->expr))
        return 0;

        return 1;


      default:
        gfc_internal_error ("gfc_is_constant_expr(): Unknown expression type");


Cheers

Paul


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2011-03-06 16:19 ` pault at gcc dot gnu.org
@ 2011-03-06 20:15 ` pault at gcc dot gnu.org
  2011-03-06 20:20 ` pault at gcc dot gnu.org
  2011-03-07 10:07 ` dominiq at lps dot ens.fr
  16 siblings, 0 replies; 18+ messages in thread
From: pault at gcc dot gnu.org @ 2011-03-06 20:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

--- Comment #14 from Paul Thomas <pault at gcc dot gnu.org> 2011-03-06 20:15:42 UTC ---
Author: pault
Date: Sun Mar  6 20:15:38 2011
New Revision: 170720

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170720
Log:
2011-03-06  Paul Thomas  <pault@gcc.gnu.org>
        Jerry DeLisle  <jvdelisle@gcc.gnu.org>

    PR fortran/47850
    * expr.c (gfc_is_constant_expr): Only use gfc_constant_ac if
    the expression has an iterator.  Otherwise, iterate through the
    array, checking for constant expressions for each element.

2011-03-06  Paul Thomas  <pault@gcc.gnu.org>
        Jerry DeLisle  <jvdelisle@gcc.gnu.org>

    PR fortran/47850
    * gfortran.dg/array_constructor_37.f90 : New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/array_constructor_37.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
                   ` (14 preceding siblings ...)
  2011-03-06 20:15 ` pault at gcc dot gnu.org
@ 2011-03-06 20:20 ` pault at gcc dot gnu.org
  2011-03-07 10:07 ` dominiq at lps dot ens.fr
  16 siblings, 0 replies; 18+ messages in thread
From: pault at gcc dot gnu.org @ 2011-03-06 20:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED

--- Comment #15 from Paul Thomas <pault at gcc dot gnu.org> 2011-03-06 20:20:31 UTC ---
Fixed on trunk.

Thanks for the report.

Paul


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer
  2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
                   ` (15 preceding siblings ...)
  2011-03-06 20:20 ` pault at gcc dot gnu.org
@ 2011-03-07 10:07 ` dominiq at lps dot ens.fr
  16 siblings, 0 replies; 18+ messages in thread
From: dominiq at lps dot ens.fr @ 2011-03-07 10:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47850

--- Comment #16 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-03-07 10:07:00 UTC ---
I think the -std=f95 issue mentioned in comment #5 is pr41165.


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-03-07 10:07 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-22 17:09 [Bug fortran/47850] New: [4.6 Regression] ICE in gfc_conv_array_initializer burnus at gcc dot gnu.org
2011-02-22 17:36 ` [Bug fortran/47850] " burnus at gcc dot gnu.org
2011-02-23  9:25 ` burnus at gcc dot gnu.org
2011-02-23 15:18 ` pault at gcc dot gnu.org
2011-02-26 11:19 ` pault at gcc dot gnu.org
2011-03-01 10:00 ` dominiq at lps dot ens.fr
2011-03-01 10:39 ` burnus at gcc dot gnu.org
2011-03-01 10:49 ` pault at gcc dot gnu.org
2011-03-01 12:45 ` pault at gcc dot gnu.org
2011-03-02 13:22 ` dominiq at lps dot ens.fr
2011-03-05 19:13 ` jvdelisle at gcc dot gnu.org
2011-03-05 19:18 ` jvdelisle at gcc dot gnu.org
2011-03-06 14:59 ` jvdelisle at gcc dot gnu.org
2011-03-06 15:17 ` jvdelisle at gcc dot gnu.org
2011-03-06 16:19 ` pault at gcc dot gnu.org
2011-03-06 20:15 ` pault at gcc dot gnu.org
2011-03-06 20:20 ` pault at gcc dot gnu.org
2011-03-07 10:07 ` dominiq at lps dot ens.fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).