+2007-09-27 Tobias Schlüter <tobi@gcc.gnu.org>
+
+ * arith.c (reduce_binary_aa): Fix capitalization.
+ * check.c (gfc_check_dot_product): Likewise.
+ (gfc_check_matmul): Likewise.
+ * expr.c (gfc_check_conformance): Likewise.
+ (gfc_check_assign): Likewise.
+ (gfc_default_initializer): Simplify logic.
+ * trans.c (gfc_msg_bounds): Make const.
+ (gfc_msg_fault): Likewise.
+ (gfc_msg_wrong_return): Likewise.
+ * trans.h: Add const to corresponding extern declarations.
+
2007-09-27 Paul Thomas <pault@gcc.gnu.org>
PR fortran/33568
rc = ARITH_OK;
d = op2->value.constructor;
- if (gfc_check_conformance ("Elemental binary operation", op1, op2)
+ if (gfc_check_conformance ("elemental binary operation", op1, op2)
!= SUCCESS)
rc = ARITH_INCOMMENSURATE;
else
if (! identical_dimen_shape (vector_a, 0, vector_b, 0))
{
- gfc_error ("different shape for arguments '%s' and '%s' at %L for "
+ gfc_error ("Different shape for arguments '%s' and '%s' at %L for "
"intrinsic 'dot_product'", gfc_current_intrinsic_arg[0],
gfc_current_intrinsic_arg[1], &vector_a->where);
return FAILURE;
/* Check for case matrix_a has shape(m), matrix_b has shape (m, k). */
if (!identical_dimen_shape (matrix_a, 0, matrix_b, 0))
{
- gfc_error ("different shape on dimension 1 for arguments '%s' "
+ gfc_error ("Different shape on dimension 1 for arguments '%s' "
"and '%s' at %L for intrinsic matmul",
gfc_current_intrinsic_arg[0],
gfc_current_intrinsic_arg[1], &matrix_a->where);
- matrix_a has shape (n,m) and matrix_b has shape (m). */
if (!identical_dimen_shape (matrix_a, 1, matrix_b, 0))
{
- gfc_error ("different shape on dimension 2 for argument '%s' and "
+ gfc_error ("Different shape on dimension 2 for argument '%s' and "
"dimension 1 for argument '%s' at %L for intrinsic "
"matmul", gfc_current_intrinsic_arg[0],
gfc_current_intrinsic_arg[1], &matrix_a->where);
if (op1_flag && op2_flag && mpz_cmp (op1_size, op2_size) != 0)
{
- gfc_error ("different shape for %s at %L on dimension %d (%d and %d)",
- _(optype_msgid), &op1->where, d + 1,
+ gfc_error ("Different shape for %s at %L on dimension %d "
+ "(%d and %d)", _(optype_msgid), &op1->where, d + 1,
(int) mpz_get_si (op1_size),
(int) mpz_get_si (op2_size));
/* Check size of array assignments. */
if (lvalue->rank != 0 && rvalue->rank != 0
- && gfc_check_conformance ("Array assignment", lvalue, rvalue) != SUCCESS)
+ && gfc_check_conformance ("array assignment", lvalue, rvalue) != SUCCESS)
return FAILURE;
if (gfc_compare_types (&lvalue->ts, &rvalue->ts))
gfc_expr *init;
gfc_component *c;
- init = NULL;
-
/* See if we have a default initializer. */
for (c = ts->derived->components; c; c = c->next)
- {
- if ((c->initializer || c->allocatable) && init == NULL)
- init = gfc_get_expr ();
- }
+ if (c->initializer || c->allocatable)
+ break;
- if (init == NULL)
+ if (!c)
return NULL;
/* Build the constructor. */
+ init = gfc_get_expr ();
init->expr_type = EXPR_STRUCTURE;
init->ts = *ts;
init->where = ts->derived->declared_at;
+
tail = NULL;
for (c = ts->derived->components; c; c = c->next)
{
static gfc_file *gfc_current_backend_file;
-char gfc_msg_bounds[] = N_("Array bound mismatch");
-char gfc_msg_fault[] = N_("Array reference out of bounds");
-char gfc_msg_wrong_return[] = N_("Incorrect function return value");
+const char gfc_msg_bounds[] = N_("Array bound mismatch");
+const char gfc_msg_fault[] = N_("Array reference out of bounds");
+const char gfc_msg_wrong_return[] = N_("Incorrect function return value");
/* Advance along TREE_CHAIN n times. */
/* Standard error messages used in all the trans-*.c files. */
-extern char gfc_msg_bounds[];
-extern char gfc_msg_fault[];
-extern char gfc_msg_wrong_return[];
+extern const char gfc_msg_bounds[];
+extern const char gfc_msg_fault[];
+extern const char gfc_msg_wrong_return[];
#endif /* GFC_TRANS_H */
+2007-09-27 Tobias Schlüter <tobi@gcc.gnu.org>
+
+ * gfortran.dg/array_initializer_3.f90: Adapt error annotations for
+ fixed capitalizations.
+ * gfortran.dg/compliant_elemental_intrinsics_1.f90: Likewise.
+ * gfortran.dg/compliant_elemental_intrinsics_2.f90: Likewise.
+ * gfortran.dg/elemental_subroutine_4.f90: Likewise.
+ * gfortran.dg/intrinsic_argument_conformance_1.f90: Likewise.
+ * gfortran.dg/maxloc_shape_1.f90: Likewise.
+ * gfortran.dg/maxval_maxloc_conformance_1.f90: Likewise.
+ * gfortran.dg/min_max_conformance.f90: Likewise.
+
2007-09-27 Richard Sandiford <rsandifo@nildram.co.uk>
* gcc.dg/c99-tgmath-1.c: Require c99_runtime and add the associated
! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
!
real, dimension(3,3), parameter :: a=reshape ((/(i, i = 1,9)/),(/3,3/))
-real, dimension(2,3) :: b=a(:2:-1,:) ! { dg-error "different shape for Array assignment" }
+real, dimension(2,3) :: b=a(:2:-1,:) ! { dg-error "Different shape for array assignment" }
real, dimension(2,3) :: c=a(3:2:-1,:)
print *, b
print *, c
pi = acos(-1.0)
b = pi
-a = cos(b) ! { dg-error "different shape for Array assignment" }
+a = cos(b) ! { dg-error "Different shape for array assignment" }
a = -pi
-b = cos(a) ! { dg-error "different shape for Array assignment" }
+b = cos(a) ! { dg-error "Different shape for array assignment" }
ch = "abcdefghijklmnopqrstuvwxyz"
-a = transfer (ch, pi, 3) ! { dg-error "different shape for Array assignment" }
+a = transfer (ch, pi, 3) ! { dg-error "Different shape for array assignment" }
! This already generated an error
-b = reshape ((/1.0/),(/1/)) ! { dg-error "different shape for Array assignment" }
+b = reshape ((/1.0/),(/1/)) ! { dg-error "Different shape for array assignment" }
end
SUBROUTINE test_2()
INTEGER :: a(2) = 0, b(3) = 0
- a = f(b) ! { dg-error "different shape" }
+ a = f(b) ! { dg-error "Different shape" }
a = f(b(1:2)) ! ok, slice, stride 1
a = f(b(1:3:2)) ! ok, slice, stride 2
END SUBROUTINE
SUBROUTINE test_4()
INTEGER :: a(2,2) = 0, b(3,3) = 0
- a = f(b) ! { dg-error "different shape" }
- a = f(b(1:3, 1:2)) ! { dg-error "different shape" }
+ a = f(b) ! { dg-error "Different shape" }
+ a = f(b(1:3, 1:2)) ! { dg-error "Different shape" }
a = f(b(1:3:2, 1:3:2)) ! ok, same shape
END SUBROUTINE
END PROGRAM
CALL S(I,J) ! { dg-error "Incompatible ranks in elemental procedure" }
! Check interface assignments
x = w ! { dg-error "Incompatible ranks in elemental procedure" }
- x = y ! { dg-error "different shape for elemental procedure" }
+ x = y ! { dg-error "Different shape for elemental procedure" }
x = z
CONTAINS
ELEMENTAL SUBROUTINE S(I,J)
real :: av(2), bv(4)
real :: a(2,2)
logical :: lo(3,2)
- print *,dot_product(av, bv) ! { dg-error "different shape" }
- print *,pack(a, lo) ! { dg-error "different shape" }
- print *,merge(av, bv, lo(1,:)) ! { dg-error "different shape" }
- print *,matmul(bv,a) ! { dg-error "different shape" }
+ print *,dot_product(av, bv) ! { dg-error "Different shape" }
+ print *,pack(a, lo) ! { dg-error "Different shape" }
+ print *,merge(av, bv, lo(1,:)) ! { dg-error "Different shape" }
+ print *,matmul(bv,a) ! { dg-error "Different shape" }
end program main
integer, dimension(0:1,0:1) :: n
integer, dimension(1) :: i
n = reshape((/1, 2, 3, 4/), shape(n))
- i = maxloc(n) ! { dg-error "different shape for Array assignment" }
- i = maxloc(n,dim=1) ! { dg-error "different shape for Array assignment" }
+ i = maxloc(n) ! { dg-error "Different shape for array assignment" }
+ i = maxloc(n,dim=1) ! { dg-error "Different shape for array assignment" }
! print *,i
end program
print *,sum(a,1,mask=lo) ! { dg-error "Incompatible ranks" }
print *,product(a,1,mask=lo) ! { dg-error "Incompatible ranks" }
- print *,minloc(a,mask=lo2) ! { dg-error "different shape" }
- print *,maxloc(a,mask=lo2) ! { dg-error "different shape" }
- print *,minval(a,mask=lo2) ! { dg-error "different shape" }
- print *,maxval(a,mask=lo2) ! { dg-error "different shape" }
- print *,sum(a,mask=lo2) ! { dg-error "different shape" }
- print *,product(a,mask=lo2) ! { dg-error "different shape" }
- print *,minloc(a,1,mask=lo2) ! { dg-error "different shape" }
- print *,maxloc(a,1,mask=lo2) ! { dg-error "different shape" }
- print *,minval(a,1,mask=lo2) ! { dg-error "different shape" }
- print *,maxval(a,1,mask=lo2) ! { dg-error "different shape" }
- print *,sum(a,1,mask=lo2) ! { dg-error "different shape" }
- print *,product(a,1,mask=lo2) ! { dg-error "different shape" }
+ print *,minloc(a,mask=lo2) ! { dg-error "Different shape" }
+ print *,maxloc(a,mask=lo2) ! { dg-error "Different shape" }
+ print *,minval(a,mask=lo2) ! { dg-error "Different shape" }
+ print *,maxval(a,mask=lo2) ! { dg-error "Different shape" }
+ print *,sum(a,mask=lo2) ! { dg-error "Different shape" }
+ print *,product(a,mask=lo2) ! { dg-error "Different shape" }
+ print *,minloc(a,1,mask=lo2) ! { dg-error "Different shape" }
+ print *,maxloc(a,1,mask=lo2) ! { dg-error "Different shape" }
+ print *,minval(a,1,mask=lo2) ! { dg-error "Different shape" }
+ print *,maxval(a,1,mask=lo2) ! { dg-error "Different shape" }
+ print *,sum(a,1,mask=lo2) ! { dg-error "Different shape" }
+ print *,product(a,1,mask=lo2) ! { dg-error "Different shape" }
end program main
r4a = amin1(r4a, r4b) ! { dg-error "Incompatible ranks" }
r8a = dmin1(r8a, r8b) ! { dg-error "Incompatible ranks" }
- i4a = max(i4b, i4c) ! { dg-error "different shape for arguments" }
- i4a = max0(i4b, i4c) ! { dg-error "different shape for arguments" }
- r4a = amax0(i4b, i4c) ! { dg-error "different shape for arguments" }
- i4a = max1(r4b, r4c) ! { dg-error "different shape for arguments" }
- r4a = amax1(r4b, r4c) ! { dg-error "different shape for arguments" }
- r8a = dmax1(r8B, r8c) ! { dg-error "different shape for arguments" }
+ i4a = max(i4b, i4c) ! { dg-error "Different shape for arguments" }
+ i4a = max0(i4b, i4c) ! { dg-error "Different shape for arguments" }
+ r4a = amax0(i4b, i4c) ! { dg-error "Different shape for arguments" }
+ i4a = max1(r4b, r4c) ! { dg-error "Different shape for arguments" }
+ r4a = amax1(r4b, r4c) ! { dg-error "Different shape for arguments" }
+ r8a = dmax1(r8B, r8c) ! { dg-error "Different shape for arguments" }
- i4a = min(i4b, i4c) ! { dg-error "different shape for arguments" }
- i4a = min0(i4b, i4c) ! { dg-error "different shape for arguments" }
- i4a = amin0(i4b, i4c) ! { dg-error "different shape for arguments" }
- r4a = min1(r4b, r4c) ! { dg-error "different shape for arguments" }
- r4a = amin1(r4b, r4c) ! { dg-error "different shape for arguments" }
- r8a = dmin1(r8b, r8c) ! { dg-error "different shape for arguments" }
+ i4a = min(i4b, i4c) ! { dg-error "Different shape for arguments" }
+ i4a = min0(i4b, i4c) ! { dg-error "Different shape for arguments" }
+ i4a = amin0(i4b, i4c) ! { dg-error "Different shape for arguments" }
+ r4a = min1(r4b, r4c) ! { dg-error "Different shape for arguments" }
+ r4a = amin1(r4b, r4c) ! { dg-error "Different shape for arguments" }
+ r8a = dmin1(r8b, r8c) ! { dg-error "Different shape for arguments" }
! checking needs to be position independent
i4a = min(i4, i4a, i4, i4b) ! { dg-error "Incompatible ranks" }
r4a = min(r4, r4a, r4, r4b) ! { dg-error "Incompatible ranks" }
r8a = min(r8, r8a, r8, r8b) ! { dg-error "Incompatible ranks" }
- i4a = min(i4, i4b, i4, i4c) ! { dg-error "different shape for arguments" }
- r4a = min(r4, r4b, r4, r4c) ! { dg-error "different shape for arguments" }
- r8a = min(r8, r8b, r8, r8c) ! { dg-error "different shape for arguments" }
+ i4a = min(i4, i4b, i4, i4c) ! { dg-error "Different shape for arguments" }
+ r4a = min(r4, r4b, r4, r4c) ! { dg-error "Different shape for arguments" }
+ r8a = min(r8, r8b, r8, r8c) ! { dg-error "Different shape for arguments" }
i4a = max(i4, i4a, i4, i4b) ! { dg-error "Incompatible ranks" }
r4a = max(r4, r4a, r4, r4b) ! { dg-error "Incompatible ranks" }
r8a = max(r8, r8a, r8, r8b) ! { dg-error "Incompatible ranks" }
- i4a = max(i4, i4b, i4, i4c) ! { dg-error "different shape for arguments" }
- r4a = max(r4, r4b, r4, r4c) ! { dg-error "different shape for arguments" }
- r8a = max(r8, r8b, r8, r8c) ! { dg-error "different shape for arguments" }
+ i4a = max(i4, i4b, i4, i4c) ! { dg-error "Different shape for arguments" }
+ r4a = max(r4, r4b, r4, r4c) ! { dg-error "Different shape for arguments" }
+ r8a = max(r8, r8b, r8, r8c) ! { dg-error "Different shape for arguments" }
end program