This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Bad indentation and strange code in fortran/trans-array.c
On Tue, Jan 31, 2006 at 06:03:12PM -0800, Steve Kargl wrote:
> On Tue, Jan 31, 2006 at 05:57:04PM -0800, H. J. Lu wrote:
> > Around line 3923 in fortran/trans-array.c, there are
> >
> > if (expr->ts.type == BT_CHARACTER)
> > {
> > gcc_assert (expr->ts.cl && expr->ts.cl->length
> > && expr->ts.cl->length->expr_type == EXPR_CONSTANT);
> > loop.temp_ss->string_length = gfc_conv_mpz_to_tree
> > (expr->ts.cl->length->value.integer,
> > expr->ts.cl->length->ts.kind);
> > expr->ts.cl->backend_decl = loop.temp_ss->string_length;
> > }
> > loop.temp_ss->data.temp.type = gfc_typenode_for_spec (&expr->ts);
> > ^^^^^^^^^^^^^^^
> > Bad indentation.
> >
>
> If you go looking through the gfortran sources, you'll find
> all sorts of GNU style violations. Many are historical from
> when g95 was first integrated into GCC as gfortran.
>
>
> > Also why are there duplicated
>
> I can't answer that question.
>
I don't know much about FORTRAN front end. Is this patch the same
as the original code?
H.J.
---
--- gcc/fortran/trans-array.c.tmp 2006-01-19 09:18:34.000000000 -0800
+++ gcc/fortran/trans-array.c 2006-01-31 21:27:41.000000000 -0800
@@ -3911,20 +3911,16 @@ gfc_conv_expr_descriptor (gfc_se * se, g
loop.temp_ss = gfc_get_ss ();
loop.temp_ss->type = GFC_SS_TEMP;
loop.temp_ss->next = gfc_ss_terminator;
+ loop.temp_ss->data.temp.type = gfc_typenode_for_spec (&expr->ts);
if (expr->ts.type == BT_CHARACTER)
{
gcc_assert (expr->ts.cl && expr->ts.cl->length
&& expr->ts.cl->length->expr_type == EXPR_CONSTANT);
- loop.temp_ss->string_length = gfc_conv_mpz_to_tree
- (expr->ts.cl->length->value.integer,
- expr->ts.cl->length->ts.kind);
- expr->ts.cl->backend_decl = loop.temp_ss->string_length;
- }
- loop.temp_ss->data.temp.type = gfc_typenode_for_spec (&expr->ts);
+ expr->ts.cl->backend_decl
+ = gfc_conv_mpz_to_tree (expr->ts.cl->length->value.integer,
+ expr->ts.cl->length->ts.kind);
- /* ... which can hold our string, if present. */
- if (expr->ts.type == BT_CHARACTER)
- {
+ /* ... which can hold our string, if present. */
loop.temp_ss->string_length = TYPE_SIZE_UNIT (loop.temp_ss->data.temp.type);
se->string_length = loop.temp_ss->string_length;
}