Bug 37691 - Duplicate error messages
Summary: Duplicate error messages
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.4.0
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2008-10-01 13:00 UTC by Dominique d'Humieres
Modified: 2009-12-12 09:33 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-03-29 08:41:02


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominique d'Humieres 2008-10-01 13:00:05 UTC
Extracted from pr36192, the following code

program three_body
  real, parameter :: n = 2, d = 2
!  real, dimension(n), parameter :: m = (/ 1.0, 1.0 /)
  real, dimension(n,d) :: x, v
!  real, dimension(n,d) :: x, v, x_n, v_n, x_hq, v_hq

end program three_body

yields the following errors

pr36192_dup.f90:4.18:

  real, dimension(n,d) :: x, v
                 1
Error: Expression at (1) must be of INTEGER type
pr36192_dup.f90:4.20:

  real, dimension(n,d) :: x, v
                   1
Error: Expression at (1) must be of INTEGER type
pr36192_dup.f90:4.30:

  real, dimension(n,d) :: x, v
                             1
Error: The module or main program array 'v' at (1) must have constant shape
pr36192_dup.f90:4.18:

  real, dimension(n,d) :: x, v
                 1
Error: Expression at (1) must be of INTEGER type
pr36192_dup.f90:4.20:

  real, dimension(n,d) :: x, v
                   1
Error: Expression at (1) must be of INTEGER type
pr36192_dup.f90:4.27:

  real, dimension(n,d) :: x, v
                          1
Error: The module or main program array 'x' at (1) must have constant shape

where the messages "Expression at (1) must be of INTEGER type" are emitted twice.

If the x_n, v_n, x_hq, v_hq arrays are added, these messages are emitted six times, as if they were delayed until the messages "The module or main program array 'v' at (1) must have constant shape" are emiited. I don't know why the "INTEGER type" error was delayed, but emitting it when it is first encountered should solve the problem.

Note that in the patch http://gcc.gnu.org/ml/gcc-patches/2008-09/msg01755.html submitted by Daniel kraft, all the "Expression at (1) must be of INTEGER type" errors were removed, making difficult to locate the primary cause of the errors (n and d declared as real).
Comment 1 Daniel Franke 2009-12-11 22:30:16 UTC
I think this one is actually ok. The message is emitted rank-times, once for each non-integer rank, for each variable. 

Here we get it three times:
  real, parameter :: n = 2
  real, dimension(n) :: x, y, z
end

Here 4*3 = 12 times:
  real, parameter :: n = 2
  real, dimension(n, n, n, n) :: x, y, z
end

Here just once:
  real, parameter :: n = 2
  real :: x, y(n), z
end

Thus, all fine?!
Comment 2 Dominique d'Humieres 2009-12-12 09:33:23 UTC
> Thus, all fine?!

Now I understand the logic. Thanks for the explanation. Closing as invalid.