diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d04897eabfa..5045220f038 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2012-12-28 Janus Weil + + PR fortran/55692 + * check.c (gfc_check_associated): Remove a "gcc_assert (0)". + 2012-12-28 Tobias Burnus PR fortran/55763 diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 0923f121215..4e8b046439d 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -895,12 +895,10 @@ gfc_check_associated (gfc_expr *pointer, gfc_expr *target) where = &pointer->where; - if (pointer->expr_type == EXPR_VARIABLE || pointer->expr_type == EXPR_FUNCTION) - attr1 = gfc_expr_attr (pointer); - else if (pointer->expr_type == EXPR_NULL) + if (pointer->expr_type == EXPR_NULL) goto null_arg; - else - gcc_assert (0); /* Pointer must be a variable or a function. */ + + attr1 = gfc_expr_attr (pointer); if (!attr1.pointer && !attr1.proc_pointer) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 38935dc13fa..bf786b1878c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-12-28 Janus Weil + + PR fortran/55692 + * gfortran.dg/associated_7.f90: New. + 2012-12-28 Tobias Burnus PR fortran/55763 diff --git a/gcc/testsuite/gfortran.dg/associated_7.f90 b/gcc/testsuite/gfortran.dg/associated_7.f90 new file mode 100644 index 00000000000..bc56f84c858 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/associated_7.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! +! PR 55692: ICE on incorrect use of ASSOCIATED function +! +! Contributed by Gilbert Scott + +INTEGER, POINTER :: P1, P2 +PRINT *, ASSOCIATED([P1,P2]) ! { dg-error "must be a POINTER" } +END