re PR fortran/25018 (Segfault with simple expression)
2005-12-18 Paul Thomas <pault@gcc.gnu.org> PR fortran/25018 *expr.c(check_inquiry): Return FAILURE if there is no symtree to provide a name. Error/warning for assumed character length argument to LEN for an initialization expression, using GFC_GNU_STD. Add an argument to flag that the expression is not restricted. (check_init_expr): Improve the message for a failing variable. (gfc_match_init_expr): Call check_enquiry again to make sure that unsimplified expressions are not causing unnecessary errors. 2005-12-18 Paul Thomas <pault@gcc.gnu.org> PR fortran/25018 *gfortran.dg/initialization_1.f90: New test. *gfortran.dg/enum_5.f90: Change dg-error to new message. *gfortran.dg/g77/980616-0.f: The same. From-SVN: r108753
This commit is contained in:
parent
ab9a1ff8ee
commit
e7f79e123c
|
@ -1,74 +1,3 @@
|
|||
2005-12-16 Kazu Hirata <kazu@codesourcery.com>
|
||||
|
||||
* parser.c, pt.c: Fix comment typos.
|
||||
|
||||
2005-12-13 Petr Machata <machata@post.cz>
|
||||
|
||||
PR c++/24907
|
||||
* parser.c (cp_parser_simple_declaration): Require comma at the
|
||||
beginning of processing second and later declarators, instead of
|
||||
allowing the comma at the end of each iteration.
|
||||
|
||||
2005-12-12 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/25300
|
||||
* tree.c (build_qualified_name): Return error_mark_node for
|
||||
erroneous input.
|
||||
|
||||
2005-12-10 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/25337
|
||||
* pt.c (tsubst_copy_and_build): Permit dependent types for the
|
||||
object in a class member access expression.
|
||||
|
||||
2005-12-10 Terry Laurenzo <tlaurenzo@gmail.com>
|
||||
|
||||
PR java/9861
|
||||
* mangle.c (write_bare_function_type): Mangle return type for
|
||||
methods of Java classes
|
||||
|
||||
2005-12-08 Théodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
|
||||
|
||||
* call.c (build_conditional_expr): Print types in error messages.
|
||||
|
||||
2005-12-07 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
|
||||
|
||||
* expr.c (cxx_expand_expr): Call gcc_unreachable instead of abort.
|
||||
|
||||
2005-12-07 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
|
||||
|
||||
* cp-gimplify.c (gimplify_cp_loop): Use fold_build3.
|
||||
|
||||
2005-12-07 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
|
||||
|
||||
* Make-lang.in (c++.all.build, c++.install-normal): Remove.
|
||||
|
||||
2005-12-07 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
|
||||
|
||||
* Make-lang.in: Remove all dependencies on s-gtype.
|
||||
|
||||
2005-12-06 Aldy Hernandez <aldyh@redhat.com>
|
||||
|
||||
PR C++/24138
|
||||
* decl.c (reshape_init_array_1): Handle max_index of -1.
|
||||
|
||||
2005-12-06 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* typeck.c (build_binary_op): Issue warning if either operand of a
|
||||
comparison operator is a string literal, except for testing equality
|
||||
or inequality against NULL.
|
||||
|
||||
2005-12-06 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
PR c++/25263
|
||||
* decl.c (compute_array_index_type): Check that itype is an
|
||||
INTEGER_CST node before testing/clearing TREE_OVERFLOW.
|
||||
|
||||
2005-12-05 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* ptree.c (cxx_print_decl): Update to check for decl_common
|
||||
structure.
|
||||
|
||||
2005-12-02 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/24173
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
2005-12-18 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/25018
|
||||
*expr.c(check_inquiry): Return FAILURE if there is no symtree to
|
||||
provide a name. Error/warning for assumed character length argument
|
||||
to LEN for an initialization expression, using GFC_GNU_STD. Add an
|
||||
argument to flag that the expression is not restricted.
|
||||
(check_init_expr): Improve the message for a failing variable.
|
||||
(gfc_match_init_expr): Call check_enquiry again to make sure that
|
||||
unsimplified expressions are not causing unnecessary errors.
|
||||
|
||||
2005-12-17 Steven G. Kargl <kargls@comcast.net>
|
||||
Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
|
||||
|
||||
|
|
|
@ -1365,7 +1365,7 @@ not_numeric:
|
|||
this problem here. */
|
||||
|
||||
static try
|
||||
check_inquiry (gfc_expr * e)
|
||||
check_inquiry (gfc_expr * e, int not_restricted)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
|
@ -1379,6 +1379,10 @@ check_inquiry (gfc_expr * e)
|
|||
|
||||
int i;
|
||||
|
||||
/* An undeclared parameter will get us here (PR25018). */
|
||||
if (e->symtree == NULL)
|
||||
return FAILURE;
|
||||
|
||||
name = e->symtree->n.sym->name;
|
||||
|
||||
for (i = 0; inquiry_function[i]; i++)
|
||||
|
@ -1407,6 +1411,15 @@ check_inquiry (gfc_expr * e)
|
|||
e->ts = e->symtree->n.sym->ts;
|
||||
}
|
||||
|
||||
/* Assumed character length will not reduce to a constant expression
|
||||
with LEN, as required by the standard. */
|
||||
if (i == 4 && not_restricted
|
||||
&& e->symtree->n.sym->ts.type == BT_CHARACTER
|
||||
&& e->symtree->n.sym->ts.cl->length == NULL)
|
||||
gfc_notify_std (GFC_STD_GNU, "assumed character length "
|
||||
"variable '%s' in constant expression at %L",
|
||||
e->symtree->n.sym->name, &e->where);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1440,7 +1453,7 @@ check_init_expr (gfc_expr * e)
|
|||
case EXPR_FUNCTION:
|
||||
t = SUCCESS;
|
||||
|
||||
if (check_inquiry (e) != SUCCESS)
|
||||
if (check_inquiry (e, 1) != SUCCESS)
|
||||
{
|
||||
t = SUCCESS;
|
||||
for (ap = e->value.function.actual; ap; ap = ap->next)
|
||||
|
@ -1478,7 +1491,8 @@ check_init_expr (gfc_expr * e)
|
|||
break;
|
||||
}
|
||||
|
||||
gfc_error ("Variable '%s' at %L cannot appear in an initialization "
|
||||
gfc_error ("Parameter '%s' at %L has not been declared or is "
|
||||
"a variable, which does not reduce to a constant "
|
||||
"expression", e->symtree->n.sym->name, &e->where);
|
||||
t = FAILURE;
|
||||
break;
|
||||
|
@ -1557,8 +1571,14 @@ gfc_match_init_expr (gfc_expr ** result)
|
|||
return MATCH_ERROR;
|
||||
}
|
||||
|
||||
if (!gfc_is_constant_expr (expr))
|
||||
gfc_internal_error ("Initialization expression didn't reduce %C");
|
||||
/* Not all inquiry functions are simplified to constant expressions
|
||||
so it is necessary to call check_inquiry again. */
|
||||
if (!gfc_is_constant_expr (expr)
|
||||
&& check_inquiry (expr, 1) == FAILURE)
|
||||
{
|
||||
gfc_error ("Initialization expression didn't reduce %C");
|
||||
return MATCH_ERROR;
|
||||
}
|
||||
|
||||
*result = expr;
|
||||
|
||||
|
@ -1637,7 +1657,7 @@ static try
|
|||
restricted_intrinsic (gfc_expr * e)
|
||||
{
|
||||
/* TODO: Check constraints on inquiry functions. 7.1.6.2 (7). */
|
||||
if (check_inquiry (e) == SUCCESS)
|
||||
if (check_inquiry (e, 0) == SUCCESS)
|
||||
return SUCCESS;
|
||||
|
||||
return restricted_args (e->value.function.actual);
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2005-12-18 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/25018
|
||||
*gfortran.dg/initialization_1.f90: New test.
|
||||
*gfortran.dg/enum_5.f90: Change dg-error to new message.
|
||||
*gfortran.dg/g77/980616-0.f: The same.
|
||||
|
||||
2005-12-17 Steven G. Kargl <kargls@comcast.net>
|
||||
|
||||
* PR fortran/25458
|
||||
|
|
|
@ -6,7 +6,7 @@ program main
|
|||
integer :: i = 1
|
||||
|
||||
enum, bind (c) ! { dg-warning "New in Fortran 2003" }
|
||||
enumerator :: red, black = i ! { dg-error "cannot appear" }
|
||||
enumerator :: red, black = i ! { dg-error "is a variable" }
|
||||
enumerator :: blue = 1
|
||||
end enum junk ! { dg-error "Syntax error" }
|
||||
|
||||
|
|
|
@ -5,6 +5,6 @@ c { dg-do compile }
|
|||
* Date: Mon, 15 Jun 1998 21:54:32 -0500
|
||||
* From: Ian A Watson <WATSON_IAN_A@lilly.com>
|
||||
* Subject: Mangler Crash
|
||||
EQUIVALENCE(I,glerf(P)) ! { dg-error "cannot appear" "cannot appear" }
|
||||
EQUIVALENCE(I,glerf(P)) ! { dg-error "is a variable" "is a variable" }
|
||||
COMMON /foo/ glerf(3)
|
||||
c { dg-error "end of file" "end of file" { target *-*-* } 0 }
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
!==================initialization_1.f90======================
|
||||
|
||||
! { dg-do compile }
|
||||
! Tests fix for PR25018 in which an ICE resulted from using a
|
||||
! variable in a parameter initialization expression. In the course
|
||||
! of developing the fix, various other constraints and limitations
|
||||
! were tested.
|
||||
!
|
||||
! Contributed by Paul Thomas <pault@gcc.gnu.org>
|
||||
!
|
||||
module const
|
||||
! The next line is the original error
|
||||
real(8), parameter :: g = - sqrt(2._8) * Gf ! { dg-error "not been declared or is a variable" }
|
||||
contains
|
||||
subroutine foo(ch1, x, y)
|
||||
character(*) :: ch1
|
||||
|
||||
! This is OK because it is a restricted expression.
|
||||
character(len(ch1)) :: ch2
|
||||
|
||||
real(8) :: x (1:2, *)
|
||||
real(8) :: y (0:,:)
|
||||
|
||||
! However, this gives a warning because it is an initialization expression.
|
||||
integer :: l1 = len (ch1) ! { dg-warning "assumed character length variable" }
|
||||
|
||||
! Dependence on upper bound of final dimension of assumed size array knocks these out.
|
||||
integer :: m1 = size (x, 2) ! { dg-error "not a valid dimension index" }
|
||||
integer :: m2(2) = shape (x) ! { dg-error "assumed size array" }
|
||||
|
||||
! These are warnings because they are gfortran extensions.
|
||||
integer :: m3 = size (x, 1) ! { dg-warning "Evaluation of nonstandard initialization" }
|
||||
integer :: m4(2) = shape (z) ! { dg-warning "Evaluation of nonstandard initialization" }
|
||||
|
||||
! This does not depend on non-constant properties.
|
||||
real(8) :: big = huge (x)
|
||||
end subroutine foo
|
||||
end module const
|
Loading…
Reference in New Issue