From: Tobias Schlüter Date: Mon, 21 Jun 2004 17:16:25 +0000 (+0200) Subject: array.c (gfc_insert_constructor): Avoid redundant call to mpz_comp. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=da4f9e3b4db0404582e4328bd33a7977f3e8dccc;p=gcc.git array.c (gfc_insert_constructor): Avoid redundant call to mpz_comp. * array.c (gfc_insert_constructor): Avoid redundant call to mpz_comp. Add 2004 to copyright years. From-SVN: r83442 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5cbbc987dc0..d0e4e874618 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2004-06-21 Tobias Schlueter + + * array.c (gfc_insert_constructor): Avoid redundant call to + mpz_comp. Add 2004 to copyright years. + 2004-06-21 Joseph S. Myers * trans.h (stmtblock_t): Change has_scope to unsigned int. diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index bfe8aafc960..a7081d84305 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -1,5 +1,5 @@ /* Array things - Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc. Contributed by Andy Vaught This file is part of GCC. @@ -605,6 +605,7 @@ gfc_insert_constructor (gfc_expr * base, gfc_constructor * c1) { gfc_constructor *c, *pre; expr_t type; + int t; type = base->expr_type; @@ -617,12 +618,13 @@ gfc_insert_constructor (gfc_expr * base, gfc_constructor * c1) { if (type == EXPR_ARRAY) { - if (mpz_cmp (c->n.offset, c1->n.offset) < 0) + t = mpz_cmp (c->n.offset, c1->n.offset); + if (t < 0) { pre = c; c = c->next; } - else if (mpz_cmp (c->n.offset, c1->n.offset) == 0) + else if (t == 0) { gfc_error ("duplicated initializer"); break;