This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/24978] ICE in gfc_assign_data_value_range



------- Comment #23 from dominiq at lps dot ens dot fr  2010-05-01 09:57 -------
I have applied the patch in comment #22 and it fixes all the ICE I have in
store with DATA initialization (including those remaining after the patch in
comment #19: see comment #20).

I have also found that codes such as:

SUBROUTINE data_init_matrix_invalid()
  ! full array initializer, re-initialize full array
  integer :: i(3,3)
  data       i   / 3*1, 3*2, 3*3 /
  data       i   / 9 * 1 /
END SUBROUTINE
end

are only detected with the -pedantic option. This should probably documented in
http://gcc.gnu.org/onlinedocs/gfortran/Old_002dstyle-variable-initialization.html#Old_002dstyle-variable-initialization
.

Now there is something annoying: compiling the above code with -pedantic leads
to 9 times the same warning:

Warning: Extension: re-initialization of 'i' at (1)
pr24978_4_ma_i2.f90:5.24:

  data       i   / 9 * 1 /
                        1

This is a minor inconvenience for small values of the multiplier, but is a real
problem for large ones: if I replace 9 with 100, I get 100 warnings!-(
Would it be possible to get only one warning per multiplier?

Note that

SUBROUTINE data_init_array_invalid()
  ! full array initializer, re-initialize (at least) one element
  integer :: e(3)
  data       e    / 3*1 /
  data       e(2) / 2 /
END SUBROUTINE
end

gives only one warning.

A similar problem can be seen with codes such as:

SUBROUTINE data_init_matrix_invalid()
  ! full array initializer, re-initialize full array
  integer :: j(3) = 0
  data       j   / 9 * 1 /
END SUBROUTINE
end

which gives 3 errors (without option) for j:

pr24978_4_ma_i1.f90:4.6:

  data       j   / 9 * 1 /
      1
pr24978_4_ma_i1.f90:3.19:

  integer :: j(3) = 0
                   2
Error: 'j' at (1) already is initialized at (2)
pr24978_4_ma_i1.f90:4.6:

  data       j   / 9 * 1 /
      1
pr24978_4_ma_i1.f90:3.19:

  integer :: j(3) = 0
                   2
Error: 'j' at (1) already is initialized at (2)
pr24978_4_ma_i1.f90:4.6:

  data       j   / 9 * 1 /
      1
pr24978_4_ma_i1.f90:3.19:

  integer :: j(3) = 0
                   2
Error: 'j' at (1) already is initialized at (2)
pr24978_4_ma_i1.f90:4.6:

  data       j   / 9 * 1 /
      1
Error: DATA statement at (1) has more values than variables

Final note pr36604 is a duplicate of this pr.

Thanks for the patch.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]