On Tue, Oct 11, 2016 at 02:47:34PM -0400, Fritz Reese wrote: > On Tue, Oct 11, 2016 at 2:44 PM, Fritz Reese <fritzore...@gmail.com> wrote: > > On Mon, 2016-10-11 08:43 AM, Markus Trippelsdorf <mar...@trippelsdorf.de> > > wrote: > >> This patch breaks bootstrap: > > ... > > > > Sorry all!! was in a rush to get in the car this morning and made a > > hasty commit. Fixed for r241001 (sorry Jerry, I was a little too > > slow.)
While looking at the changes, I've noticed various coding style and formatting issues (mainly wrong indentation). The patch below should resolve what I've noticed. Ok for trunk if it passes bootstrap/regtest? 2016-10-11 Jakub Jelinek <ja...@redhat.com> * iresolve.c (is_trig_resolved, resolve_trig_call): Formatting fixes. * simplify.c (simplify_trig_call, degrees_f, radians_f, gfc_simplify_atrigd, gfc_simplify_cotan): Likewise. --- gcc/fortran/iresolve.c.jj 2016-10-11 20:51:01.754308259 +0200 +++ gcc/fortran/iresolve.c 2016-10-11 20:55:35.677852859 +0200 @@ -685,8 +685,8 @@ is_trig_resolved (gfc_expr *f) { /* We know we've already resolved the function if we see the lib call starting with '__'. */ - return f->value.function.name != NULL - && 0 == strncmp ("__", f->value.function.name, 2); + return (f->value.function.name != NULL + && strncmp ("__", f->value.function.name, 2) == 0); } /* Return a shallow copy of the function expression f. The original expression @@ -2744,28 +2744,26 @@ resolve_trig_call (gfc_expr *f, gfc_expr { switch (f->value.function.isym->id) { - case GFC_ISYM_ACOS: - return gfc_resolve_acos (f, x); - case GFC_ISYM_ASIN: - return gfc_resolve_asin (f, x); - case GFC_ISYM_ATAN: - return gfc_resolve_atan (f, x); - case GFC_ISYM_ATAN2: - /* NB. arg3 is unused for atan2 */ - return gfc_resolve_atan2 (f, x, NULL); - case GFC_ISYM_COS: - return gfc_resolve_cos (f, x); - case GFC_ISYM_COTAN: - return gfc_resolve_cotan (f, x); - case GFC_ISYM_SIN: - return gfc_resolve_sin (f, x); - case GFC_ISYM_TAN: - return gfc_resolve_tan (f, x); - default: - break; + case GFC_ISYM_ACOS: + return gfc_resolve_acos (f, x); + case GFC_ISYM_ASIN: + return gfc_resolve_asin (f, x); + case GFC_ISYM_ATAN: + return gfc_resolve_atan (f, x); + case GFC_ISYM_ATAN2: + /* NB. arg3 is unused for atan2 */ + return gfc_resolve_atan2 (f, x, NULL); + case GFC_ISYM_COS: + return gfc_resolve_cos (f, x); + case GFC_ISYM_COTAN: + return gfc_resolve_cotan (f, x); + case GFC_ISYM_SIN: + return gfc_resolve_sin (f, x); + case GFC_ISYM_TAN: + return gfc_resolve_tan (f, x); + default: + gcc_unreachable (); } - - gcc_unreachable (); } /* Resolve degree trig function as trigd (x) = trig (radians (x)). */ --- gcc/fortran/simplify.c.jj 2016-10-11 20:51:01.767308095 +0200 +++ gcc/fortran/simplify.c 2016-10-11 20:56:27.468199551 +0200 @@ -1717,27 +1717,24 @@ simplify_trig_call (gfc_expr *icall) /* The actual simplifiers will return NULL for non-constant x. */ switch (func) - { + { case GFC_ISYM_ACOS: - return gfc_simplify_acos (x); + return gfc_simplify_acos (x); case GFC_ISYM_ASIN: - return gfc_simplify_asin (x); + return gfc_simplify_asin (x); case GFC_ISYM_ATAN: - return gfc_simplify_atan (x); + return gfc_simplify_atan (x); case GFC_ISYM_COS: - return gfc_simplify_cos (x); + return gfc_simplify_cos (x); case GFC_ISYM_COTAN: - return gfc_simplify_cotan (x); + return gfc_simplify_cotan (x); case GFC_ISYM_SIN: - return gfc_simplify_sin (x); + return gfc_simplify_sin (x); case GFC_ISYM_TAN: - return gfc_simplify_tan (x); + return gfc_simplify_tan (x); default: - break; - } - - gfc_internal_error ("in simplify_trig_call(): Bad intrinsic"); - return NULL; + gfc_internal_error ("in simplify_trig_call(): Bad intrinsic"); + } } /* Convert a floating-point number from radians to degrees. */ @@ -1745,22 +1742,22 @@ simplify_trig_call (gfc_expr *icall) static void degrees_f (mpfr_t x, mp_rnd_t rnd_mode) { - mpfr_t tmp; - mpfr_init (tmp); + mpfr_t tmp; + mpfr_init (tmp); - /* Set x = x % 2pi to avoid offsets with large angles. */ - mpfr_const_pi (tmp, rnd_mode); - mpfr_mul_ui (tmp, tmp, 2, rnd_mode); - mpfr_fmod (tmp, x, tmp, rnd_mode); - - /* Set x = x * 180. */ - mpfr_mul_ui (x, x, 180, rnd_mode); - - /* Set x = x / pi. */ - mpfr_const_pi (tmp, rnd_mode); - mpfr_div (x, x, tmp, rnd_mode); + /* Set x = x % 2pi to avoid offsets with large angles. */ + mpfr_const_pi (tmp, rnd_mode); + mpfr_mul_ui (tmp, tmp, 2, rnd_mode); + mpfr_fmod (tmp, x, tmp, rnd_mode); + + /* Set x = x * 180. */ + mpfr_mul_ui (x, x, 180, rnd_mode); + + /* Set x = x / pi. */ + mpfr_const_pi (tmp, rnd_mode); + mpfr_div (x, x, tmp, rnd_mode); - mpfr_clear (tmp); + mpfr_clear (tmp); } /* Convert a floating-point number from degrees to radians. */ @@ -1768,21 +1765,21 @@ degrees_f (mpfr_t x, mp_rnd_t rnd_mode) static void radians_f (mpfr_t x, mp_rnd_t rnd_mode) { - mpfr_t tmp; - mpfr_init (tmp); - - /* Set x = x % 360 to avoid offsets with large angles. */ - mpfr_set_ui (tmp, 360, rnd_mode); - mpfr_fmod (tmp, x, tmp, rnd_mode); + mpfr_t tmp; + mpfr_init (tmp); - /* Set x = x * pi. */ - mpfr_const_pi (tmp, rnd_mode); - mpfr_mul (x, x, tmp, rnd_mode); + /* Set x = x % 360 to avoid offsets with large angles. */ + mpfr_set_ui (tmp, 360, rnd_mode); + mpfr_fmod (tmp, x, tmp, rnd_mode); + + /* Set x = x * pi. */ + mpfr_const_pi (tmp, rnd_mode); + mpfr_mul (x, x, tmp, rnd_mode); - /* Set x = x / 180. */ - mpfr_div_ui (x, x, 180, rnd_mode); + /* Set x = x / 180. */ + mpfr_div_ui (x, x, 180, rnd_mode); - mpfr_clear (tmp); + mpfr_clear (tmp); } @@ -1820,11 +1817,11 @@ gfc_simplify_atrigd (gfc_expr *icall) result = simplify_trig_call (icall); if (result && result->expr_type == EXPR_CONSTANT) - { + { /* Convert constant to degrees after passing off to actual simplifier. */ degrees_f (result->value.real, GFC_RND_MODE); return result; - } + } /* Let gfc_resolve_atrigd take care of the non-constant case. */ return NULL; @@ -6403,22 +6400,22 @@ gfc_simplify_cotan (gfc_expr *x) switch (x->ts.type) { - case BT_REAL: - mpfr_cot (result->value.real, x->value.real, GFC_RND_MODE); - break; + case BT_REAL: + mpfr_cot (result->value.real, x->value.real, GFC_RND_MODE); + break; - case BT_COMPLEX: - /* There is no builtin mpc_cot, so compute cot = cos / sin. */ - val = &result->value.complex; - mpc_init2 (swp, mpfr_get_default_prec ()); - mpc_cos (swp, x->value.complex, GFC_MPC_RND_MODE); - mpc_sin (*val, x->value.complex, GFC_MPC_RND_MODE); - mpc_div (*val, swp, *val, GFC_MPC_RND_MODE); - mpc_clear (swp); - break; + case BT_COMPLEX: + /* There is no builtin mpc_cot, so compute cot = cos / sin. */ + val = &result->value.complex; + mpc_init2 (swp, mpfr_get_default_prec ()); + mpc_cos (swp, x->value.complex, GFC_MPC_RND_MODE); + mpc_sin (*val, x->value.complex, GFC_MPC_RND_MODE); + mpc_div (*val, swp, *val, GFC_MPC_RND_MODE); + mpc_clear (swp); + break; - default: - gcc_unreachable (); + default: + gcc_unreachable (); } return range_check (result, "COTAN"); Jakub