[gfortran] Move operator fields of gfc_expr into union

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Tue Feb 8 17:14:00 GMT 2005


Since with my previous bugfix the op1, op2, operator, and uop fields are only
meaningful when none of the other fields in the value union inside of gfc_expr
are used, I suggest moving these fields inside the union, as in the attached
patch.

The only interesting hunks are:
 1. the one to gfc_extend_expr: since the union fields share their memory, one
has to be more careful than previously when changing the meaning of an
gfc_expr, and therefore those fields have to be nullified in order to not
confuse later passes.  Without this,
gfortran.fortran-torture/execute/userop.f90 failed.
2. the one to gfc_find_forall_index: since the operator fields are now used
only in EXPR_OP, I moved the part that searches them inside the switch.  I
could have done this together with my previous patch, but I didn't see this then.

Bubblestrapped and tested on i686-pc-linux-gnu.  Inspired by g95 again.

- Tobi

2005-02-08  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>

	* gfortran.h (gfc_expr): Move 'operator', 'op1', 'op2', and 'uop'
	fields into new struct 'op' inside the 'value' union.
	* arith.c (eval_intrinsic): Adapt all users.
	* dependency.c (gfc_check_dependency): Likewise.
	* dump-parse-tree.c (gfc_show_expr): Likewise.
	* expr.c (gfc_get_expr): Don't clear removed fields.
	(free_expr0, gfc_copy_expr, gfc_type_convert_binary,
	gfc_is_constant_expr, simplify_intrinsic_op, check_init_expr,
	check_intrinsic_op): Adapt to new field names.
	* interface.c (gfc_extend_expr): Likewise.  Also explicitly
	nullify 'esym' and 'isym' fields of new function call.
	* iresolve.c (gfc_resolve_dot_product, gfc_resolve_matmul):
	Adapt to renamed structure fields.
	* matchexp.c (build_node, match_level_1, match_expr): Likewise.
	* module.c (mio_expr): Likewise.
	* resolve.c (resolve_operator): Likewise.
	(gfc_find_forall_index): Likewise.  Only look through operands
	if dealing with EXPR_OP
	* trans-array.c (gfc_walk_op_expr): Adapt to renamed fields.
	* trans-expr.c (gfc_conv_unary_op, gfc_conv_power_op,
	gfc_conv_concat_op, gfc_conv_expr_op): Likewise.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: op.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050208/5179b182/attachment.ksh>


More information about the Fortran mailing list