This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: egcs/g77: Negative lower bound subscript on DEC Alpha not solved yet.
- To: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Subject: Re: egcs/g77: Negative lower bound subscript on DEC Alpha not solved yet.
- From: Richard Henderson <rth at cygnus dot com>
- Date: Thu, 12 Mar 1998 10:09:49 -0800
- Cc: Richard Henderson <rth at cygnus dot com>, burley at gnu dot org, egcs at cygnus dot com
- References: <9803061945.AA28803@moene.indiv.nluug.nl> <19980306134345.45415@canuck.cygnus.com> <9803071512.AA04446@moene.indiv.nluug.nl>
- Reply-To: Richard Henderson <rth at cygnus dot com>
> Is it really that easy ? I looked into your latest change to the
> Fortran frontend:
My last change really has nothing to do with it, but rather my
Oct 22 change.
Here is a patch to replace the scheme I had then with one that
preserves the signedness of the original type while continuing
to do widening.
r~
Thu Mar 12 09:53:14 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. Init new
ssizetype.
Index: gcc/f/com.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/f/com.c,v
retrieving revision 1.6.2.5
diff -c -p -d -r1.6.2.5 com.c
*** com.c 1998/02/11 01:01:58 1.6.2.5
--- com.c 1998/03/12 17:53:03
*************** static tree ldouble_ftype_ldouble;
*** 275,280 ****
--- 275,281 ----
inventions should be renamed to be canonical. Note that only
the ones currently required to be global are so. */
+ static tree ssizetype;
static tree ffecom_tree_fun_type_void;
static tree ffecom_tree_ptr_to_fun_type_void;
*************** static ffecomConcatList_ ffecom_concat_l
*** 433,441 ****
static void ffecom_debug_kludge_ (tree aggr, char *aggr_type, ffesymbol member,
tree member_type, ffetargetOffset offset);
static void ffecom_do_entry_ (ffesymbol fn, int entrynum);
! static tree ffecom_expr_ (ffebld expr, tree type_tree, tree dest_tree,
! ffebld dest, bool *dest_used,
! bool assignp);
static tree ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree,
ffebld dest, bool *dest_used);
static tree ffecom_expr_power_integer_ (ffebld left, ffebld right);
--- 434,441 ----
static void ffecom_debug_kludge_ (tree aggr, char *aggr_type, ffesymbol member,
tree member_type, ffetargetOffset offset);
static void ffecom_do_entry_ (ffesymbol fn, int entrynum);
! static tree ffecom_expr_ (ffebld expr, tree dest_tree, ffebld dest,
! bool *dest_used, bool assignp, bool widenp);
static tree ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree,
ffebld dest, bool *dest_used);
static tree ffecom_expr_power_integer_ (ffebld left, ffebld right);
*************** static char *ffecom_gfrt_argstring_[FFEC
*** 636,649 ****
/* NOTE: g77 currently doesn't use these; see setting of sizetype and
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_expr_(catlist,i) ((catlist).exprs[(i)])
#define ffecom_concat_list_maxlen_(catlist) ((catlist).maxlen)
--- 636,641 ----
*************** ffecom_do_entry_ (ffesymbol fn, int entr
*** 2666,2682 ****
Recursive descent on expr while making corresponding tree nodes and
attaching type info and such. If destination supplied and compatible
with temporary that would be made in certain cases, temporary isn't
! 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
static tree
! ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree,
! ffebld dest, bool *dest_used,
! bool assignp)
{
tree item;
tree list;
--- 2658,2669 ----
Recursive descent on expr while making corresponding tree nodes and
attaching type info and such. If destination supplied and compatible
with temporary that would be made in certain cases, temporary isn't
! made, destination used instead, and dest_used flag set TRUE. */
#if FFECOM_targetCURRENT == FFECOM_targetGCC
static tree
! ffecom_expr_ (ffebld expr, tree dest_tree, ffebld dest,
! bool *dest_used, bool assignp, bool widenp)
{
tree item;
tree list;
*************** ffecom_expr_ (ffebld expr, tree tree_typ
*** 2685,2691 ****
ffeinfoKindtype kt;
tree t;
tree dt; /* decl_tree for an ffesymbol. */
! tree tree_type;
tree left, right;
ffesymbol s;
enum tree_code code;
--- 2672,2678 ----
ffeinfoKindtype kt;
tree t;
tree dt; /* decl_tree for an ffesymbol. */
! tree tree_type, tree_type_x;
tree left, right;
ffesymbol s;
enum tree_code code;
*************** ffecom_expr_ (ffebld expr, tree tree_typ
*** 2699,2704 ****
--- 2686,2698 ----
kt = ffeinfo_kindtype (ffebld_info (expr));
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) ? sizetype : ssizetype);
+
switch (ffebld_op (expr))
{
case FFEBLD_opACCTER:
*************** ffecom_expr_ (ffebld expr, tree tree_typ
*** 2933,2958 ****
t = ffecom_2 (ARRAY_REF,
TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (t))),
t,
! ffecom_expr_ (dims[--i], sizetype, NULL, NULL,
! NULL, FALSE));
#endif
return t;
}
case FFEBLD_opUPLUS:
! left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL,
! NULL, FALSE);
return ffecom_1 (NOP_EXPR, tree_type, left);
case FFEBLD_opPAREN: /* ~~~Make sure Fortran rules respected here */
! left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL,
! NULL, FALSE);
return ffecom_1 (NOP_EXPR, tree_type, left);
case FFEBLD_opUMINUS:
! left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL,
! NULL, FALSE);
if (tree_type_x)
{
tree_type = tree_type_x;
--- 2927,2948 ----
t = ffecom_2 (ARRAY_REF,
TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (t))),
t,
! ffecom_expr_ (dims[--i], NULL, NULL, NULL, FALSE, TRUE));
#endif
return t;
}
case FFEBLD_opUPLUS:
! left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp);
return ffecom_1 (NOP_EXPR, tree_type, left);
case FFEBLD_opPAREN: /* ~~~Make sure Fortran rules respected here */
! left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp);
return ffecom_1 (NOP_EXPR, tree_type, left);
case FFEBLD_opUMINUS:
! left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp);
if (tree_type_x)
{
tree_type = tree_type_x;
*************** ffecom_expr_ (ffebld expr, tree tree_typ
*** 2961,2970 ****
return ffecom_1 (NEGATE_EXPR, tree_type, left);
case FFEBLD_opADD:
! left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL,
! NULL, FALSE);
! right = ffecom_expr_ (ffebld_right (expr), tree_type_x, NULL, NULL,
! NULL, FALSE);
if (tree_type_x)
{
tree_type = tree_type_x;
--- 2951,2958 ----
return ffecom_1 (NEGATE_EXPR, tree_type, left);
case FFEBLD_opADD:
! left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp);
! right = ffecom_expr_ (ffebld_right (expr), NULL, NULL, NULL, FALSE, widenp);
if (tree_type_x)
{
tree_type = tree_type_x;
*************** ffecom_expr_ (ffebld expr, tree tree_typ
*** 2974,2983 ****
return ffecom_2 (PLUS_EXPR, tree_type, left, right);
case FFEBLD_opSUBTRACT:
! left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL,
! NULL, FALSE);
! right = ffecom_expr_ (ffebld_right (expr), tree_type_x, NULL, NULL,
! NULL, FALSE);
if (tree_type_x)
{
tree_type = tree_type_x;
--- 2962,2969 ----
return ffecom_2 (PLUS_EXPR, tree_type, left, right);
case FFEBLD_opSUBTRACT:
! left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp);
! right = ffecom_expr_ (ffebld_right (expr), NULL, NULL, NULL, FALSE, widenp);
if (tree_type_x)
{
tree_type = tree_type_x;
*************** ffecom_expr_ (ffebld expr, tree tree_typ
*** 2987,2996 ****
return ffecom_2 (MINUS_EXPR, tree_type, left, right);
case FFEBLD_opMULTIPLY:
! left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL,
! NULL, FALSE);
! right = ffecom_expr_ (ffebld_right (expr), tree_type_x, NULL, NULL,
! NULL, FALSE);
if (tree_type_x)
{
tree_type = tree_type_x;
--- 2973,2980 ----
return ffecom_2 (MINUS_EXPR, tree_type, left, right);
case FFEBLD_opMULTIPLY:
! left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp);
! right = ffecom_expr_ (ffebld_right (expr), NULL, NULL, NULL, FALSE, widenp);
if (tree_type_x)
{
tree_type = tree_type_x;
*************** ffecom_expr_ (ffebld expr, tree tree_typ
*** 3000,3009 ****
return ffecom_2 (MULT_EXPR, tree_type, left, right);
case FFEBLD_opDIVIDE:
! left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL,
! NULL, FALSE);
! right = ffecom_expr_ (ffebld_right (expr), tree_type_x, NULL, NULL,
! NULL, FALSE);
if (tree_type_x)
{
tree_type = tree_type_x;
--- 2984,2991 ----
return ffecom_2 (MULT_EXPR, tree_type, left, right);
case FFEBLD_opDIVIDE:
! left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp);
! right = ffecom_expr_ (ffebld_right (expr), NULL, NULL, NULL, FALSE, widenp);
if (tree_type_x)
{
tree_type = tree_type_x;
*************** ffecom_expand_let_stmt (ffebld dest, ffe
*** 11461,11468 ****
if ((TREE_CODE (dest_tree) != VAR_DECL)
|| TREE_ADDRESSABLE (dest_tree))
! source_tree = ffecom_expr_ (source, NULL_TREE, dest_tree, dest,
! &dest_used, FALSE);
else
{
source_tree = ffecom_expr (source);
--- 11443,11450 ----
if ((TREE_CODE (dest_tree) != VAR_DECL)
|| TREE_ADDRESSABLE (dest_tree))
! source_tree = ffecom_expr_ (source, dest_tree, dest, &dest_used,
! FALSE, FALSE);
else
{
source_tree = ffecom_expr (source);
*************** ffecom_expand_let_stmt (ffebld dest, ffe
*** 11503,11510 ****
tree
ffecom_expr (ffebld expr)
{
! return ffecom_expr_ (expr, NULL_TREE, NULL_TREE, NULL, NULL,
! FALSE);
}
#endif
--- 11485,11491 ----
tree
ffecom_expr (ffebld expr)
{
! return ffecom_expr_ (expr, NULL_TREE, NULL, NULL, FALSE, FALSE);
}
#endif
*************** ffecom_expr (ffebld expr)
*** 11514,11521 ****
tree
ffecom_expr_assign (ffebld expr)
{
! return ffecom_expr_ (expr, NULL_TREE, NULL_TREE, NULL, NULL,
! TRUE);
}
#endif
--- 11495,11501 ----
tree
ffecom_expr_assign (ffebld expr)
{
! return ffecom_expr_ (expr, NULL_TREE, NULL, NULL, TRUE, FALSE);
}
#endif
*************** ffecom_expr_assign (ffebld expr)
*** 11525,11532 ****
tree
ffecom_expr_assign_w (ffebld expr)
{
! return ffecom_expr_ (expr, NULL_TREE, NULL_TREE, NULL, NULL,
! TRUE);
}
#endif
--- 11505,11511 ----
tree
ffecom_expr_assign_w (ffebld expr)
{
! return ffecom_expr_ (expr, NULL_TREE, NULL, NULL, TRUE, FALSE);
}
#endif
*************** ffecom_init_0 ()
*** 11762,11767 ****
--- 11741,11751 ----
}
}
+ /* Set the sizetype before we do anything else. */
+
+ sizetype = make_unsigned_type (POINTER_SIZE);
+ ssizetype = make_signed_type (POINTER_SIZE);
+
#if FFECOM_GCC_INCLUDE
ffecom_initialize_char_syntax_ ();
#endif
*************** ffecom_init_0 ()
*** 11804,11812 ****
long_long_unsigned_type_node = make_unsigned_type (LONG_LONG_TYPE_SIZE);
pushdecl (build_decl (TYPE_DECL, get_identifier ("long long unsigned int"),
long_long_unsigned_type_node));
-
- sizetype
- = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE)));
TREE_TYPE (TYPE_SIZE (integer_type_node)) = sizetype;
TREE_TYPE (TYPE_SIZE (char_type_node)) = sizetype;
--- 11788,11793 ----