Commit 092a4ef8 by Richard Henderson Committed by Richard Henderson

com.c (ffecom_expr_): Revert Oct 22 change.

* com.c (ffecom_expr_): Revert Oct 22 change.  Instead take a WIDENP
argument so that we can respect the signedness of the original type.
(ffecom_init_0): Do sizetype initialization first.

From-SVN: r18995
parent 896cced4
Sat Apr 4 17:45:01 1998 Richard Henderson <rth@cygnus.com>
* com.c (ffecom_expr_): Revert Oct 22 change. Instead take a WIDENP
argument so that we can respect the signedness of the original type.
(ffecom_init_0): Do sizetype initialization first.
1998-03-28 Dave Love <d.love@dl.ac.uk> 1998-03-28 Dave Love <d.love@dl.ac.uk>
* Make-lang.in (f771$(exeext)): Fix typpo. * Make-lang.in (f771$(exeext)): Fix typpo.
......
...@@ -434,9 +434,8 @@ static ffecomConcatList_ ffecom_concat_list_new_ (ffebld expr, ...@@ -434,9 +434,8 @@ static ffecomConcatList_ ffecom_concat_list_new_ (ffebld expr,
static void ffecom_debug_kludge_ (tree aggr, char *aggr_type, ffesymbol member, static void ffecom_debug_kludge_ (tree aggr, char *aggr_type, ffesymbol member,
tree member_type, ffetargetOffset offset); tree member_type, ffetargetOffset offset);
static void ffecom_do_entry_ (ffesymbol fn, int entrynum); static void ffecom_do_entry_ (ffesymbol fn, int entrynum);
static tree ffecom_expr_ (ffebld expr, tree type_tree, tree dest_tree, static tree ffecom_expr_ (ffebld expr, tree dest_tree, ffebld dest,
ffebld dest, bool *dest_used, bool *dest_used, bool assignp, bool widenp);
bool assignp);
static tree ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, static tree ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree,
ffebld dest, bool *dest_used); ffebld dest, bool *dest_used);
static tree ffecom_expr_power_integer_ (ffebld left, ffebld right); static tree ffecom_expr_power_integer_ (ffebld left, ffebld right);
...@@ -637,14 +636,6 @@ static char *ffecom_gfrt_argstring_[FFECOM_gfrt] ...@@ -637,14 +636,6 @@ static char *ffecom_gfrt_argstring_[FFECOM_gfrt]
/* NOTE: g77 currently doesn't use these; see setting of sizetype and /* NOTE: g77 currently doesn't use these; see setting of sizetype and
change that if you need to. -- jcb 09/01/91. */ change that if you need to. -- jcb 09/01/91. */
#ifndef SIZE_TYPE
#define SIZE_TYPE "long unsigned int"
#endif
#ifndef WCHAR_TYPE
#define WCHAR_TYPE "int"
#endif
#define ffecom_concat_list_count_(catlist) ((catlist).count) #define ffecom_concat_list_count_(catlist) ((catlist).count)
#define ffecom_concat_list_expr_(catlist,i) ((catlist).exprs[(i)]) #define ffecom_concat_list_expr_(catlist,i) ((catlist).exprs[(i)])
#define ffecom_concat_list_maxlen_(catlist) ((catlist).maxlen) #define ffecom_concat_list_maxlen_(catlist) ((catlist).maxlen)
...@@ -2725,17 +2716,12 @@ ffecom_do_entry_ (ffesymbol fn, int entrynum) ...@@ -2725,17 +2716,12 @@ ffecom_do_entry_ (ffesymbol fn, int entrynum)
Recursive descent on expr while making corresponding tree nodes and Recursive descent on expr while making corresponding tree nodes and
attaching type info and such. If destination supplied and compatible attaching type info and such. If destination supplied and compatible
with temporary that would be made in certain cases, temporary isn't with temporary that would be made in certain cases, temporary isn't
made, destination used instead, and dest_used flag set TRUE. made, destination used instead, and dest_used flag set TRUE. */
If TREE_TYPE is non-null, it overrides the type that the expression
would normally be computed in. This is most useful for array indices
which should be done in sizetype for efficiency. */
#if FFECOM_targetCURRENT == FFECOM_targetGCC #if FFECOM_targetCURRENT == FFECOM_targetGCC
static tree static tree
ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, ffecom_expr_ (ffebld expr, tree dest_tree, ffebld dest,
ffebld dest, bool *dest_used, bool *dest_used, bool assignp, bool widenp)
bool assignp)
{ {
tree item; tree item;
tree list; tree list;
...@@ -2744,7 +2730,7 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, ...@@ -2744,7 +2730,7 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree,
ffeinfoKindtype kt; ffeinfoKindtype kt;
tree t; tree t;
tree dt; /* decl_tree for an ffesymbol. */ tree dt; /* decl_tree for an ffesymbol. */
tree tree_type; tree tree_type, tree_type_x;
tree left, right; tree left, right;
ffesymbol s; ffesymbol s;
enum tree_code code; enum tree_code code;
...@@ -2758,6 +2744,13 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, ...@@ -2758,6 +2744,13 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree,
kt = ffeinfo_kindtype (ffebld_info (expr)); kt = ffeinfo_kindtype (ffebld_info (expr));
tree_type = ffecom_tree_type[bt][kt]; tree_type = ffecom_tree_type[bt][kt];
/* Widen integral arithmetic as desired while preserving signedness. */
tree_type_x = NULL_TREE;
if (widenp && tree_type
&& GET_MODE_CLASS (TYPE_MODE (tree_type)) == MODE_INT
&& TYPE_PRECISION (tree_type) < TYPE_PRECISION (sizetype))
tree_type_x = (TREE_UNSIGNED (tree_type) ? usizetype : ssizetype);
switch (ffebld_op (expr)) switch (ffebld_op (expr))
{ {
case FFEBLD_opACCTER: case FFEBLD_opACCTER:
...@@ -2992,26 +2985,22 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, ...@@ -2992,26 +2985,22 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree,
t = ffecom_2 (ARRAY_REF, t = ffecom_2 (ARRAY_REF,
TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (t))), TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (t))),
t, t,
ffecom_expr_ (dims[--i], sizetype, NULL, NULL, ffecom_expr_ (dims[--i], NULL, NULL, NULL, FALSE, TRUE));
NULL, FALSE));
#endif #endif
return t; return t;
} }
case FFEBLD_opUPLUS: case FFEBLD_opUPLUS:
left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL, left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp);
NULL, FALSE);
return ffecom_1 (NOP_EXPR, tree_type, left); return ffecom_1 (NOP_EXPR, tree_type, left);
case FFEBLD_opPAREN: /* ~~~Make sure Fortran rules respected here */ case FFEBLD_opPAREN: /* ~~~Make sure Fortran rules respected here */
left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL, left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp);
NULL, FALSE);
return ffecom_1 (NOP_EXPR, tree_type, left); return ffecom_1 (NOP_EXPR, tree_type, left);
case FFEBLD_opUMINUS: case FFEBLD_opUMINUS:
left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL, left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp);
NULL, FALSE);
if (tree_type_x) if (tree_type_x)
{ {
tree_type = tree_type_x; tree_type = tree_type_x;
...@@ -3020,10 +3009,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, ...@@ -3020,10 +3009,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree,
return ffecom_1 (NEGATE_EXPR, tree_type, left); return ffecom_1 (NEGATE_EXPR, tree_type, left);
case FFEBLD_opADD: case FFEBLD_opADD:
left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL, left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp);
NULL, FALSE); right = ffecom_expr_ (ffebld_right (expr), NULL, NULL, NULL, FALSE, widenp);
right = ffecom_expr_ (ffebld_right (expr), tree_type_x, NULL, NULL,
NULL, FALSE);
if (tree_type_x) if (tree_type_x)
{ {
tree_type = tree_type_x; tree_type = tree_type_x;
...@@ -3033,10 +3020,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, ...@@ -3033,10 +3020,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree,
return ffecom_2 (PLUS_EXPR, tree_type, left, right); return ffecom_2 (PLUS_EXPR, tree_type, left, right);
case FFEBLD_opSUBTRACT: case FFEBLD_opSUBTRACT:
left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL, left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp);
NULL, FALSE); right = ffecom_expr_ (ffebld_right (expr), NULL, NULL, NULL, FALSE, widenp);
right = ffecom_expr_ (ffebld_right (expr), tree_type_x, NULL, NULL,
NULL, FALSE);
if (tree_type_x) if (tree_type_x)
{ {
tree_type = tree_type_x; tree_type = tree_type_x;
...@@ -3046,10 +3031,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, ...@@ -3046,10 +3031,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree,
return ffecom_2 (MINUS_EXPR, tree_type, left, right); return ffecom_2 (MINUS_EXPR, tree_type, left, right);
case FFEBLD_opMULTIPLY: case FFEBLD_opMULTIPLY:
left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL, left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp);
NULL, FALSE); right = ffecom_expr_ (ffebld_right (expr), NULL, NULL, NULL, FALSE, widenp);
right = ffecom_expr_ (ffebld_right (expr), tree_type_x, NULL, NULL,
NULL, FALSE);
if (tree_type_x) if (tree_type_x)
{ {
tree_type = tree_type_x; tree_type = tree_type_x;
...@@ -3059,10 +3042,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, ...@@ -3059,10 +3042,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree,
return ffecom_2 (MULT_EXPR, tree_type, left, right); return ffecom_2 (MULT_EXPR, tree_type, left, right);
case FFEBLD_opDIVIDE: case FFEBLD_opDIVIDE:
left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL, left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp);
NULL, FALSE); right = ffecom_expr_ (ffebld_right (expr), NULL, NULL, NULL, FALSE, widenp);
right = ffecom_expr_ (ffebld_right (expr), tree_type_x, NULL, NULL,
NULL, FALSE);
if (tree_type_x) if (tree_type_x)
{ {
tree_type = tree_type_x; tree_type = tree_type_x;
...@@ -11563,8 +11544,8 @@ ffecom_expand_let_stmt (ffebld dest, ffebld source) ...@@ -11563,8 +11544,8 @@ ffecom_expand_let_stmt (ffebld dest, ffebld source)
if ((TREE_CODE (dest_tree) != VAR_DECL) if ((TREE_CODE (dest_tree) != VAR_DECL)
|| TREE_ADDRESSABLE (dest_tree)) || TREE_ADDRESSABLE (dest_tree))
source_tree = ffecom_expr_ (source, NULL_TREE, dest_tree, dest, source_tree = ffecom_expr_ (source, dest_tree, dest, &dest_used,
&dest_used, FALSE); FALSE, FALSE);
else else
{ {
source_tree = ffecom_expr (source); source_tree = ffecom_expr (source);
...@@ -11605,8 +11586,7 @@ ffecom_expand_let_stmt (ffebld dest, ffebld source) ...@@ -11605,8 +11586,7 @@ ffecom_expand_let_stmt (ffebld dest, ffebld source)
tree tree
ffecom_expr (ffebld expr) ffecom_expr (ffebld expr)
{ {
return ffecom_expr_ (expr, NULL_TREE, NULL_TREE, NULL, NULL, return ffecom_expr_ (expr, NULL_TREE, NULL, NULL, FALSE, FALSE);
FALSE);
} }
#endif #endif
...@@ -11616,8 +11596,7 @@ ffecom_expr (ffebld expr) ...@@ -11616,8 +11596,7 @@ ffecom_expr (ffebld expr)
tree tree
ffecom_expr_assign (ffebld expr) ffecom_expr_assign (ffebld expr)
{ {
return ffecom_expr_ (expr, NULL_TREE, NULL_TREE, NULL, NULL, return ffecom_expr_ (expr, NULL_TREE, NULL, NULL, TRUE, FALSE);
TRUE);
} }
#endif #endif
...@@ -11627,8 +11606,7 @@ ffecom_expr_assign (ffebld expr) ...@@ -11627,8 +11606,7 @@ ffecom_expr_assign (ffebld expr)
tree tree
ffecom_expr_assign_w (ffebld expr) ffecom_expr_assign_w (ffebld expr)
{ {
return ffecom_expr_ (expr, NULL_TREE, NULL_TREE, NULL, NULL, return ffecom_expr_ (expr, NULL_TREE, NULL, NULL, TRUE, FALSE);
TRUE);
} }
#endif #endif
...@@ -11866,6 +11844,12 @@ ffecom_init_0 () ...@@ -11866,6 +11844,12 @@ ffecom_init_0 ()
} }
} }
/* Set the sizetype before we do anything else. This _should_ be the
first type we create. */
t = make_unsigned_type (POINTER_SIZE);
assert (t == sizetype);
#if FFECOM_GCC_INCLUDE #if FFECOM_GCC_INCLUDE
ffecom_initialize_char_syntax_ (); ffecom_initialize_char_syntax_ ();
#endif #endif
...@@ -11909,9 +11893,6 @@ ffecom_init_0 () ...@@ -11909,9 +11893,6 @@ ffecom_init_0 ()
pushdecl (build_decl (TYPE_DECL, get_identifier ("long long unsigned int"), pushdecl (build_decl (TYPE_DECL, get_identifier ("long long unsigned int"),
long_long_unsigned_type_node)); long_long_unsigned_type_node));
set_sizetype
(TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE))));
error_mark_node = make_node (ERROR_MARK); error_mark_node = make_node (ERROR_MARK);
TREE_TYPE (error_mark_node) = error_mark_node; TREE_TYPE (error_mark_node) = error_mark_node;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment