From abc061c5f8d4bce2cdbd9a3a948e009b6a068fed Mon Sep 17 00:00:00 2001 From: toon Date: Thu, 19 Jul 2001 18:33:30 +0000 Subject: [PATCH] 2001-07-19 Toon Moene * tree.def: Document restriction on {L|R}SHIFT_EXPR's second argument. * doc/tree.texi: Ditto. * f/com.c (ffecom_expr_intrinsic_): Cope with it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44156 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/doc/c-tree.texi | 3 +++ gcc/f/ChangeLog | 5 +++++ gcc/f/com.c | 6 ++++-- gcc/tree.def | 4 +++- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9d23e01..76125c6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-07-19 Toon Moene + + * tree.def: Document restriction on {L|R}SHIFT_EXPR's second argument. + * doc/tree.texi: Ditto. + 2001-07-19 Mark Kettenis Jakub Jelinek diff --git a/gcc/doc/c-tree.texi b/gcc/doc/c-tree.texi index aa976e8..a35ab45 100644 --- a/gcc/doc/c-tree.texi +++ b/gcc/doc/c-tree.texi @@ -2003,6 +2003,9 @@ second operand is an expression for the number of bits by which to shift. Right shift should be treated as arithmetic, i.e., the high-order bits should be zero-filled when the expression has unsigned type and filled with the sign bit when the expression has signed type. +Note that the result is undefined if the second operand is larger +than the first operand's type size. + @item BIT_IOR_EXPR @itemx BIT_XOR_EXPR diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index c358f5d..15e9310 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,8 @@ +2001-07-19 Toon Moene + + * f/com.c (ffecom_expr_intrinsic_): Deal (correctly) with + {L|R}SHIFT_EXPR not working when shift > size of type. + 2001-07-17 Toon Moene * com.c (lang_print_error_function): Argument context diff --git a/gcc/f/com.c b/gcc/f/com.c index 00618ba..d8a4d10 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -4573,8 +4573,10 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, expr_tree = ffecom_3 (COND_EXPR, tree_type, ffecom_truth_value - (ffecom_2 (NE_EXPR, integer_type_node, - arg2_tree, + (ffecom_2 (LT_EXPR, integer_type_node, + ffecom_1 (ABS_EXPR, + integer_type_node, + arg2_tree), TYPE_SIZE (uns_type))), expr_tree, convert (tree_type, integer_zero_node)); diff --git a/gcc/tree.def b/gcc/tree.def index 4a78694..56bc8ef 100644 --- a/gcc/tree.def +++ b/gcc/tree.def @@ -617,7 +617,9 @@ DEFTREECODE (FFS_EXPR, "ffs_expr", '1', 1) Shift means logical shift if done on an unsigned type, arithmetic shift if done on a signed type. The second operand is the number of bits to - shift by; it need not be the same type as the first operand and result. */ + shift by; it need not be the same type as the first operand and result. + Note that the result is undefined if the second operand is larger + than the first operand's type size. */ DEFTREECODE (LSHIFT_EXPR, "lshift_expr", '2', 2) DEFTREECODE (RSHIFT_EXPR, "rshift_expr", '2', 2) DEFTREECODE (LROTATE_EXPR, "lrotate_expr", '2', 2) -- 2.7.4