From 6e45f57bf38ac4ca36f085a27729ebc25856333e Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Wed, 8 Sep 2004 14:33:03 +0000 Subject: [PATCH] array.c: Don't include assert.h. * array.c: Don't include assert.h. * data.c: Don't include assert.h. Replace assert and abort with gcc_assert and gcc_unreachable. * dependency.c: Ditto. * f95-lang.c: Ditto. * iresolve.c: Ditto. * resolve.c: Ditto. * simplify.c: Ditto. * symbol.c: Ditto. * trans-array.c: Ditto. * trans-common.c: Ditto. * trans-const.c: Ditto. * trans-decl.c: Ditto. * trans-expr.c: Ditto. * trans-intrinsic.c: Ditto. * trans-io.c: Ditto. * trans-stmt.c: Ditto. * trans-types.c: Ditto. * trans.c: Ditto. From-SVN: r87187 --- gcc/fortran/ChangeLog | 22 ++++ gcc/fortran/array.c | 1 - gcc/fortran/data.c | 35 +++--- gcc/fortran/dependency.c | 23 ++-- gcc/fortran/f95-lang.c | 1 - gcc/fortran/iresolve.c | 1 - gcc/fortran/resolve.c | 15 ++- gcc/fortran/simplify.c | 8 +- gcc/fortran/symbol.c | 3 +- gcc/fortran/trans-array.c | 196 +++++++++++++++++----------------- gcc/fortran/trans-common.c | 5 +- gcc/fortran/trans-const.c | 25 +++-- gcc/fortran/trans-decl.c | 76 +++++++------ gcc/fortran/trans-expr.c | 125 ++++++++++------------ gcc/fortran/trans-intrinsic.c | 118 ++++++++++---------- gcc/fortran/trans-io.c | 23 ++-- gcc/fortran/trans-stmt.c | 37 +++---- gcc/fortran/trans-types.c | 44 ++++---- gcc/fortran/trans.c | 24 ++--- 19 files changed, 381 insertions(+), 401 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b8572d87001..3153282dabf 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,25 @@ +2004-09-08 Paul Brook + + * array.c: Don't include assert.h. + * data.c: Don't include assert.h. Replace assert and abort with + gcc_assert and gcc_unreachable. + * dependency.c: Ditto. + * f95-lang.c: Ditto. + * iresolve.c: Ditto. + * resolve.c: Ditto. + * simplify.c: Ditto. + * symbol.c: Ditto. + * trans-array.c: Ditto. + * trans-common.c: Ditto. + * trans-const.c: Ditto. + * trans-decl.c: Ditto. + * trans-expr.c: Ditto. + * trans-intrinsic.c: Ditto. + * trans-io.c: Ditto. + * trans-stmt.c: Ditto. + * trans-types.c: Ditto. + * trans.c: Ditto. + 2004-09-07 Per Bothner Paul Brook diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index c7fc8bbccf7..37747a62c83 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -24,7 +24,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "match.h" #include -#include /* This parameter is the size of the largest array constructor that we will expand to an array constructor without iterators. diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c index 2999af2a860..ceb6f318667 100644 --- a/gcc/fortran/data.c +++ b/gcc/fortran/data.c @@ -35,7 +35,6 @@ Software Foundation, 59 Temple Place - Suite 330,Boston, MA #include "config.h" #include "gfortran.h" -#include "assert.h" static void formalize_init_expr (gfc_expr *); @@ -168,7 +167,7 @@ create_character_intializer (gfc_expr * init, gfc_typespec * ts, if (ref) { - assert (ref->type == REF_SUBSTRING); + gcc_assert (ref->type == REF_SUBSTRING); /* Only set a substring of the destination. Fortran substring bounds are one-based [start, end], we want zero based [start, end). */ @@ -225,7 +224,7 @@ gfc_assign_data_value (gfc_expr * lvalue, gfc_expr * rvalue, mpz_t index) if (ref->type == REF_SUBSTRING) { /* A substring should always br the last subobject reference. */ - assert (ref->next == NULL); + gcc_assert (ref->next == NULL); break; } @@ -250,7 +249,7 @@ gfc_assign_data_value (gfc_expr * lvalue, gfc_expr * rvalue, mpz_t index) expr->rank = ref->u.ar.as->rank; } else - assert (expr->expr_type == EXPR_ARRAY); + gcc_assert (expr->expr_type == EXPR_ARRAY); if (ref->u.ar.type == AR_ELEMENT) get_array_index (&ref->u.ar, &offset); @@ -279,7 +278,7 @@ gfc_assign_data_value (gfc_expr * lvalue, gfc_expr * rvalue, mpz_t index) expr->ts.derived = ref->u.c.sym; } else - assert (expr->expr_type == EXPR_STRUCTURE); + gcc_assert (expr->expr_type == EXPR_STRUCTURE); last_ts = &ref->u.c.component->ts; /* Find the same element in the existing constructor. */ @@ -297,7 +296,7 @@ gfc_assign_data_value (gfc_expr * lvalue, gfc_expr * rvalue, mpz_t index) break; default: - abort (); + gcc_unreachable (); } if (init == NULL) @@ -317,7 +316,7 @@ gfc_assign_data_value (gfc_expr * lvalue, gfc_expr * rvalue, mpz_t index) else { /* We should never be overwriting an existing initializer. */ - assert (!init); + gcc_assert (!init); expr = gfc_copy_expr (rvalue); if (!gfc_compare_types (&lvalue->ts, &expr->ts)) @@ -375,7 +374,7 @@ gfc_assign_data_value_range (gfc_expr * lvalue, gfc_expr * rvalue, expr->rank = ref->u.ar.as->rank; } else - assert (expr->expr_type == EXPR_ARRAY); + gcc_assert (expr->expr_type == EXPR_ARRAY); if (ref->u.ar.type == AR_ELEMENT) { @@ -383,7 +382,7 @@ gfc_assign_data_value_range (gfc_expr * lvalue, gfc_expr * rvalue, /* This had better not be the bottom of the reference. We can still get to a full array via a component. */ - assert (ref->next != NULL); + gcc_assert (ref->next != NULL); } else { @@ -392,8 +391,8 @@ gfc_assign_data_value_range (gfc_expr * lvalue, gfc_expr * rvalue, /* We're at a full array or an array section. This means that we've better have found a full array, and that we're at the bottom of the reference. */ - assert (ref->u.ar.type == AR_FULL); - assert (ref->next == NULL); + gcc_assert (ref->u.ar.type == AR_FULL); + gcc_assert (ref->next == NULL); } /* Find the same element in the existing constructor. */ @@ -410,7 +409,7 @@ gfc_assign_data_value_range (gfc_expr * lvalue, gfc_expr * rvalue, gfc_insert_constructor (expr, con); } else - assert (ref->next != NULL); + gcc_assert (ref->next != NULL); break; case REF_COMPONENT: @@ -422,7 +421,7 @@ gfc_assign_data_value_range (gfc_expr * lvalue, gfc_expr * rvalue, expr->ts.derived = ref->u.c.sym; } else - assert (expr->expr_type == EXPR_STRUCTURE); + gcc_assert (expr->expr_type == EXPR_STRUCTURE); last_ts = &ref->u.c.component->ts; /* Find the same element in the existing constructor. */ @@ -440,12 +439,12 @@ gfc_assign_data_value_range (gfc_expr * lvalue, gfc_expr * rvalue, /* Since we're only intending to initialize arrays here, there better be an inner reference. */ - assert (ref->next != NULL); + gcc_assert (ref->next != NULL); break; case REF_SUBSTRING: default: - abort (); + gcc_unreachable (); } if (init == NULL) @@ -461,7 +460,7 @@ gfc_assign_data_value_range (gfc_expr * lvalue, gfc_expr * rvalue, } /* We should never be overwriting an existing initializer. */ - assert (!init); + gcc_assert (!init); expr = gfc_copy_expr (rvalue); if (!gfc_compare_types (&lvalue->ts, &expr->ts)) @@ -599,7 +598,7 @@ formalize_structure_cons (gfc_expr * expr) tail = tail->next; } } - assert (c == NULL); + gcc_assert (c == NULL); expr->value.constructor = head; } @@ -683,7 +682,7 @@ gfc_get_section_index (gfc_array_ref *ar, mpz_t *section_index, mpz_t *offset) gfc_internal_error ("TODO: Vector sections in data statements"); default: - abort (); + gcc_unreachable (); } mpz_sub (tmp, ar->as->upper[i]->value.integer, diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c index 4dd076d8e3b..28b786f5bb3 100644 --- a/gcc/fortran/dependency.c +++ b/gcc/fortran/dependency.c @@ -28,7 +28,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "config.h" #include "gfortran.h" #include "dependency.h" -#include /* static declarations */ /* Enums */ @@ -55,7 +54,7 @@ gfc_dependency; int gfc_expr_is_one (gfc_expr * expr, int def) { - assert (expr != NULL); + gcc_assert (expr != NULL); if (expr->expr_type != EXPR_CONSTANT) return def; @@ -115,9 +114,9 @@ gfc_is_same_range (gfc_array_ref * ar1, gfc_array_ref * ar2, int n, int def) int i; /* TODO: More sophisticated range comparison. */ - assert (ar1 && ar2); + gcc_assert (ar1 && ar2); - assert (ar1->dimen_type[n] == ar2->dimen_type[n]); + gcc_assert (ar1->dimen_type[n] == ar2->dimen_type[n]); e1 = ar1->stride[n]; e2 = ar2->stride[n]; @@ -190,9 +189,9 @@ gfc_check_fncall_dependency (gfc_expr * dest, gfc_expr * fncall) gfc_expr *expr; int n; - assert (dest->expr_type == EXPR_VARIABLE + gcc_assert (dest->expr_type == EXPR_VARIABLE && fncall->expr_type == EXPR_FUNCTION); - assert (fncall->rank > 0); + gcc_assert (fncall->rank > 0); for (actual = fncall->value.function.actual; actual; actual = actual->next) { @@ -214,7 +213,7 @@ gfc_check_fncall_dependency (gfc_expr * dest, gfc_expr * fncall) if (ref->type == REF_ARRAY && ref->u.ar.type != AR_ELEMENT) break; } - assert (ref); + gcc_assert (ref); /* AR_FULL can't contain vector subscripts. */ if (ref->u.ar.type == AR_SECTION) { @@ -264,7 +263,7 @@ gfc_check_dependency (gfc_expr * expr1, gfc_expr * expr2, gfc_expr ** vars, int n; gfc_actual_arglist *actual; - assert (expr1->expr_type == EXPR_VARIABLE); + gcc_assert (expr1->expr_type == EXPR_VARIABLE); /* TODO: -fassume-no-pointer-aliasing */ if (expr1->symtree->n.sym->attr.pointer) @@ -604,7 +603,7 @@ gfc_dep_resolver (gfc_ref * lref, gfc_ref * rref) /* We're resolving from the same base symbol, so both refs should be the same type. We traverse the reference chain intil we find ranges that are not equal. */ - assert (lref->type == rref->type); + gcc_assert (lref->type == rref->type); switch (lref->type) { case REF_COMPONENT: @@ -638,7 +637,7 @@ gfc_dep_resolver (gfc_ref * lref, gfc_ref * rref) this_dep = gfc_check_element_vs_section (rref, lref, n); else { - assert (rref->u.ar.dimen_type[n] == DIMEN_ELEMENT + gcc_assert (rref->u.ar.dimen_type[n] == DIMEN_ELEMENT && lref->u.ar.dimen_type[n] == DIMEN_ELEMENT); this_dep = gfc_check_element_vs_element (rref, lref, n); } @@ -662,14 +661,14 @@ gfc_dep_resolver (gfc_ref * lref, gfc_ref * rref) break; default: - abort(); + gcc_unreachable (); } lref = lref->next; rref = rref->next; } /* If we haven't seen any array refs then something went wrong. */ - assert (fin_dep != GFC_DEP_ERROR); + gcc_assert (fin_dep != GFC_DEP_ERROR); if (fin_dep < GFC_DEP_OVERLAP) return 0; diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index 6a94611c938..69b22dfc2e7 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -49,7 +49,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "trans-types.h" #include "trans-const.h" -#include #include /* Language-dependent contents of an identifier. */ diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c index 6df95839c12..713d81f20ff 100644 --- a/gcc/fortran/iresolve.c +++ b/gcc/fortran/iresolve.c @@ -31,7 +31,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "config.h" #include #include -#include #include "gfortran.h" #include "intrinsic.h" diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 1a7fd80c2b3..ec808a392b6 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -22,7 +22,6 @@ Software Foundation, 59 Temple Place - Suite 330,Boston, MA #include "config.h" #include "gfortran.h" #include "arith.h" /* For gfc_compare_expr(). */ -#include #include /* Stack to push the current if we descend into a block during @@ -345,7 +344,7 @@ resolve_entries (gfc_namespace * ns) return; /* If this isn't a procedure something has gone horribly wrong. */ - assert (ns->proc_name->attr.flavor == FL_PROCEDURE); + gcc_assert (ns->proc_name->attr.flavor == FL_PROCEDURE); /* Remember the current namespace. */ old_ns = gfc_current_ns; @@ -375,7 +374,7 @@ resolve_entries (gfc_namespace * ns) master_count++, ns->proc_name->name); name[GFC_MAX_SYMBOL_LEN] = '\0'; gfc_get_ha_symbol (name, &proc); - assert (proc != NULL); + gcc_assert (proc != NULL); gfc_add_procedure (&proc->attr, PROC_INTERNAL, NULL); if (ns->proc_name->attr.subroutine) @@ -3224,7 +3223,7 @@ gfc_find_forall_index (gfc_expr *expr, gfc_symbol *symbol) switch (expr->expr_type) { case EXPR_VARIABLE: - assert (expr->symtree->n.sym); + gcc_assert (expr->symtree->n.sym); /* A scalar assignment */ if (!expr->ref) @@ -3296,7 +3295,7 @@ gfc_find_forall_index (gfc_expr *expr, gfc_symbol *symbol) if (expr->ref) { tmp = expr->ref; - assert(expr->ref->type == REF_SUBSTRING); + gcc_assert (expr->ref->type == REF_SUBSTRING); if (gfc_find_forall_index (tmp->u.ss.start, symbol) == SUCCESS) return SUCCESS; if (gfc_find_forall_index (tmp->u.ss.end, symbol) == SUCCESS) @@ -3791,7 +3790,7 @@ resolve_code (gfc_code * code, gfc_namespace * ns) break; case EXEC_IOLENGTH: - assert(code->ext.inquire != NULL); + gcc_assert (code->ext.inquire != NULL); if (gfc_resolve_inquire (code->ext.inquire) == FAILURE) break; @@ -4159,7 +4158,7 @@ check_data_variable (gfc_data_variable * var, locus * where) continue; break; } - assert (ref); + gcc_assert (ref); /* Set marks asscording to the reference pattern. */ switch (ref->u.ar.type) @@ -4176,7 +4175,7 @@ check_data_variable (gfc_data_variable * var, locus * where) break; default: - abort(); + gcc_unreachable (); } if (gfc_array_size (e, &size) == FAILURE) diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 26c4d7d0ad3..61ef50bdbcb 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -828,7 +828,7 @@ gfc_simplify_digits (gfc_expr * x) break; default: - abort (); + gcc_unreachable (); } return gfc_int_expr (digits); @@ -1115,7 +1115,7 @@ gfc_simplify_huge (gfc_expr * e) break; default: - abort (); + gcc_unreachable (); } return result; @@ -2477,7 +2477,7 @@ gfc_simplify_radix (gfc_expr * e) break; default: - abort (); + gcc_unreachable (); } result = gfc_int_expr (i); @@ -2508,7 +2508,7 @@ gfc_simplify_range (gfc_expr * e) break; default: - abort (); + gcc_unreachable (); } result = gfc_int_expr (j); diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 25419cc212a..d1443bde077 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -25,7 +25,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include #include -#include #include "gfortran.h" #include "parse.h" @@ -2206,7 +2205,7 @@ gfc_free_namespace (gfc_namespace * ns) ns->refs--; if (ns->refs > 0) return; - assert (ns->refs == 0); + gcc_assert (ns->refs == 0); gfc_free_statements (ns->code); diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 4ba5e8c4652..a8e6dcfeefd 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -86,7 +86,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "toplev.h" #include "real.h" #include "flags.h" -#include #include #include "gfortran.h" #include "trans.h" @@ -181,11 +180,11 @@ gfc_conv_descriptor_data (tree desc) tree type; type = TREE_TYPE (desc); - assert (GFC_DESCRIPTOR_TYPE_P (type)); + gcc_assert (GFC_DESCRIPTOR_TYPE_P (type)); field = TYPE_FIELDS (type); - assert (DATA_FIELD == 0); - assert (field != NULL_TREE + gcc_assert (DATA_FIELD == 0); + gcc_assert (field != NULL_TREE && TREE_CODE (TREE_TYPE (field)) == POINTER_TYPE && TREE_CODE (TREE_TYPE (TREE_TYPE (field))) == ARRAY_TYPE); @@ -199,10 +198,10 @@ gfc_conv_descriptor_offset (tree desc) tree field; type = TREE_TYPE (desc); - assert (GFC_DESCRIPTOR_TYPE_P (type)); + gcc_assert (GFC_DESCRIPTOR_TYPE_P (type)); field = gfc_advance_chain (TYPE_FIELDS (type), OFFSET_FIELD); - assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type); + gcc_assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type); return build3 (COMPONENT_REF, TREE_TYPE (field), desc, field, NULL_TREE); } @@ -214,10 +213,10 @@ gfc_conv_descriptor_dtype (tree desc) tree type; type = TREE_TYPE (desc); - assert (GFC_DESCRIPTOR_TYPE_P (type)); + gcc_assert (GFC_DESCRIPTOR_TYPE_P (type)); field = gfc_advance_chain (TYPE_FIELDS (type), DTYPE_FIELD); - assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type); + gcc_assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type); return build3 (COMPONENT_REF, TREE_TYPE (field), desc, field, NULL_TREE); } @@ -230,10 +229,10 @@ gfc_conv_descriptor_dimension (tree desc, tree dim) tree tmp; type = TREE_TYPE (desc); - assert (GFC_DESCRIPTOR_TYPE_P (type)); + gcc_assert (GFC_DESCRIPTOR_TYPE_P (type)); field = gfc_advance_chain (TYPE_FIELDS (type), DIMENSION_FIELD); - assert (field != NULL_TREE + gcc_assert (field != NULL_TREE && TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE && TREE_CODE (TREE_TYPE (TREE_TYPE (field))) == RECORD_TYPE); @@ -251,7 +250,7 @@ gfc_conv_descriptor_stride (tree desc, tree dim) tmp = gfc_conv_descriptor_dimension (desc, dim); field = TYPE_FIELDS (TREE_TYPE (tmp)); field = gfc_advance_chain (field, STRIDE_SUBFIELD); - assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type); + gcc_assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type); tmp = build3 (COMPONENT_REF, TREE_TYPE (field), tmp, field, NULL_TREE); return tmp; @@ -266,7 +265,7 @@ gfc_conv_descriptor_lbound (tree desc, tree dim) tmp = gfc_conv_descriptor_dimension (desc, dim); field = TYPE_FIELDS (TREE_TYPE (tmp)); field = gfc_advance_chain (field, LBOUND_SUBFIELD); - assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type); + gcc_assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type); tmp = build3 (COMPONENT_REF, TREE_TYPE (field), tmp, field, NULL_TREE); return tmp; @@ -281,7 +280,7 @@ gfc_conv_descriptor_ubound (tree desc, tree dim) tmp = gfc_conv_descriptor_dimension (desc, dim); field = TYPE_FIELDS (TREE_TYPE (tmp)); field = gfc_advance_chain (field, UBOUND_SUBFIELD); - assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type); + gcc_assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type); tmp = build3 (COMPONENT_REF, TREE_TYPE (field), tmp, field, NULL_TREE); return tmp; @@ -296,8 +295,8 @@ gfc_build_null_descriptor (tree type) tree field; tree tmp; - assert (GFC_DESCRIPTOR_TYPE_P (type)); - assert (DATA_FIELD == 0); + gcc_assert (GFC_DESCRIPTOR_TYPE_P (type)); + gcc_assert (DATA_FIELD == 0); field = TYPE_FIELDS (type); /* Set a NULL data pointer. */ @@ -345,7 +344,7 @@ gfc_free_ss_chain (gfc_ss * ss) while (ss != gfc_ss_terminator) { - assert (ss != NULL); + gcc_assert (ss != NULL); next = ss->next; gfc_free_ss (ss); ss = next; @@ -390,7 +389,7 @@ gfc_cleanup_loop (gfc_loopinfo * loop) ss = loop->ss; while (ss != gfc_ss_terminator) { - assert (ss != NULL); + gcc_assert (ss != NULL); next = ss->loop_chain; gfc_free_ss (ss); ss = next; @@ -416,7 +415,7 @@ gfc_add_ss_to_loop (gfc_loopinfo * loop, gfc_ss * head) else ss->loop_chain = ss->next; } - assert (ss == gfc_ss_terminator); + gcc_assert (ss == gfc_ss_terminator); loop->ss = head; } @@ -428,7 +427,7 @@ gfc_trans_static_array_pointer (gfc_symbol * sym) { tree type; - assert (TREE_STATIC (sym->backend_decl)); + gcc_assert (TREE_STATIC (sym->backend_decl)); /* Just zero the data member. */ type = TREE_TYPE (sym->backend_decl); DECL_INITIAL (sym->backend_decl) =gfc_build_null_descriptor (type); @@ -492,7 +491,7 @@ gfc_trans_allocate_array_storage (gfc_loopinfo * loop, gfc_ss_info * info, else if (gfc_index_integer_kind == 8) tmp = gfor_fndecl_internal_malloc64; else - abort (); + gcc_unreachable (); tmp = gfc_build_function_call (tmp, args); tmp = convert (TREE_TYPE (data), tmp); gfc_add_modify_expr (&loop->pre, data, tmp); @@ -537,13 +536,13 @@ gfc_trans_allocate_temp_array (gfc_loopinfo * loop, gfc_ss_info * info, int n; int dim; - assert (info->dimen > 0); + gcc_assert (info->dimen > 0); /* Set the lower bound to zero. */ for (dim = 0; dim < info->dimen; dim++) { n = loop->order[dim]; if (n < loop->temp_dim) - assert (integer_zerop (loop->from[n])); + gcc_assert (integer_zerop (loop->from[n])); else { /* Callee allocated arrays may not have a known bound yet. */ @@ -640,7 +639,7 @@ gfc_put_offset_into_var (stmtblock_t * pblock, tree * poffset, { /* We should have already created the offset variable. We cannot create it here because we may be in an inner scope. */ - assert (*offsetvar != NULL_TREE); + gcc_assert (*offsetvar != NULL_TREE); gfc_add_modify_expr (pblock, *offsetvar, *poffset); *poffset = *offsetvar; TREE_USED (*offsetvar) = 1; @@ -717,7 +716,7 @@ gfc_trans_array_constructor_subarray (stmtblock_t * pblock, /* Walk the array expression. */ ss = gfc_walk_expr (expr); - assert (ss != gfc_ss_terminator); + gcc_assert (ss != gfc_ss_terminator); /* Initialize the scalarizer. */ gfc_init_loopinfo (&loop); @@ -737,7 +736,7 @@ gfc_trans_array_constructor_subarray (stmtblock_t * pblock, gfc_todo_error ("character arrays in constructors"); gfc_trans_array_ctor_element (&body, pointer, *poffset, &se, expr); - assert (se.ss == gfc_ss_terminator); + gcc_assert (se.ss == gfc_ss_terminator); /* Increment the offset. */ tmp = build2 (PLUS_EXPR, gfc_array_index_type, *poffset, gfc_index_one_node); @@ -1145,12 +1144,12 @@ gfc_trans_array_constructor (gfc_loopinfo * loop, gfc_ss * ss) if (TREE_USED (offsetvar)) pushdecl (offsetvar); else - assert (INTEGER_CST_P (offset)); + gcc_assert (INTEGER_CST_P (offset)); #if 0 /* Disable bound checking for now because it's probably broken. */ if (flag_bounds_check) { - abort (); + gcc_unreachable (); } #endif } @@ -1168,11 +1167,11 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript) /* TODO: This can generate bad code if there are ordering dependencies. eg. a callee allocated function and an unknown size constructor. */ - assert (ss != NULL); + gcc_assert (ss != NULL); for (; ss != gfc_ss_terminator; ss = ss->loop_chain) { - assert (ss); + gcc_assert (ss); switch (ss->type) { @@ -1246,7 +1245,7 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript) break; default: - abort (); + gcc_unreachable (); } } } @@ -1262,7 +1261,7 @@ gfc_conv_ss_descriptor (stmtblock_t * block, gfc_ss * ss, int base) tree tmp; /* Get the descriptor for the array to be scalarized. */ - assert (ss->expr->expr_type == EXPR_VARIABLE); + gcc_assert (ss->expr->expr_type == EXPR_VARIABLE); gfc_init_se (&se, NULL); se.descriptor_only = 1; gfc_conv_expr_lhs (&se, ss->expr); @@ -1449,7 +1448,7 @@ gfc_conv_array_index_ref (gfc_se * se, tree pointer, tree * indices, tmp = gfc_build_array_ref (array, index); /* Check we've used the correct number of dimensions. */ - assert (TREE_CODE (TREE_TYPE (tmp)) != ARRAY_TYPE); + gcc_assert (TREE_CODE (TREE_TYPE (tmp)) != ARRAY_TYPE); se->expr = tmp; } @@ -1494,7 +1493,7 @@ gfc_conv_vector_array_index (gfc_se * se, tree index, gfc_ss * ss) gfc_ss_info *info; int n; - assert (ss && ss->type == GFC_SS_VECTOR); + gcc_assert (ss && ss->type == GFC_SS_VECTOR); /* Save the descriptor. */ descsave = se->expr; @@ -1507,7 +1506,7 @@ gfc_conv_vector_array_index (gfc_se * se, tree index, gfc_ss * ss) switch (ar->dimen_type[n]) { case DIMEN_ELEMENT: - assert (info->subscript[n] != gfc_ss_terminator + gcc_assert (info->subscript[n] != gfc_ss_terminator && info->subscript[n]->type == GFC_SS_SCALAR); indices[n] = info->subscript[n]->data.scalar.expr; break; @@ -1524,7 +1523,7 @@ gfc_conv_vector_array_index (gfc_se * se, tree index, gfc_ss * ss) break; default: - abort (); + gcc_unreachable (); } } /* Get the index from the vector. */ @@ -1549,12 +1548,12 @@ gfc_conv_array_index_offset (gfc_se * se, gfc_ss_info * info, int dim, int i, /* Get the index into the array for this dimension. */ if (ar) { - assert (ar->type != AR_ELEMENT); + gcc_assert (ar->type != AR_ELEMENT); if (ar->dimen_type[dim] == DIMEN_ELEMENT) { - assert (i == -1); + gcc_assert (i == -1); /* Elemental dimension. */ - assert (info->subscript[dim] + gcc_assert (info->subscript[dim] && info->subscript[dim]->type == GFC_SS_SCALAR); /* We've already translated this value outside the loop. */ index = info->subscript[dim]->data.scalar.expr; @@ -1565,7 +1564,7 @@ gfc_conv_array_index_offset (gfc_se * se, gfc_ss_info * info, int dim, int i, else { /* Scalarized dimension. */ - assert (info && se->loop); + gcc_assert (info && se->loop); /* Multiply the loop variable by the stride and dela. */ index = se->loop->loopvar[i]; @@ -1584,13 +1583,13 @@ gfc_conv_array_index_offset (gfc_se * se, gfc_ss_info * info, int dim, int i, dim); } else - assert (ar->dimen_type[dim] == DIMEN_RANGE); + gcc_assert (ar->dimen_type[dim] == DIMEN_RANGE); } } else { /* Temporary array or derived type component. */ - assert (se->loop); + gcc_assert (se->loop); index = se->loop->loopvar[se->loop->order[i]]; if (!integer_zerop (info->delta[i])) index = fold (build2 (PLUS_EXPR, gfc_array_index_type, @@ -1832,7 +1831,7 @@ gfc_start_scalarized_body (gfc_loopinfo * loop, stmtblock_t * pbody) int n; int flags; - assert (!loop->array_parameter); + gcc_assert (!loop->array_parameter); for (dim = loop->dimen - 1; dim >= 0; dim--) { @@ -2000,7 +1999,7 @@ gfc_conv_section_upper_bound (gfc_ss * ss, int n, stmtblock_t * pblock) tree bound; gfc_se se; - assert (ss->type == GFC_SS_SECTION); + gcc_assert (ss->type == GFC_SS_SECTION); /* For vector array subscripts we want the size of the vector. */ dim = ss->data.info.dim[n]; @@ -2008,11 +2007,11 @@ gfc_conv_section_upper_bound (gfc_ss * ss, int n, stmtblock_t * pblock) while (vecss->data.info.ref->u.ar.dimen_type[dim] == DIMEN_VECTOR) { vecss = vecss->data.info.subscript[dim]; - assert (vecss && vecss->type == GFC_SS_VECTOR); + gcc_assert (vecss && vecss->type == GFC_SS_VECTOR); dim = vecss->data.info.dim[0]; } - assert (vecss->data.info.ref->u.ar.dimen_type[dim] == DIMEN_RANGE); + gcc_assert (vecss->data.info.ref->u.ar.dimen_type[dim] == DIMEN_RANGE); end = vecss->data.info.ref->u.ar.end[dim]; desc = vecss->data.info.descriptor; @@ -2056,14 +2055,14 @@ gfc_conv_section_startstride (gfc_loopinfo * loop, gfc_ss * ss, int n) while (vecss->data.info.ref->u.ar.dimen_type[dim] == DIMEN_VECTOR) { vecss = vecss->data.info.subscript[dim]; - assert (vecss && vecss->type == GFC_SS_VECTOR); + gcc_assert (vecss && vecss->type == GFC_SS_VECTOR); /* Get the descriptors for the vector subscripts as well. */ if (!vecss->data.info.descriptor) gfc_conv_ss_descriptor (&loop->pre, vecss, !loop->array_parameter); dim = vecss->data.info.dim[0]; } - assert (vecss->data.info.ref->u.ar.dimen_type[dim] == DIMEN_RANGE); + gcc_assert (vecss->data.info.ref->u.ar.dimen_type[dim] == DIMEN_RANGE); start = vecss->data.info.ref->u.ar.start[dim]; stride = vecss->data.info.ref->u.ar.stride[dim]; desc = vecss->data.info.descriptor; @@ -2199,10 +2198,10 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop) == DIMEN_VECTOR) { vecss = vecss->data.info.subscript[dim]; - assert (vecss && vecss->type == GFC_SS_VECTOR); + gcc_assert (vecss && vecss->type == GFC_SS_VECTOR); dim = vecss->data.info.dim[0]; } - assert (vecss->data.info.ref->u.ar.dimen_type[dim] + gcc_assert (vecss->data.info.ref->u.ar.dimen_type[dim] == DIMEN_RANGE); desc = vecss->data.info.descriptor; @@ -2359,7 +2358,7 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop, gfc_ss * dest, dim = 0; for (n = 0; n < loop->dimen; n++) { - assert (loop->order[n] == n); + gcc_assert (loop->order[n] == n); if (depends[n]) loop->order[dim++] = n; } @@ -2370,7 +2369,7 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop, gfc_ss * dest, loop->order[dim++] = n; } - assert (dim == loop->dimen); + gcc_assert (dim == loop->dimen); break; } #endif @@ -2433,7 +2432,7 @@ gfc_conv_loop_setup (gfc_loopinfo * loop) /* An unknown size constructor will always be rank one. Higher rank constructors will either have known shape, or still be wrapped in a call to reshape. */ - assert (loop->dimen == 1); + gcc_assert (loop->dimen == 1); /* Try to figure out the size of the constructor. */ /* TODO: avoid this by making the frontend set the shape. */ gfc_get_array_cons_size (&i, ss->expr->value.constructor); @@ -2519,8 +2518,8 @@ gfc_conv_loop_setup (gfc_loopinfo * loop) switch (loopspec[n]->type) { case GFC_SS_CONSTRUCTOR: - assert (info->dimen == 1); - assert (loop->to[n]); + gcc_assert (info->dimen == 1); + gcc_assert (loop->to[n]); break; case GFC_SS_SECTION: @@ -2530,11 +2529,11 @@ gfc_conv_loop_setup (gfc_loopinfo * loop) case GFC_SS_FUNCTION: /* The loop bound will be set when we generate the call. */ - assert (loop->to[n] == NULL_TREE); + gcc_assert (loop->to[n] == NULL_TREE); break; default: - abort (); + gcc_unreachable (); } } @@ -2567,7 +2566,7 @@ gfc_conv_loop_setup (gfc_loopinfo * loop) /* If we want a temporary then create it. */ if (loop->temp_ss != NULL) { - assert (loop->temp_ss->type == GFC_SS_TEMP); + gcc_assert (loop->temp_ss->type == GFC_SS_TEMP); tmp = loop->temp_ss->data.temp.type; len = loop->temp_ss->string_length; n = loop->temp_ss->data.temp.dimen; @@ -2676,7 +2675,7 @@ gfc_array_init_size (tree descriptor, int rank, tree * poffset, se.expr = gfc_index_one_node; else { - assert (lower[n]); + gcc_assert (lower[n]); if (ubound) { gfc_conv_expr_type (&se, lower[n], gfc_array_index_type); @@ -2701,7 +2700,7 @@ gfc_array_init_size (tree descriptor, int rank, tree * poffset, /* Set upper bound. */ gfc_init_se (&se, NULL); - assert (ubound); + gcc_assert (ubound); gfc_conv_expr_type (&se, ubound, gfc_array_index_type); gfc_add_block_to_block (pblock, &se.pre); @@ -2760,7 +2759,7 @@ gfc_array_allocate (gfc_se * se, gfc_ref * ref, tree pstat) break; case AR_FULL: - assert (ref->u.ar.as->type == AS_EXPLICIT); + gcc_assert (ref->u.ar.as->type == AS_EXPLICIT); lower = ref->u.ar.as->lower; upper = ref->u.ar.as->upper; @@ -2772,7 +2771,7 @@ gfc_array_allocate (gfc_se * se, gfc_ref * ref, tree pstat) break; default: - abort (); + gcc_unreachable (); break; } @@ -2789,7 +2788,7 @@ gfc_array_allocate (gfc_se * se, gfc_ref * ref, tree pstat) else if (TYPE_PRECISION (gfc_array_index_type) == 64) allocate = gfor_fndecl_allocate64; else - abort (); + gcc_unreachable (); tmp = gfc_chainon_list (NULL_TREE, pointer); tmp = gfc_chainon_list (tmp, size); @@ -2862,7 +2861,7 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr) gfc_conv_structure (&se, expr, 1); tmp = TYPE_MAX_VALUE (TYPE_DOMAIN (type)); - assert (tmp && INTEGER_CST_P (tmp)); + gcc_assert (tmp && INTEGER_CST_P (tmp)); hi = TREE_INT_CST_HIGH (tmp); lo = TREE_INT_CST_LOW (tmp); lo++; @@ -2938,7 +2937,7 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr) break; default: - abort(); + gcc_unreachable (); } } /* We created the list in reverse order. */ @@ -2946,7 +2945,7 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr) break; default: - abort(); + gcc_unreachable (); } /* Create a constructor from the list of elements. */ @@ -3042,14 +3041,14 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody) tree offset; bool onstack; - assert (!(sym->attr.pointer || sym->attr.allocatable)); + gcc_assert (!(sym->attr.pointer || sym->attr.allocatable)); /* Do nothing for USEd variables. */ if (sym->attr.use_assoc) return fnbody; type = TREE_TYPE (decl); - assert (GFC_ARRAY_TYPE_P (type)); + gcc_assert (GFC_ARRAY_TYPE_P (type)); onstack = TREE_CODE (type) != POINTER_TYPE; gfc_start_block (&block); @@ -3074,9 +3073,9 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody) type = TREE_TYPE (type); - assert (!sym->attr.use_assoc); - assert (!TREE_STATIC (decl)); - assert (!sym->module[0]); + gcc_assert (!sym->attr.use_assoc); + gcc_assert (!TREE_STATIC (decl)); + gcc_assert (!sym->module[0]); if (sym->ts.type == BT_CHARACTER && !INTEGER_CST_P (sym->ts.cl->backend_decl)) @@ -3097,7 +3096,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody) else if (gfc_index_integer_kind == 8) fndecl = gfor_fndecl_internal_malloc64; else - abort (); + gcc_unreachable (); tmp = gfc_build_function_call (fndecl, tmp); tmp = fold (convert (TREE_TYPE (decl), tmp)); gfc_add_modify_expr (&block, decl, tmp); @@ -3108,7 +3107,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody) /* Automatic arrays should not have initializers. */ - assert (!sym->value); + gcc_assert (!sym->value); gfc_add_expr_to_block (&block, fnbody); @@ -3140,7 +3139,7 @@ gfc_trans_g77_array (gfc_symbol * sym, tree body) /* Descriptor type. */ parm = sym->backend_decl; type = TREE_TYPE (parm); - assert (GFC_ARRAY_TYPE_P (type)); + gcc_assert (GFC_ARRAY_TYPE_P (type)); gfc_start_block (&block); @@ -3223,7 +3222,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) /* Descriptor type. */ type = TREE_TYPE (tmpdesc); - assert (GFC_ARRAY_TYPE_P (type)); + gcc_assert (GFC_ARRAY_TYPE_P (type)); dumdesc = GFC_DECL_SAVED_DESCRIPTOR (tmpdesc); dumdesc = gfc_build_indirect_ref (dumdesc); gfc_start_block (&block); @@ -3272,7 +3271,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) } else { - assert (integer_onep (GFC_TYPE_ARRAY_STRIDE (type, 0))); + gcc_assert (integer_onep (GFC_TYPE_ARRAY_STRIDE (type, 0))); /* A library call to repack the array if neccessary. */ tmp = GFC_DECL_SAVED_DESCRIPTOR (tmpdesc); tmp = gfc_chainon_list (NULL_TREE, tmp); @@ -3488,7 +3487,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) int full; gfc_ss *vss; - assert (ss != gfc_ss_terminator); + gcc_assert (ss != gfc_ss_terminator); /* TODO: Pass constant array constructors without a temporary. */ /* Special case things we know we can pass easily. */ @@ -3503,7 +3502,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) while (secss != gfc_ss_terminator && secss->type != GFC_SS_SECTION) secss = secss->next; - assert (secss != gfc_ss_terminator); + gcc_assert (secss != gfc_ss_terminator); need_tmp = 0; for (n = 0; n < secss->data.info.dimen; n++) @@ -3529,7 +3528,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) full = 0; else { - assert (info->ref->u.ar.type == AR_SECTION); + gcc_assert (info->ref->u.ar.type == AR_SECTION); full = 1; for (n = 0; n < info->ref->u.ar.dimen; n++) @@ -3582,7 +3581,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) if (se->direct_byref) { - assert (secss != gfc_ss_terminator); + gcc_assert (secss != gfc_ss_terminator); /* For pointer assignments pass the descriptor directly. */ se->ss = secss; @@ -3623,7 +3622,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) if (!need_tmp) loop.array_parameter = 1; else - assert (se->want_pointer && !se->direct_byref); + gcc_assert (se->want_pointer && !se->direct_byref); /* Setup the scalarizing loops and bounds. */ gfc_conv_ss_startstride (&loop); @@ -3685,7 +3684,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) tmp = gfc_conv_descriptor_stride (desc, gfc_rank_cst[0]); gfc_add_modify_expr (&loop.pre, tmp, gfc_index_zero_node); - assert (is_gimple_lvalue (desc)); + gcc_assert (is_gimple_lvalue (desc)); se->expr = gfc_build_addr_expr (NULL, desc); } else if (expr->expr_type == EXPR_FUNCTION) @@ -3720,7 +3719,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) se->string_length = expr->symtree->n.sym->ts.cl->backend_decl; desc = info->descriptor; - assert (secss && secss != gfc_ss_terminator); + gcc_assert (secss && secss != gfc_ss_terminator); if (se->direct_byref) { /* For pointer assignments we fill in the destination. */ @@ -3764,14 +3763,14 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) /* Work out the offset. */ if (info->ref->u.ar.dimen_type[n] == DIMEN_ELEMENT) { - assert (info->subscript[n] + gcc_assert (info->subscript[n] && info->subscript[n]->type == GFC_SS_SCALAR); start = info->subscript[n]->data.scalar.expr; } else { /* Check we haven't somehow got out of sync. */ - assert (info->dim[dim] == n); + gcc_assert (info->dim[dim] == n); /* Evaluate and remember the start of the section. */ start = info->start[dim]; @@ -3791,7 +3790,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) } /* Vector subscripts need copying and are handled elsewhere. */ - assert (info->ref->u.ar.dimen_type[n] == DIMEN_RANGE); + gcc_assert (info->ref->u.ar.dimen_type[n] == DIMEN_RANGE); /* Set the new lower bound. */ from = loop.from[dim]; @@ -3973,7 +3972,7 @@ gfc_trans_deferred_array (gfc_symbol * sym, tree body) gfc_init_block (&fnblock); - assert (TREE_CODE (sym->backend_decl) == VAR_DECL); + gcc_assert (TREE_CODE (sym->backend_decl) == VAR_DECL); if (sym->ts.type == BT_CHARACTER && !INTEGER_CST_P (sym->ts.cl->backend_decl)) gfc_trans_init_string_length (sym->ts.cl, &fnblock); @@ -3999,7 +3998,7 @@ gfc_trans_deferred_array (gfc_symbol * sym, tree body) /* Get the descriptor type. */ type = TREE_TYPE (sym->backend_decl); - assert (GFC_DESCRIPTOR_TYPE_P (type)); + gcc_assert (GFC_DESCRIPTOR_TYPE_P (type)); /* NULLIFY the data pointer. */ tmp = gfc_conv_descriptor_data (descriptor); @@ -4083,9 +4082,9 @@ gfc_walk_variable_expr (gfc_ss * ss, gfc_expr * expr) newss->data.info.dim[n] = n; ar->dimen_type[n] = DIMEN_RANGE; - assert (ar->start[n] == NULL); - assert (ar->end[n] == NULL); - assert (ar->stride[n] == NULL); + gcc_assert (ar->start[n] == NULL); + gcc_assert (ar->end[n] == NULL); + gcc_assert (ar->stride[n] == NULL); } return newss; @@ -4108,7 +4107,7 @@ gfc_walk_variable_expr (gfc_ss * ss, gfc_expr * expr) { case DIMEN_ELEMENT: /* Add SS for elemental (scalar) subscripts. */ - assert (ar->start[n]); + gcc_assert (ar->start[n]); indexss = gfc_get_ss (); indexss->type = GFC_SS_SCALAR; indexss->expr = ar->start[n]; @@ -4149,17 +4148,17 @@ gfc_walk_variable_expr (gfc_ss * ss, gfc_expr * expr) default: /* We should know what sort of section it is by now. */ - abort (); + gcc_unreachable (); } } /* We should have at least one non-elemental dimension. */ - assert (newss->data.info.dimen > 0); + gcc_assert (newss->data.info.dimen > 0); return head; break; default: /* We should know what sort of section it is by now. */ - abort (); + gcc_unreachable (); } } @@ -4203,14 +4202,14 @@ gfc_walk_op_expr (gfc_ss * ss, gfc_expr * expr) while (head && head->next != ss) head = head->next; /* Check we haven't somehow broken the chain. */ - assert (head); + gcc_assert (head); newss->next = ss; head->next = newss; newss->expr = expr->op1; } else /* head2 == head */ { - assert (head2 == head); + gcc_assert (head2 == head); /* Second operand is scalar. */ newss->next = head2; head2 = newss; @@ -4229,13 +4228,14 @@ gfc_reverse_ss (gfc_ss * ss) gfc_ss *next; gfc_ss *head; - assert (ss != NULL); + gcc_assert (ss != NULL); head = gfc_ss_terminator; while (ss != gfc_ss_terminator) { next = ss->next; - assert (next != NULL); /* Check we didn't somehow break the chain. */ + /* Check we didn't somehow break the chain. */ + gcc_assert (next != NULL); ss->next = head; head = ss; ss = next; diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c index f9db554337f..f692f3eee22 100644 --- a/gcc/fortran/trans-common.c +++ b/gcc/fortran/trans-common.c @@ -103,7 +103,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "trans.h" #include "trans-types.h" #include "trans-const.h" -#include /* Holds a single variable in a equivalence set. */ @@ -414,7 +413,7 @@ create_common (gfc_common_head *com) offset = s->offset + s->length; } } - assert (list); + gcc_assert (list); ctor = build1 (CONSTRUCTOR, union_type, nreverse(list)); TREE_CONSTANT (ctor) = 1; TREE_INVARIANT (ctor) = 1; @@ -423,7 +422,7 @@ create_common (gfc_common_head *com) #ifdef ENABLE_CHECKING for (tmp = CONSTRUCTOR_ELTS (ctor); tmp; tmp = TREE_CHAIN (tmp)) - assert (TREE_CODE (TREE_PURPOSE (tmp)) == FIELD_DECL); + gcc_assert (TREE_CODE (TREE_PURPOSE (tmp)) == FIELD_DECL); #endif } diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c index 670e2f5df9c..e3c58507ca0 100644 --- a/gcc/fortran/trans-const.c +++ b/gcc/fortran/trans-const.c @@ -30,7 +30,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "toplev.h" #include "real.h" #include -#include #include #include "gfortran.h" #include "trans.h" @@ -70,7 +69,7 @@ gfc_build_const (tree type, tree intval) break; default: - abort (); + gcc_unreachable (); } return val; } @@ -102,10 +101,10 @@ gfc_conv_string_init (tree length, gfc_expr * expr) int slen; tree str; - assert (expr->expr_type == EXPR_CONSTANT); - assert (expr->ts.type == BT_CHARACTER && expr->ts.kind == 1); - assert (INTEGER_CST_P (length)); - assert (TREE_INT_CST_HIGH (length) == 0); + gcc_assert (expr->expr_type == EXPR_CONSTANT); + gcc_assert (expr->ts.type == BT_CHARACTER && expr->ts.kind == 1); + gcc_assert (INTEGER_CST_P (length)); + gcc_assert (TREE_INT_CST_HIGH (length) == 0); len = TREE_INT_CST_LOW (length); slen = expr->value.character.length; @@ -191,7 +190,7 @@ gfc_conv_mpz_to_tree (mpz_t i, int kind) /* We assume that all numbers are in range for its type, and that we never create a type larger than 2*HWI, which is the largest that the middle-end can handle. */ - assert (count == 1 || count == 2); + gcc_assert (count == 1 || count == 2); low = words[0]; high = words[1]; @@ -228,7 +227,7 @@ gfc_conv_mpfr_to_tree (mpfr_t f, int kind) if (gfc_real_kinds[n].kind == kind) break; } - assert (gfc_real_kinds[n].kind); + gcc_assert (gfc_real_kinds[n].kind); n = MAX (abs (gfc_real_kinds[n].min_exponent), abs (gfc_real_kinds[n].max_exponent)); @@ -292,7 +291,7 @@ gfc_conv_mpfr_to_tree (mpfr_t f, int kind) tree gfc_conv_constant_to_tree (gfc_expr * expr) { - assert (expr->expr_type == EXPR_CONSTANT); + gcc_assert (expr->expr_type == EXPR_CONSTANT); switch (expr->ts.type) { @@ -332,13 +331,13 @@ gfc_conv_constant_to_tree (gfc_expr * expr) void gfc_conv_constant (gfc_se * se, gfc_expr * expr) { - assert (expr->expr_type == EXPR_CONSTANT); + gcc_assert (expr->expr_type == EXPR_CONSTANT); if (se->ss != NULL) { - assert (se->ss != gfc_ss_terminator); - assert (se->ss->type == GFC_SS_SCALAR); - assert (se->ss->expr == expr); + gcc_assert (se->ss != gfc_ss_terminator); + gcc_assert (se->ss->type == GFC_SS_SCALAR); + gcc_assert (se->ss->expr == expr); se->expr = se->ss->data.scalar.expr; se->string_length = se->ss->string_length; diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 49689390fcc..de319c70993 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -35,7 +35,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "errors.h" #include "flags.h" #include "cgraph.h" -#include #include "gfortran.h" #include "trans.h" #include "trans-types.h" @@ -131,7 +130,7 @@ tree gfor_fndecl_sr_kind; static void gfc_add_decl_to_parent_function (tree decl) { - assert (decl); + gcc_assert (decl); DECL_CONTEXT (decl) = DECL_CONTEXT (current_function_decl); DECL_NONLOCAL (decl) = 1; TREE_CHAIN (decl) = saved_parent_function_decls; @@ -141,7 +140,7 @@ gfc_add_decl_to_parent_function (tree decl) void gfc_add_decl_to_function (tree decl) { - assert (decl); + gcc_assert (decl); TREE_USED (decl) = 1; DECL_CONTEXT (decl) = current_function_decl; TREE_CHAIN (decl) = saved_function_decls; @@ -242,7 +241,7 @@ gfc_get_label_decl (gfc_st_label * lp) tree label_decl; /* Validate the label declaration from the front end. */ - assert (lp != NULL && lp->value <= MAX_LABEL_VALUE); + gcc_assert (lp != NULL && lp->value <= MAX_LABEL_VALUE); /* Build a mangled name for the label. */ sprintf (label_name, "__label_%.6d", lp->value); @@ -330,13 +329,13 @@ static void gfc_finish_decl (tree decl, tree init) { if (TREE_CODE (decl) == PARM_DECL) - assert (init == NULL_TREE); + gcc_assert (init == NULL_TREE); /* Remember that PARM_DECL doesn't have a DECL_INITIAL field per se -- it overlaps DECL_ARG_TYPE. */ else if (init == NULL_TREE) - assert (DECL_INITIAL (decl) == NULL_TREE); + gcc_assert (DECL_INITIAL (decl) == NULL_TREE); else - assert (DECL_INITIAL (decl) == error_mark_node); + gcc_assert (DECL_INITIAL (decl) == error_mark_node); if (init != NULL_TREE) { @@ -414,7 +413,7 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym) else if (sym->module[0] && !sym->attr.result) { /* TODO: Don't set sym->module for result variables. */ - assert (current_function_decl == NULL_TREE); + gcc_assert (current_function_decl == NULL_TREE); /* This is the declaration of a module variable. */ TREE_PUBLIC (decl) = 1; TREE_STATIC (decl) = 1; @@ -510,7 +509,7 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym) if (GFC_DESCRIPTOR_TYPE_P (type)) return; - assert (GFC_ARRAY_TYPE_P (type)); + gcc_assert (GFC_ARRAY_TYPE_P (type)); nest = (sym->ns->proc_name->backend_decl != current_function_decl) && !sym->attr.contained; @@ -562,7 +561,7 @@ gfc_build_dummy_array_decl (gfc_symbol * sym, tree dummy) gfc_defer_symbol_init (sym); type = TREE_TYPE (dummy); - assert (TREE_CODE (dummy) == PARM_DECL + gcc_assert (TREE_CODE (dummy) == PARM_DECL && POINTER_TYPE_P (type)); /* Do we know the element size? */ @@ -573,7 +572,7 @@ gfc_build_dummy_array_decl (gfc_symbol * sym, tree dummy) { /* For descriptorless arrays with known element size the actual argument is sufficient. */ - assert (GFC_ARRAY_TYPE_P (type)); + gcc_assert (GFC_ARRAY_TYPE_P (type)); gfc_build_qualified_array (dummy, sym); return dummy; } @@ -630,7 +629,7 @@ gfc_build_dummy_array_decl (gfc_symbol * sym, tree dummy) /* We should never get deferred shape arrays here. We used to because of frontend bugs. */ - assert (sym->as->type != AS_DEFERRED); + gcc_assert (sym->as->type != AS_DEFERRED); switch (packed) { @@ -670,7 +669,7 @@ gfc_create_string_length (gfc_symbol * sym) { tree length; - assert (sym->ts.cl); + gcc_assert (sym->ts.cl); gfc_conv_const_charlen (sym->ts.cl); if (sym->ts.cl->backend_decl == NULL_TREE) @@ -702,7 +701,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) tree length = NULL_TREE; int byref; - assert (sym->attr.referenced); + gcc_assert (sym->attr.referenced); if (sym->ns && sym->ns->proc_name->attr.function) byref = gfc_return_by_reference (sym->ns->proc_name); @@ -720,7 +719,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) } /* Dummy variables should already have been created. */ - assert (sym->backend_decl); + gcc_assert (sym->backend_decl); /* Create a character length variable. */ if (sym->ts.type == BT_CHARACTER) @@ -825,7 +824,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) SET_DECL_ASSEMBLER_NAME (decl, get_identifier (name)); } gfc_finish_var_decl (length, sym); - assert (!sym->value); + gcc_assert (!sym->value); } } sym->backend_decl = decl; @@ -888,7 +887,7 @@ gfc_get_extern_function_decl (gfc_symbol * sym) /* We should never be creating external decls for alternate entry points. The procedure may be an alternate entry point, but we don't want/need to know that. */ - assert (!(sym->attr.entry || sym->attr.entry_master)); + gcc_assert (!(sym->attr.entry || sym->attr.entry_master)); if (sym->attr.intrinsic) { @@ -897,13 +896,13 @@ gfc_get_extern_function_decl (gfc_symbol * sym) at the first argument. We pass NULL for the second argument otherwise things like AINT get confused. */ isym = gfc_find_function (sym->name); - assert (isym->resolve.f0 != NULL); + gcc_assert (isym->resolve.f0 != NULL); memset (&e, 0, sizeof (e)); e.expr_type = EXPR_FUNCTION; memset (&argexpr, 0, sizeof (argexpr)); - assert (isym->formal); + gcc_assert (isym->formal); argexpr.ts = isym->formal->ts; if (isym->formal->next == NULL) @@ -911,7 +910,7 @@ gfc_get_extern_function_decl (gfc_symbol * sym) else { /* All specific intrinsics take one or two arguments. */ - assert (isym->formal->next->next == NULL); + gcc_assert (isym->formal->next->next == NULL); isym->resolve.f2 (&e, &argexpr, NULL); } sprintf (s, "specific%s", e.value.function.name); @@ -988,15 +987,15 @@ build_function_decl (gfc_symbol * sym) tree result_decl; gfc_formal_arglist *f; - assert (!sym->backend_decl); - assert (!sym->attr.external); + gcc_assert (!sym->backend_decl); + gcc_assert (!sym->attr.external); /* Set the line and filename. sym->declared_at seems to point to the last statement for subroutines, but it'll do for now. */ gfc_set_backend_locus (&sym->declared_at); /* Allow only one nesting level. Allow public declarations. */ - assert (current_function_decl == NULL_TREE + gcc_assert (current_function_decl == NULL_TREE || DECL_CONTEXT (current_function_decl) == NULL_TREE); type = gfc_get_function_type (sym); @@ -1147,7 +1146,7 @@ create_function_arglist (gfc_symbol * sym) /* Length of character result. */ type = TREE_VALUE (typelist); - assert (type == gfc_charlen_type_node); + gcc_assert (type == gfc_charlen_type_node); length = build_decl (PARM_DECL, get_identifier (".__result"), @@ -1157,7 +1156,7 @@ create_function_arglist (gfc_symbol * sym) sym->ts.cl->backend_decl = length; TREE_USED (length) = 1; } - assert (TREE_CODE (length) == PARM_DECL); + gcc_assert (TREE_CODE (length) == PARM_DECL); arglist = chainon (arglist, length); typelist = TREE_CHAIN (typelist); DECL_CONTEXT (length) = fndecl; @@ -1209,7 +1208,7 @@ create_function_arglist (gfc_symbol * sym) parm = f->sym->backend_decl; type = TREE_VALUE (typelist); - assert (type == gfc_charlen_type_node); + gcc_assert (type == gfc_charlen_type_node); strcpy (&name[1], f->sym->name); name[0] = '_'; @@ -1252,7 +1251,7 @@ create_function_arglist (gfc_symbol * sym) typelist = TREE_CHAIN (typelist); } - assert (TREE_VALUE (typelist) == void_type_node); + gcc_assert (TREE_VALUE (typelist) == void_type_node); DECL_ARGUMENTS (fndecl) = arglist; } @@ -1344,7 +1343,7 @@ build_entry_thunks (gfc_namespace * ns) locus old_loc; /* This should always be a toplevel function. */ - assert (current_function_decl == NULL_TREE); + gcc_assert (current_function_decl == NULL_TREE); gfc_get_backend_locus (&old_loc); for (el = ns->entries; el; el = el->next) @@ -1538,7 +1537,7 @@ gfc_build_library_function_decl (tree name, tree rettype, int nargs, ...) int n; /* Library functions must be declared with global scope. */ - assert (current_function_decl == NULL_TREE); + gcc_assert (current_function_decl == NULL_TREE); va_start (p, nargs); @@ -1873,8 +1872,8 @@ gfc_trans_auto_character_variable (gfc_symbol * sym, tree fnbody) tree decl; tree tmp; - assert (sym->backend_decl); - assert (sym->ts.cl && sym->ts.cl->length); + gcc_assert (sym->backend_decl); + gcc_assert (sym->ts.cl && sym->ts.cl->length); gfc_start_block (&body); @@ -1959,7 +1958,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tree fnbody) case AS_ASSUMED_SIZE: /* Must be a dummy parameter. */ - assert (sym->attr.dummy); + gcc_assert (sym->attr.dummy); /* We should always pass assumed size arrays the g77 way. */ fnbody = gfc_trans_g77_array (sym, fnbody); @@ -1967,7 +1966,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tree fnbody) case AS_ASSUMED_SHAPE: /* Must be a dummy parameter. */ - assert (sym->attr.dummy); + gcc_assert (sym->attr.dummy); fnbody = gfc_trans_dummy_array_bias (sym, sym->backend_decl, fnbody); @@ -1978,7 +1977,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tree fnbody) break; default: - abort (); + gcc_unreachable (); } } else if (sym->ts.type == BT_CHARACTER) @@ -1992,7 +1991,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tree fnbody) gfc_set_backend_locus (&loc); } else - abort (); + gcc_unreachable (); } return fnbody; @@ -2059,7 +2058,7 @@ gfc_generate_module_vars (gfc_namespace * ns) module_namespace = ns; /* Check if the frontend left the namespace in a reasonable state. */ - assert (ns->proc_name && !ns->proc_name->tlink); + gcc_assert (ns->proc_name && !ns->proc_name->tlink); /* Generate COMMON blocks. */ gfc_trans_common (ns); @@ -2181,7 +2180,7 @@ gfc_generate_function_code (gfc_namespace * ns) sym = ns->proc_name; /* Check that the frontend isn't still using this. */ - assert (sym->tlink == NULL); + gcc_assert (sym->tlink == NULL); sym->tlink = sym; /* Create the declaration for functions with global scope. */ @@ -2322,8 +2321,7 @@ gfc_generate_function_code (gfc_namespace * ns) void gfc_generate_constructors (void) { - if (gfc_static_ctors != NULL_TREE) - abort (); + gcc_assert (gfc_static_ctors == NULL_TREE); #if 0 tree fnname; tree type; diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 94653c95a54..52d6969c4f6 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -34,7 +34,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tree-gimple.h" #include "flags.h" #include -#include #include "gfortran.h" #include "trans.h" #include "trans-const.h" @@ -84,14 +83,14 @@ gfc_advance_se_ss_chain (gfc_se * se) { gfc_se *p; - assert (se != NULL && se->ss != NULL && se->ss != gfc_ss_terminator); + gcc_assert (se != NULL && se->ss != NULL && se->ss != gfc_ss_terminator); p = se; /* Walk down the parent chain. */ while (p != NULL) { /* Simple consistency check. */ - assert (p->parent == NULL || p->parent->ss == p->ss); + gcc_assert (p->parent == NULL || p->parent->ss == p->ss); p->ss = p->ss->next; @@ -125,14 +124,14 @@ gfc_conv_expr_present (gfc_symbol * sym) { tree decl; - assert (sym->attr.dummy && sym->attr.optional); + gcc_assert (sym->attr.dummy && sym->attr.optional); decl = gfc_get_symbol_decl (sym); if (TREE_CODE (decl) != PARM_DECL) { /* Array parameters use a temporary descriptor, we want the real parameter. */ - assert (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl)) + gcc_assert (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl)) || GFC_ARRAY_TYPE_P (TREE_TYPE (decl))); decl = GFC_DECL_SAVED_DESCRIPTOR (decl); } @@ -219,10 +218,10 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref) c = ref->u.c.component; - assert (c->backend_decl); + gcc_assert (c->backend_decl); field = c->backend_decl; - assert (TREE_CODE (field) == FIELD_DECL); + gcc_assert (TREE_CODE (field) == FIELD_DECL); decl = se->expr; tmp = build3 (COMPONENT_REF, TREE_TYPE (field), decl, field, NULL_TREE); @@ -232,7 +231,7 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref) { tmp = c->ts.cl->backend_decl; /* Components must always be constant length. */ - assert (tmp && INTEGER_CST_P (tmp)); + gcc_assert (tmp && INTEGER_CST_P (tmp)); se->string_length = tmp; } @@ -254,8 +253,8 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr) if (se->ss != NULL) { /* Check that something hasn't gone horribly wrong. */ - assert (se->ss != gfc_ss_terminator); - assert (se->ss->expr == expr); + gcc_assert (se->ss != gfc_ss_terminator); + gcc_assert (se->ss->expr == expr); /* A scalarized term. We already know the descriptor. */ se->expr = se->ss->data.info.descriptor; @@ -270,10 +269,10 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr) if (sym->attr.flavor == FL_PROCEDURE && se->expr != current_function_decl) { - assert (se->want_pointer); + gcc_assert (se->want_pointer); if (!sym->attr.dummy) { - assert (TREE_CODE (se->expr) == FUNCTION_DECL); + gcc_assert (TREE_CODE (se->expr) == FUNCTION_DECL); se->expr = gfc_build_addr_expr (NULL, se->expr); } return; @@ -309,7 +308,7 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr) if (sym->ts.type == BT_CHARACTER) { se->string_length = sym->ts.cl->backend_decl; - assert (se->string_length); + gcc_assert (se->string_length); } while (ref) @@ -340,7 +339,7 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr) break; default: - abort (); + gcc_unreachable (); break; } ref = ref->next; @@ -367,7 +366,7 @@ gfc_conv_unary_op (enum tree_code code, gfc_se * se, gfc_expr * expr) gfc_se operand; tree type; - assert (expr->ts.type != BT_CHARACTER); + gcc_assert (expr->ts.type != BT_CHARACTER); /* Initialize the operand. */ gfc_init_se (&operand, se); gfc_conv_expr_val (&operand, expr->op1); @@ -597,7 +596,7 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr) break; default: - abort(); + gcc_unreachable (); } switch (kind) { @@ -606,7 +605,7 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr) if (expr->op1->ts.type == BT_INTEGER) lse.expr = convert (gfc_int4_type_node, lse.expr); else - abort (); + gcc_unreachable (); /* Fall through. */ case 4: @@ -618,7 +617,7 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr) break; default: - abort(); + gcc_unreachable (); } switch (expr->op1->ts.type) @@ -636,7 +635,7 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr) break; default: - abort (); + gcc_unreachable (); } break; @@ -650,7 +649,7 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr) fndecl = built_in_decls[BUILT_IN_POW]; break; default: - abort (); + gcc_unreachable (); } break; @@ -664,12 +663,12 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr) fndecl = gfor_fndecl_math_cpow; break; default: - abort (); + gcc_unreachable (); } break; default: - abort (); + gcc_unreachable (); break; } @@ -688,8 +687,7 @@ gfc_conv_string_tmp (gfc_se * se, tree type, tree len) tree tmp; tree args; - if (TREE_TYPE (len) != gfc_charlen_type_node) - abort (); + gcc_assert (TREE_TYPE (len) == gfc_charlen_type_node); if (gfc_can_put_var_on_stack (len)) { @@ -736,7 +734,7 @@ gfc_conv_concat_op (gfc_se * se, gfc_expr * expr) tree args; tree tmp; - assert (expr->op1->ts.type == BT_CHARACTER + gcc_assert (expr->op1->ts.type == BT_CHARACTER && expr->op2->ts.type == BT_CHARACTER); gfc_init_se (&lse, se); @@ -899,8 +897,7 @@ gfc_conv_expr_op (gfc_se * se, gfc_expr * expr) case INTRINSIC_USER: case INTRINSIC_ASSIGN: /* These should be converted into function calls by the frontend. */ - abort (); - return; + gcc_unreachable (); default: fatal_error ("Unknown intrinsic op"); @@ -908,7 +905,7 @@ gfc_conv_expr_op (gfc_se * se, gfc_expr * expr) } /* The only exception to this is **, which is handled separately anyway. */ - assert (expr->op1->ts.type == expr->op2->ts.type); + gcc_assert (expr->op1->ts.type == expr->op2->ts.type); if (checkstring && expr->op1->ts.type != BT_CHARACTER) checkstring = 0; @@ -967,7 +964,7 @@ gfc_conv_function_val (gfc_se * se, gfc_symbol * sym) if (sym->attr.dummy) { tmp = gfc_get_symbol_decl (sym); - assert (TREE_CODE (TREE_TYPE (tmp)) == POINTER_TYPE + gcc_assert (TREE_CODE (TREE_TYPE (tmp)) == POINTER_TYPE && TREE_CODE (TREE_TYPE (TREE_TYPE (tmp))) == FUNCTION_TYPE); se->expr = tmp; @@ -978,7 +975,7 @@ gfc_conv_function_val (gfc_se * se, gfc_symbol * sym) sym->backend_decl = gfc_get_extern_function_decl (sym); tmp = sym->backend_decl; - assert (TREE_CODE (tmp) == FUNCTION_DECL); + gcc_assert (TREE_CODE (tmp) == FUNCTION_DECL); se->expr = gfc_build_addr_expr (NULL, tmp); } } @@ -1013,12 +1010,12 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym, { if (!sym->attr.elemental) { - assert (se->ss->type == GFC_SS_FUNCTION); + gcc_assert (se->ss->type == GFC_SS_FUNCTION); if (se->ss->useflags) { - assert (gfc_return_by_reference (sym) + gcc_assert (gfc_return_by_reference (sym) && sym->result->attr.dimension); - assert (se->loop != NULL); + gcc_assert (se->loop != NULL); /* Access the previously obtained result. */ gfc_conv_tmp_array_ref (se); @@ -1038,7 +1035,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym, arglist = gfc_chainon_list (arglist, se->expr); else if (sym->result->attr.dimension) { - assert (se->loop && se->ss); + gcc_assert (se->loop && se->ss); /* Set the type of the array. */ tmp = gfc_typenode_for_spec (&sym->ts); info->dimen = se->loop->dimen; @@ -1057,7 +1054,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym, } else if (sym->ts.type == BT_CHARACTER) { - assert (sym->ts.cl && sym->ts.cl->length + gcc_assert (sym->ts.cl && sym->ts.cl->length && sym->ts.cl->length->expr_type == EXPR_CONSTANT); len = gfc_conv_mpz_to_tree (sym->ts.cl->length->value.integer, sym->ts.cl->length->ts.kind); @@ -1071,7 +1068,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym, convert (gfc_charlen_type_node, len)); } else /* TODO: derived type function return values. */ - abort (); + gcc_unreachable (); } formal = sym->formal; @@ -1214,7 +1211,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym, se->string_length = len; } else - abort (); + gcc_unreachable (); } } } @@ -1273,7 +1270,7 @@ gfc_conv_statement_function (gfc_se * se, gfc_expr * expr) { /* Each dummy shall be specified, explicitly or implicitly, to be scalar. */ - assert (fargs->sym->attr.dimension == 0); + gcc_assert (fargs->sym->attr.dimension == 0); fsym = fargs->sym; /* Create a temporary to hold the value. */ @@ -1285,7 +1282,7 @@ gfc_conv_statement_function (gfc_se * se, gfc_expr * expr) /* Copy string arguments. */ tree arglen; - assert (fsym->ts.cl && fsym->ts.cl->length + gcc_assert (fsym->ts.cl && fsym->ts.cl->length && fsym->ts.cl->length->expr_type == EXPR_CONSTANT); arglen = TYPE_MAX_VALUE (TYPE_DOMAIN (type)); @@ -1380,8 +1377,8 @@ gfc_conv_function_expr (gfc_se * se, gfc_expr * expr) static void gfc_conv_array_constructor_expr (gfc_se * se, gfc_expr * expr) { - assert (se->ss != NULL && se->ss != gfc_ss_terminator); - assert (se->ss->expr == expr && se->ss->type == GFC_SS_CONSTRUCTOR); + gcc_assert (se->ss != NULL && se->ss != gfc_ss_terminator); + gcc_assert (se->ss->expr == expr && se->ss->type == GFC_SS_CONSTRUCTOR); gfc_conv_tmp_array_ref (se); gfc_advance_se_ss_chain (se); @@ -1513,8 +1510,7 @@ gfc_trans_subarray_assign (tree dest, gfc_component * cm, gfc_expr * expr) tmp = gfc_trans_scalar_assign (&lse, &rse, cm->ts.type); gfc_add_expr_to_block (&body, tmp); - if (rse.ss != gfc_ss_terminator) - abort (); + gcc_assert (rse.ss == gfc_ss_terminator); /* Generate the copying loops. */ gfc_trans_scalarizing_loops (&loop, &body); @@ -1648,8 +1644,8 @@ gfc_conv_structure (gfc_se * se, gfc_expr * expr, int init) tree type; tree tmp; - assert (se->ss == NULL); - assert (expr->expr_type == EXPR_STRUCTURE); + gcc_assert (se->ss == NULL); + gcc_assert (expr->expr_type == EXPR_STRUCTURE); type = gfc_typenode_for_spec (&expr->ts); if (!init) @@ -1699,7 +1695,7 @@ gfc_conv_substring_expr (gfc_se * se, gfc_expr * expr) ref = expr->ref; - assert(ref->type == REF_SUBSTRING); + gcc_assert (ref->type == REF_SUBSTRING); se->expr = gfc_build_string_const(expr->value.character.length, expr->value.character.string); @@ -1761,7 +1757,7 @@ gfc_conv_expr (gfc_se * se, gfc_expr * expr) break; default: - abort (); + gcc_unreachable (); break; } } @@ -1772,7 +1768,7 @@ gfc_conv_expr_lhs (gfc_se * se, gfc_expr * expr) gfc_conv_expr (se, expr); /* AFAICS all numeric lvalues have empty post chains. If not we need to figure out a way of rewriting an lvalue so that it has no post chain. */ - assert (expr->ts.type != BT_CHARACTER || !se->post.head); + gcc_assert (expr->ts.type != BT_CHARACTER || !se->post.head); } void @@ -1780,7 +1776,7 @@ gfc_conv_expr_val (gfc_se * se, gfc_expr * expr) { tree val; - assert (expr->ts.type != BT_CHARACTER); + gcc_assert (expr->ts.type != BT_CHARACTER); gfc_conv_expr (se, expr); if (se->post.head) { @@ -1885,7 +1881,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2) /* Scalar pointers. */ lse.want_pointer = 1; gfc_conv_expr (&lse, expr1); - assert (rss == gfc_ss_terminator); + gcc_assert (rss == gfc_ss_terminator); gfc_init_se (&rse, NULL); rse.want_pointer = 1; gfc_conv_expr (&rse, expr2); @@ -1936,12 +1932,12 @@ gfc_conv_string_parameter (gfc_se * se) type = TREE_TYPE (se->expr); if (TYPE_STRING_FLAG (type)) { - assert (TREE_CODE (se->expr) != INDIRECT_REF); + gcc_assert (TREE_CODE (se->expr) != INDIRECT_REF); se->expr = gfc_build_addr_expr (pchar_type_node, se->expr); } - assert (POINTER_TYPE_P (TREE_TYPE (se->expr))); - assert (se->string_length + gcc_assert (POINTER_TYPE_P (TREE_TYPE (se->expr))); + gcc_assert (se->string_length && TREE_CODE (TREE_TYPE (se->string_length)) == INTEGER_TYPE); } @@ -1958,7 +1954,7 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, bt type) if (type == BT_CHARACTER) { - assert (lse->string_length != NULL_TREE + gcc_assert (lse->string_length != NULL_TREE && rse->string_length != NULL_TREE); gfc_conv_string_parameter (lse); @@ -2010,12 +2006,12 @@ gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2) /* The frontend doesn't seem to bother filling in expr->symtree for intrinsic functions. */ - assert (expr2->value.function.isym + gcc_assert (expr2->value.function.isym || (gfc_return_by_reference (expr2->symtree->n.sym) && expr2->symtree->n.sym->result->attr.dimension)); ss = gfc_walk_expr (expr1); - assert (ss != gfc_ss_terminator); + gcc_assert (ss != gfc_ss_terminator); gfc_init_se (&se, NULL); gfc_start_block (&se.pre); se.want_pointer = 1; @@ -2024,7 +2020,7 @@ gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2) se.direct_byref = 1; se.ss = gfc_walk_expr (expr2); - assert (se.ss != gfc_ss_terminator); + gcc_assert (se.ss != gfc_ss_terminator); gfc_conv_function_expr (&se, expr2); gfc_add_block_to_block (&se.pre, &se.post); @@ -2075,7 +2071,7 @@ gfc_trans_assignment (gfc_expr * expr1, gfc_expr * expr2) && lss_section->type != GFC_SS_SECTION) lss_section = lss_section->next; - assert (lss_section != gfc_ss_terminator); + gcc_assert (lss_section != gfc_ss_terminator); /* Initialize the scalarizer. */ gfc_init_loopinfo (&loop); @@ -2146,10 +2142,8 @@ gfc_trans_assignment (gfc_expr * expr1, gfc_expr * expr2) } else { - if (lse.ss != gfc_ss_terminator) - abort (); - if (rse.ss != gfc_ss_terminator) - abort (); + gcc_assert (lse.ss == gfc_ss_terminator + && rse.ss == gfc_ss_terminator); if (loop.temp_ss != NULL) { @@ -2168,11 +2162,8 @@ gfc_trans_assignment (gfc_expr * expr1, gfc_expr * expr2) gfc_advance_se_ss_chain (&rse); gfc_conv_expr (&lse, expr1); - if (lse.ss != gfc_ss_terminator) - abort (); - - if (rse.ss != gfc_ss_terminator) - abort (); + gcc_assert (lse.ss == gfc_ss_terminator + && rse.ss == gfc_ss_terminator); tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts.type); gfc_add_expr_to_block (&body, tmp); diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 79d66898351..e986b5c1a0a 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -33,7 +33,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "real.h" #include "tree-gimple.h" #include "flags.h" -#include #include "gfortran.h" #include "arith.h" #include "intrinsic.h" @@ -197,7 +196,7 @@ gfc_conv_intrinsic_conversion (gfc_se * se, gfc_expr * expr) /* Evaluate the argument. */ type = gfc_typenode_for_spec (&expr->ts); - assert (expr->value.function.actual->expr); + gcc_assert (expr->value.function.actual->expr); arg = gfc_conv_intrinsic_function_args (se, expr); arg = TREE_VALUE (arg); @@ -354,7 +353,7 @@ gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr, int op) } /* Evaluate the argument. */ - assert (expr->value.function.actual->expr); + gcc_assert (expr->value.function.actual->expr); arg = gfc_conv_intrinsic_function_args (se, expr); /* Use a builtin function if one exists. */ @@ -402,7 +401,7 @@ gfc_conv_intrinsic_int (gfc_se * se, gfc_expr * expr, int op) /* Evaluate the argument. */ type = gfc_typenode_for_spec (&expr->ts); - assert (expr->value.function.actual->expr); + gcc_assert (expr->value.function.actual->expr); arg = gfc_conv_intrinsic_function_args (se, expr); arg = TREE_VALUE (arg); @@ -499,13 +498,12 @@ gfc_get_intrinsic_lib_fndecl (gfc_intrinsic_map_t * m, gfc_expr * expr) pdecl = &m->real8_decl; break; default: - abort (); + gcc_unreachable (); } } else if (ts->type == BT_COMPLEX) { - if (!m->complex_available) - abort (); + gcc_assert (m->complex_available); switch (ts->kind) { @@ -516,19 +514,18 @@ gfc_get_intrinsic_lib_fndecl (gfc_intrinsic_map_t * m, gfc_expr * expr) pdecl = &m->complex8_decl; break; default: - abort (); + gcc_unreachable (); } } else - abort (); + gcc_unreachable (); if (*pdecl) return *pdecl; if (m->libm_name) { - if (ts->kind != 4 && ts->kind != 8) - abort (); + gcc_assert (ts->kind == 4 || ts->kind == 8); snprintf (name, sizeof (name), "%s%s%s", ts->type == BT_COMPLEX ? "c" : "", m->name, @@ -615,7 +612,7 @@ gfc_conv_intrinsic_exponent (gfc_se * se, gfc_expr * expr) fndecl = gfor_fndecl_math_exponent8; break; default: - abort (); + gcc_unreachable (); } se->expr = gfc_build_function_call (fndecl, args); @@ -645,9 +642,9 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, int upper) if (se->ss) { /* Create an implicit second parameter from the loop variable. */ - assert (!arg2->expr); - assert (se->loop->dimen == 1); - assert (se->ss->expr == expr); + gcc_assert (!arg2->expr); + gcc_assert (se->loop->dimen == 1); + gcc_assert (se->ss->expr == expr); gfc_advance_se_ss_chain (se); bound = se->loop->loopvar[0]; bound = fold (build2 (MINUS_EXPR, gfc_array_index_type, bound, @@ -656,7 +653,7 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, int upper) else { /* use the passed argument. */ - assert (arg->next->expr); + gcc_assert (arg->next->expr); gfc_init_se (&argse, NULL); gfc_conv_expr_type (&argse, arg->next->expr, gfc_array_index_type); gfc_add_block_to_block (&se->pre, &argse.pre); @@ -669,7 +666,7 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, int upper) /* TODO: don't re-evaluate the descriptor on each iteration. */ /* Get a descriptor for the first parameter. */ ss = gfc_walk_expr (arg->expr); - assert (ss != gfc_ss_terminator); + gcc_assert (ss != gfc_ss_terminator); argse.want_pointer = 0; gfc_conv_expr_descriptor (&argse, arg->expr, ss); gfc_add_block_to_block (&se->pre, &argse.pre); @@ -679,9 +676,9 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, int upper) if (INTEGER_CST_P (bound)) { - assert (TREE_INT_CST_HIGH (bound) == 0); + gcc_assert (TREE_INT_CST_HIGH (bound) == 0); i = TREE_INT_CST_LOW (bound); - assert (i >= 0 && i < GFC_TYPE_ARRAY_RANK (TREE_TYPE (desc))); + gcc_assert (i >= 0 && i < GFC_TYPE_ARRAY_RANK (TREE_TYPE (desc))); } else { @@ -716,7 +713,7 @@ gfc_conv_intrinsic_abs (gfc_se * se, gfc_expr * expr) int n; args = gfc_conv_intrinsic_function_args (se, expr); - assert (args && TREE_CHAIN (args) == NULL_TREE); + gcc_assert (args && TREE_CHAIN (args) == NULL_TREE); val = TREE_VALUE (args); switch (expr->value.function.actual->expr->ts.type) @@ -736,13 +733,13 @@ gfc_conv_intrinsic_abs (gfc_se * se, gfc_expr * expr) n = BUILT_IN_CABS; break; default: - abort (); + gcc_unreachable (); } se->expr = fold (gfc_build_function_call (built_in_decls[n], args)); break; default: - abort (); + gcc_unreachable (); } } @@ -833,7 +830,7 @@ gfc_conv_intrinsic_mod (gfc_se * se, gfc_expr * expr, int modulo) break; default: - abort (); + gcc_unreachable (); } if (modulo) @@ -909,7 +906,7 @@ gfc_conv_intrinsic_sign (gfc_se * se, gfc_expr * expr) tmp = built_in_decls[BUILT_IN_COPYSIGN]; break; default: - abort (); + gcc_unreachable (); } se->expr = fold (gfc_build_function_call (tmp, arg)); return; @@ -936,7 +933,7 @@ gfc_conv_intrinsic_present (gfc_se * se, gfc_expr * expr) gfc_expr *arg; arg = expr->value.function.actual->expr; - assert (arg->expr_type == EXPR_VARIABLE); + gcc_assert (arg->expr_type == EXPR_VARIABLE); se->expr = gfc_conv_expr_present (arg->symtree->n.sym); se->expr = convert (gfc_typenode_for_spec (&expr->ts), se->expr); } @@ -976,7 +973,7 @@ gfc_conv_intrinsic_char (gfc_se * se, gfc_expr * expr) arg = TREE_VALUE (arg); /* We currently don't support character types != 1. */ - assert (expr->ts.kind == 1); + gcc_assert (expr->ts.kind == 1); type = gfc_character1_type_node; var = gfc_create_var (type, "char"); @@ -1058,7 +1055,7 @@ gfc_get_symbol_for_expr (gfc_expr * expr) gfc_symbol *sym; /* TODO: Add symbols for intrinsic function to the global namespace. */ - assert (strlen (expr->value.function.name) <= GFC_MAX_SYMBOL_LEN - 5); + gcc_assert (strlen (expr->value.function.name) <= GFC_MAX_SYMBOL_LEN - 5); sym = gfc_new_symbol (expr->value.function.name, NULL); sym->ts = expr->ts; @@ -1086,12 +1083,12 @@ gfc_conv_intrinsic_funcall (gfc_se * se, gfc_expr * expr) { gfc_symbol *sym; - assert (!se->ss || se->ss->expr == expr); + gcc_assert (!se->ss || se->ss->expr == expr); if (se->ss) - assert (expr->rank > 0); + gcc_assert (expr->rank > 0); else - assert (expr->rank == 0); + gcc_assert (expr->rank == 0); sym = gfc_get_symbol_for_expr (expr); gfc_conv_function_call (se, sym, expr->value.function.actual); @@ -1150,7 +1147,7 @@ gfc_conv_intrinsic_anyall (gfc_se * se, gfc_expr * expr, int op) /* Walk the arguments. */ arrayss = gfc_walk_expr (actual->expr); - assert (arrayss != gfc_ss_terminator); + gcc_assert (arrayss != gfc_ss_terminator); /* Initialize the scalarizer. */ gfc_init_loopinfo (&loop); @@ -1235,7 +1232,7 @@ gfc_conv_intrinsic_count (gfc_se * se, gfc_expr * expr) /* Walk the arguments. */ arrayss = gfc_walk_expr (actual->expr); - assert (arrayss != gfc_ss_terminator); + gcc_assert (arrayss != gfc_ss_terminator); /* Initialize the scalarizer. */ gfc_init_loopinfo (&loop); @@ -1310,15 +1307,15 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, int op) actual = expr->value.function.actual; arrayexpr = actual->expr; arrayss = gfc_walk_expr (arrayexpr); - assert (arrayss != gfc_ss_terminator); + gcc_assert (arrayss != gfc_ss_terminator); actual = actual->next->next; - assert (actual); + gcc_assert (actual); maskexpr = actual->expr; if (maskexpr) { maskss = gfc_walk_expr (maskexpr); - assert (maskss != gfc_ss_terminator); + gcc_assert (maskss != gfc_ss_terminator); } else maskss = NULL; @@ -1419,15 +1416,15 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) actual = expr->value.function.actual; arrayexpr = actual->expr; arrayss = gfc_walk_expr (arrayexpr); - assert (arrayss != gfc_ss_terminator); + gcc_assert (arrayss != gfc_ss_terminator); actual = actual->next->next; - assert (actual); + gcc_assert (actual); maskexpr = actual->expr; if (maskexpr) { maskss = gfc_walk_expr (maskexpr); - assert (maskss != gfc_ss_terminator); + gcc_assert (maskss != gfc_ss_terminator); } else maskss = NULL; @@ -1446,7 +1443,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) break; default: - abort (); + gcc_unreachable (); } /* Most negative(+HUGE) for maxval, most negative (-HUGE) for minval. */ @@ -1464,7 +1461,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) gfc_conv_ss_startstride (&loop); gfc_conv_loop_setup (&loop); - assert (loop.dimen == 1); + gcc_assert (loop.dimen == 1); /* Initialize the position to the first element. If the array has zero size we need to return zero. Otherwise use the first element of the @@ -1586,7 +1583,7 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, int op) break; default: - abort (); + gcc_unreachable (); } /* Most negative(-HUGE) for maxval, most positive (-HUGE) for minval. */ @@ -1598,15 +1595,15 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, int op) actual = expr->value.function.actual; arrayexpr = actual->expr; arrayss = gfc_walk_expr (arrayexpr); - assert (arrayss != gfc_ss_terminator); + gcc_assert (arrayss != gfc_ss_terminator); actual = actual->next->next; - assert (actual); + gcc_assert (actual); maskexpr = actual->expr; if (maskexpr) { maskss = gfc_walk_expr (maskexpr); - assert (maskss != gfc_ss_terminator); + gcc_assert (maskss != gfc_ss_terminator); } else maskss = NULL; @@ -1847,7 +1844,7 @@ gfc_conv_intrinsic_ishftc (gfc_se * se, gfc_expr * expr) tmp = gfor_fndecl_math_ishftc8; break; default: - abort (); + gcc_unreachable (); } se->expr = gfc_build_function_call (tmp, arg); return; @@ -1884,7 +1881,7 @@ gfc_conv_intrinsic_len (gfc_se * se, gfc_expr * expr) gfc_se argse; gfc_expr *arg; - assert (!se->ss); + gcc_assert (!se->ss); arg = expr->value.function.actual->expr; @@ -1910,7 +1907,7 @@ gfc_conv_intrinsic_len (gfc_se * se, gfc_expr * expr) decl = gfc_get_fake_result_decl (sym); len = sym->ts.cl->backend_decl; - assert (len); + gcc_assert (len); } else { @@ -1979,7 +1976,7 @@ gfc_conv_intrinsic_ichar (gfc_se * se, gfc_expr * expr) arg = gfc_conv_intrinsic_function_args (se, expr); arg = TREE_VALUE (TREE_CHAIN (arg)); - assert (POINTER_TYPE_P (TREE_TYPE (arg))); + gcc_assert (POINTER_TYPE_P (TREE_TYPE (arg))); arg = build1 (NOP_EXPR, pchar_type_node, arg); type = gfc_typenode_for_spec (&expr->ts); @@ -2041,7 +2038,7 @@ gfc_conv_intrinsic_size (gfc_se * se, gfc_expr * expr) actual = expr->value.function.actual; ss = gfc_walk_expr (actual->expr); - assert (ss != gfc_ss_terminator); + gcc_assert (ss != gfc_ss_terminator); argse.want_pointer = 1; gfc_conv_expr_descriptor (&argse, actual->expr, ss); gfc_add_block_to_block (&se->pre, &argse.pre); @@ -2119,7 +2116,7 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr) tree ptr; gfc_ss *ss; - assert (!se->ss); + gcc_assert (!se->ss); /* Get a pointer to the source. */ arg = expr->value.function.actual; @@ -2228,7 +2225,7 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr) if (ss1 == gfc_ss_terminator) { /* A pointer to a scalar. */ - assert (ss2 == gfc_ss_terminator); + gcc_assert (ss2 == gfc_ss_terminator); arg1se.want_pointer = 1; gfc_conv_expr (&arg1se, arg1->expr); arg2se.want_pointer = 1; @@ -2239,7 +2236,7 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr) else { /* A pointer to an array, call library function _gfor_associated. */ - assert (ss2 != gfc_ss_terminator); + gcc_assert (ss2 != gfc_ss_terminator); args = NULL_TREE; arg1se.want_pointer = 1; gfc_conv_expr_descriptor (&arg1se, arg1->expr, ss1); @@ -2339,7 +2336,7 @@ void prepare_arg_info (gfc_se * se, gfc_expr * expr, if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT) gfc_todo_error ("Non-IEEE floating format"); - assert (expr->expr_type == EXPR_FUNCTION); + gcc_assert (expr->expr_type == EXPR_FUNCTION); arg = gfc_conv_intrinsic_function_args (se, expr); arg = TREE_VALUE (arg); @@ -2404,7 +2401,7 @@ call_builtin_clz (tree result_type, tree op0) else if (op0_mode == TYPE_MODE (long_long_integer_type_node)) fn = built_in_decls[BUILT_IN_CLZLL]; else - abort (); + gcc_unreachable (); parms = tree_cons (NULL, op0, NULL); call = gfc_build_function_call (fn, parms); @@ -2671,7 +2668,7 @@ gfc_conv_intrinsic_function (gfc_se * se, gfc_expr * expr) switch (expr->value.function.isym->generic_id) { case GFC_ISYM_NONE: - abort (); + gcc_unreachable (); case GFC_ISYM_REPEAT: gfc_conv_intrinsic_repeat (se, expr); @@ -2981,8 +2978,7 @@ gfc_add_intrinsic_ss_code (gfc_loopinfo * loop ATTRIBUTE_UNUSED, gfc_ss * ss) break; default: - abort (); - break; + gcc_unreachable (); } } @@ -3015,7 +3011,7 @@ gfc_walk_intrinsic_libfunc (gfc_ss * ss, gfc_expr * expr) { gfc_ss *newss; - assert (expr->rank > 0); + gcc_assert (expr->rank > 0); newss = gfc_get_ss (); newss->type = GFC_SS_FUNCTION; @@ -3034,8 +3030,8 @@ gfc_walk_intrinsic_libfunc (gfc_ss * ss, gfc_expr * expr) int gfc_is_intrinsic_libcall (gfc_expr * expr) { - assert (expr->expr_type == EXPR_FUNCTION && expr->value.function.isym); - assert (expr->rank > 0); + gcc_assert (expr->expr_type == EXPR_FUNCTION && expr->value.function.isym); + gcc_assert (expr->rank > 0); switch (expr->value.function.isym->generic_id) { @@ -3073,7 +3069,7 @@ gfc_ss * gfc_walk_intrinsic_function (gfc_ss * ss, gfc_expr * expr, gfc_intrinsic_sym * isym) { - assert (isym); + gcc_assert (isym); if (isym->elemental) return gfc_walk_elemental_function_args (ss, expr, GFC_SS_SCALAR); diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 60f8edf4429..66d25b22db3 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -29,7 +29,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "ggc.h" #include "toplev.h" #include "real.h" -#include #include #include "gfortran.h" #include "trans.h" @@ -867,7 +866,7 @@ transfer_namelist_element (stmtblock_t * block, gfc_typespec * ts, tree addr_exp tree tmp, args, arg2; tree expr; - assert (POINTER_TYPE_P (TREE_TYPE (addr_expr))); + gcc_assert (POINTER_TYPE_P (TREE_TYPE (addr_expr))); if (ts->type == BT_DERIVED) { @@ -877,7 +876,7 @@ transfer_namelist_element (stmtblock_t * block, gfc_typespec * ts, tree addr_exp for (c = ts->derived->components; c; c = c->next) { tree field = c->backend_decl; - assert (field && TREE_CODE (field) == FIELD_DECL); + gcc_assert (field && TREE_CODE (field) == FIELD_DECL); tmp = build3 (COMPONENT_REF, TREE_TYPE (field), expr, field, NULL_TREE); @@ -913,7 +912,7 @@ transfer_namelist_element (stmtblock_t * block, gfc_typespec * ts, tree addr_exp case BT_CHARACTER: expr = gfc_build_indirect_ref (addr_expr); - assert (TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE); + gcc_assert (TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE); args = gfc_chainon_list (args, TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (expr)))); tmp = gfc_build_function_call (iocall_set_nml_val_char, args); @@ -958,7 +957,7 @@ build_dt (tree * function, gfc_code * code) set_error_locus (&block, &code->loc); dt = code->ext.dt; - assert (dt != NULL); + gcc_assert (dt != NULL); if (dt->io_unit) { @@ -1061,8 +1060,8 @@ gfc_trans_iolength (gfc_code * code) inq = code->ext.inquire; /* First check that preconditions are met. */ - assert(inq != NULL); - assert(inq->iolength != NULL); + gcc_assert (inq != NULL); + gcc_assert (inq->iolength != NULL); /* Connect to the iolength variable. */ if (inq->iolength) @@ -1125,7 +1124,7 @@ gfc_trans_dt_end (gfc_code * code) break; default: - abort (); + gcc_unreachable (); } tmp = gfc_build_function_call (function, NULL); @@ -1133,7 +1132,7 @@ gfc_trans_dt_end (gfc_code * code) if (last_dt != IOLENGTH) { - assert(code->ext.dt != NULL); + gcc_assert (code->ext.dt != NULL); io_result (&block, code->ext.dt->err, code->ext.dt->end, code->ext.dt->eor); } @@ -1189,14 +1188,14 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr) for (c = ts->derived->components; c; c = c->next) { field = c->backend_decl; - assert (field && TREE_CODE (field) == FIELD_DECL); + gcc_assert (field && TREE_CODE (field) == FIELD_DECL); tmp = build3 (COMPONENT_REF, TREE_TYPE (field), expr, field, NULL_TREE); if (c->ts.type == BT_CHARACTER) { - assert (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE); + gcc_assert (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE); se->string_length = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (tmp))); } @@ -1272,7 +1271,7 @@ gfc_trans_transfer (gfc_code * code) tmp = gfc_finish_block (&body); else { - assert (se.ss == gfc_ss_terminator); + gcc_assert (se.ss == gfc_ss_terminator); gfc_trans_scalarizing_loops (&loop, &body); gfc_add_block_to_block (&loop.pre, &loop.post); diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 0a43401fe59..7c63c9985e7 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -30,7 +30,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "ggc.h" #include "toplev.h" #include "real.h" -#include #include #include "gfortran.h" #include "trans.h" @@ -199,7 +198,7 @@ gfc_trans_call (gfc_code * code) gfc_init_se (&se, NULL); gfc_start_block (&se.pre); - assert (code->resolved_sym); + gcc_assert (code->resolved_sym); has_alternate_specifier = 0; /* Translate the call. */ @@ -214,7 +213,7 @@ gfc_trans_call (gfc_code * code) gfc_code *select_code; gfc_symbol *sym; select_code = code->next; - assert(select_code->op == EXEC_SELECT); + gcc_assert(select_code->op == EXEC_SELECT); sym = select_code->expr->symtree->n.sym; se.expr = convert (gfc_typenode_for_spec (&sym->ts), se.expr); gfc_add_modify_expr (&se.pre, sym->backend_decl, se.expr); @@ -1169,7 +1168,7 @@ gfc_trans_character_select (gfc_code *code) tree gfc_trans_select (gfc_code * code) { - assert (code && code->expr); + gcc_assert (code && code->expr); /* Empty SELECT constructs are legal. */ if (code->block == NULL) @@ -1367,7 +1366,7 @@ gfc_do_allocate (tree bytesize, tree size, tree * pdata, stmtblock_t * pblock, type = build_array_type (elem_type, type); if (gfc_can_put_var_on_stack (bytesize)) { - assert (INTEGER_CST_P (size)); + gcc_assert (INTEGER_CST_P (size)); tmpvar = gfc_create_var (type, "temp"); *pdata = NULL_TREE; } @@ -1382,7 +1381,7 @@ gfc_do_allocate (tree bytesize, tree size, tree * pdata, stmtblock_t * pblock, else if (gfc_index_integer_kind == 8) tmp = gfor_fndecl_internal_malloc64; else - abort (); + gcc_unreachable (); tmp = gfc_build_function_call (tmp, args); tmp = convert (TREE_TYPE (tmpvar), tmp); gfc_add_modify_expr (pblock, tmpvar, tmp); @@ -2389,8 +2388,7 @@ gfc_trans_forall_1 (gfc_code * code, forall_info * nested_forall_info) break; default: - abort (); - break; + gcc_unreachable (); } c = c->next; @@ -2614,7 +2612,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2, tree mask, /* In each where-assign-stmt, the mask-expr and the variable being defined shall be arrays of the same shape. */ - assert (lss != gfc_ss_terminator); + gcc_assert (lss != gfc_ss_terminator); /* The assignment needs scalarization. */ lss_section = lss; @@ -2624,7 +2622,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2, tree mask, && lss_section->type != GFC_SS_SECTION) lss_section = lss_section->next; - assert (lss_section != gfc_ss_terminator); + gcc_assert (lss_section != gfc_ss_terminator); /* Initialize the scalarizer. */ gfc_init_loopinfo (&loop); @@ -2717,10 +2715,8 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2, tree mask, } else { - if (lse.ss != gfc_ss_terminator) - abort (); - if (rse.ss != gfc_ss_terminator) - abort (); + gcc_assert (lse.ss == gfc_ss_terminator + && rse.ss == gfc_ss_terminator); if (loop.temp_ss != NULL) { @@ -2744,11 +2740,8 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2, tree mask, gfc_advance_se_ss_chain (&rse); gfc_conv_expr (&lse, expr1); - if (lse.ss != gfc_ss_terminator) - abort (); - - if (rse.ss != gfc_ss_terminator) - abort (); + gcc_assert (lse.ss == gfc_ss_terminator + && rse.ss == gfc_ss_terminator); /* Form the mask expression according to the mask tree list. */ index = count2; @@ -2923,7 +2916,7 @@ gfc_trans_where_2 (gfc_code * code, tree mask, tree pmask, break; default: - abort (); + gcc_unreachable (); } /* The next statement within the same where-body-construct. */ @@ -3051,7 +3044,7 @@ gfc_trans_allocate (gfc_code * code) /* Find the last reference in the chain. */ while (ref && ref->next != NULL) { - assert (ref->type != REF_ARRAY || ref->u.ar.type == AR_ELEMENT); + gcc_assert (ref->type != REF_ARRAY || ref->u.ar.type == AR_ELEMENT); ref = ref->next; } @@ -3122,7 +3115,7 @@ gfc_trans_deallocate (gfc_code * code) for (al = code->ext.alloc_list; al != NULL; al = al->next) { expr = al->expr; - assert (expr->expr_type == EXPR_VARIABLE); + gcc_assert (expr->expr_type == EXPR_VARIABLE); gfc_init_se (&se, NULL); gfc_start_block (&se.pre); diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 610449ffea1..a33e717ceb9 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -35,7 +35,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "trans-types.h" #include "trans-const.h" #include "real.h" -#include #if (GFC_MAX_DIMENSIONS < 10) @@ -114,8 +113,7 @@ gfc_init_kinds (void) if (bitsize > 2*HOST_BITS_PER_WIDE_INT) continue; - if (i_index == MAX_INT_KINDS) - abort (); + gcc_assert (i_index != MAX_INT_KINDS); /* Let the kind equal the bit size divided by 8. This insulates the programmer from the underlying byte size. */ @@ -170,11 +168,9 @@ gfc_init_kinds (void) saw_r16 = true; /* Careful we don't stumble a wierd internal mode. */ - if (r_index > 0 && gfc_real_kinds[r_index-1].kind == kind) - abort (); + gcc_assert (r_index <= 0 || gfc_real_kinds[r_index-1].kind != kind); /* Or have too many modes for the allocated space. */ - if (r_index == MAX_REAL_KINDS) - abort (); + gcc_assert (r_index != MAX_REAL_KINDS); gfc_real_kinds[r_index].kind = kind; gfc_real_kinds[r_index].radix = fmt->b; @@ -442,7 +438,7 @@ c_size_t_size (void) return LONG_TYPE_SIZE; if (strcmp (SIZE_TYPE, "short unsigned int") == 0) return SHORT_TYPE_SIZE; - abort (); + gcc_unreachable (); #else return LONG_TYPE_SIZE; #endif @@ -614,8 +610,7 @@ gfc_typenode_for_spec (gfc_typespec * spec) switch (spec->type) { case BT_UNKNOWN: - abort (); - break; + gcc_unreachable (); case BT_INTEGER: basetype = gfc_get_int_type (spec->kind); @@ -642,8 +637,7 @@ gfc_typenode_for_spec (gfc_typespec * spec) break; default: - abort (); - break; + gcc_unreachable (); } return basetype; } @@ -670,18 +664,18 @@ gfc_get_element_type (tree type) { if (TREE_CODE (type) == POINTER_TYPE) type = TREE_TYPE (type); - assert (TREE_CODE (type) == ARRAY_TYPE); + gcc_assert (TREE_CODE (type) == ARRAY_TYPE); element = TREE_TYPE (type); } else { - assert (GFC_DESCRIPTOR_TYPE_P (type)); + gcc_assert (GFC_DESCRIPTOR_TYPE_P (type)); element = TREE_TYPE (TYPE_FIELDS (type)); - assert (TREE_CODE (element) == POINTER_TYPE); + gcc_assert (TREE_CODE (element) == POINTER_TYPE); element = TREE_TYPE (element); - assert (TREE_CODE (element) == ARRAY_TYPE); + gcc_assert (TREE_CODE (element) == ARRAY_TYPE); element = TREE_TYPE (element); } @@ -763,7 +757,7 @@ gfc_get_element_type (tree type) int gfc_is_nodesc_array (gfc_symbol * sym) { - assert (sym->attr.dimension); + gcc_assert (sym->attr.dimension); /* We only want local arrays. */ if (sym->attr.pointer || sym->attr.allocatable) @@ -783,7 +777,7 @@ gfc_is_nodesc_array (gfc_symbol * sym) if (sym->attr.pointer || sym->attr.allocatable) return 0; - assert (sym->as->type == AS_EXPLICIT); + gcc_assert (sym->as->type == AS_EXPLICIT); return 1; } @@ -900,7 +894,7 @@ gfc_get_dtype (tree type, int rank) return gfc_index_zero_node; } - assert (rank <= GFC_DTYPE_RANK_MASK); + gcc_assert (rank <= GFC_DTYPE_RANK_MASK); size = TYPE_SIZE_UNIT (type); i = rank | (n << GFC_DTYPE_TYPE_SHIFT); @@ -1155,7 +1149,7 @@ gfc_get_array_type_bounds (tree etype, int dimen, tree * lbound, stride = fold (build2 (MULT_EXPR, gfc_array_index_type, tmp, stride)); /* Check the folding worked. */ - assert (INTEGER_CST_P (stride)); + gcc_assert (INTEGER_CST_P (stride)); } else stride = NULL_TREE; @@ -1347,7 +1341,7 @@ gfc_get_derived_type (gfc_symbol * derived) tree typenode, field, field_type, fieldlist; gfc_component *c; - assert (derived && derived->attr.flavor == FL_DERIVED); + gcc_assert (derived && derived->attr.flavor == FL_DERIVED); /* derived->backend_decl != 0 means we saw it before, but its components' backend_decl may have not been built. */ @@ -1392,7 +1386,7 @@ gfc_get_derived_type (gfc_symbol * derived) { /* Evaluate the string length. */ gfc_conv_const_charlen (c->ts.cl); - assert (c->ts.cl->backend_decl); + gcc_assert (c->ts.cl->backend_decl); } field_type = gfc_typenode_for_spec (&c->ts); @@ -1420,7 +1414,7 @@ gfc_get_derived_type (gfc_symbol * derived) DECL_PACKED (field) |= TYPE_PACKED (typenode); - assert (!c->backend_decl); + gcc_assert (!c->backend_decl); c->backend_decl = field; } @@ -1441,7 +1435,7 @@ gfc_return_by_reference (gfc_symbol * sym) if (!sym->attr.function) return 0; - assert (sym->attr.function); + gcc_assert (sym->attr.function); if (sym->result) sym = sym->result; @@ -1467,7 +1461,7 @@ gfc_get_function_type (gfc_symbol * sym) int alternate_return; /* Make sure this symbol is a function or a subroutine. */ - assert (sym->attr.flavor == FL_PROCEDURE); + gcc_assert (sym->attr.flavor == FL_PROCEDURE); if (sym->backend_decl) return TREE_TYPE (sym->backend_decl); diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 59decfe1ce1..7526c02f2ae 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -30,7 +30,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "defaults.h" #include "real.h" #include -#include #include "gfortran.h" #include "trans.h" #include "trans-stmt.h" @@ -56,7 +55,7 @@ gfc_advance_chain (tree t, int n) { for (; n > 0; n--) { - assert (t != NULL_TREE); + gcc_assert (t != NULL_TREE); t = TREE_CHAIN (t); } return t; @@ -151,9 +150,8 @@ gfc_add_modify_expr (stmtblock_t * pblock, tree lhs, tree rhs) for scalar assignments. We should probably have something similar for aggregates, but right now removing that check just breaks everything. */ - if (TREE_TYPE (rhs) != TREE_TYPE (lhs) - && !AGGREGATE_TYPE_P (TREE_TYPE (lhs))) - abort (); + gcc_assert (TREE_TYPE (rhs) == TREE_TYPE (lhs) + || AGGREGATE_TYPE_P (TREE_TYPE (lhs))); #endif tmp = fold (build2_v (MODIFY_EXPR, lhs, rhs)); @@ -197,7 +195,7 @@ gfc_merge_block_scope (stmtblock_t * block) tree decl; tree next; - assert (block->has_scope); + gcc_assert (block->has_scope); block->has_scope = 0; /* Remember the decls in this scope. */ @@ -292,8 +290,7 @@ tree gfc_build_indirect_ref (tree t) { tree type = TREE_TYPE (t); - if (!POINTER_TYPE_P (type)) - abort (); + gcc_assert (POINTER_TYPE_P (type)); type = TREE_TYPE (type); if (TREE_CODE (t) == ADDR_EXPR) @@ -309,8 +306,7 @@ tree gfc_build_array_ref (tree base, tree offset) { tree type = TREE_TYPE (base); - if (TREE_CODE (type) != ARRAY_TYPE) - abort (); + gcc_assert (TREE_CODE (type) == ARRAY_TYPE); type = TREE_TYPE (type); if (DECL_P (base)) @@ -356,7 +352,7 @@ gfc_trans_runtime_check (tree cond, tree msg, stmtblock_t * pblock) /* The code to generate the error. */ gfc_start_block (&block); - assert (TREE_CODE (msg) == STRING_CST); + gcc_assert (TREE_CODE (msg) == STRING_CST); TREE_USED (msg) = 1; @@ -396,7 +392,7 @@ gfc_trans_runtime_check (tree cond, tree msg, stmtblock_t * pblock) void gfc_add_expr_to_block (stmtblock_t * block, tree expr) { - assert (block); + gcc_assert (block); if (expr == NULL_TREE || IS_EMPTY_STMT (expr)) return; @@ -427,8 +423,8 @@ gfc_add_expr_to_block (stmtblock_t * block, tree expr) void gfc_add_block_to_block (stmtblock_t * block, stmtblock_t * append) { - assert (append); - assert (!append->has_scope); + gcc_assert (append); + gcc_assert (!append->has_scope); gfc_add_expr_to_block (block, append->head); append->head = NULL_TREE; -- 2.30.2