parse.y: Do comparisons as the type of the first expression.
authorJames A. Morrison <phython@gcc.gnu.org>
Sat, 26 Feb 2005 14:01:03 +0000 (14:01 +0000)
committerJames A. Morrison <phython@gcc.gnu.org>
Sat, 26 Feb 2005 14:01:03 +0000 (14:01 +0000)
2005-02-26  James A. Morrison  <phython@gcc.gnu.org>

        * parse.y: Do comparisons as the type of the first expression.
        * treetree.c (tree_code_get_integer_value): Build integer constants
        with the proper type.

From-SVN: r95578

gcc/treelang/ChangeLog
gcc/treelang/parse.y
gcc/treelang/treetree.c

index ec9c1c3006a844eb6759f638e2592703eb1af71a..c1a2da61190087bc2e96937c73d8f1274cfab80d 100644 (file)
@@ -1,3 +1,9 @@
+2005-02-26  James A. Morrison  <phython@gcc.gnu.org>
+
+       * parse.y: Do comparisons as the type of the first expression.
+       * treetree.c (tree_code_get_integer_value): Build integer constants
+       with the proper type.
+
 2005-02-26  James A. Morrison  <phython@gcc.gnu.org>
 
        * Make-lang.in: Remove commented out code.
index 7ee71ec5a9c760326e4c593593cc167ac8069b5f..abf2bcbf795fb1f89b6e2fa23d427ce46bfc35ca 100644 (file)
@@ -591,8 +591,11 @@ INTEGER {
   struct prod_token_parm_item *tok = $2;
   struct prod_token_parm_item *op1 = $1;
   struct prod_token_parm_item *op2 = $3;
+  int type_code = NUMERIC_TYPE (op1);
+  if (!type_code)
+    YYERROR;
   $$ = make_plus_expression
-     (tok, op1, op2, SIGNED_INT, EXP_EQUALS);
+     (tok, op1, op2, type_code, EXP_EQUALS);
 }
 |variable_ref ASSIGN expression {
   struct prod_token_parm_item *tok = $2;
index eef293bb2f76536d349dcf7e95d83d3fd6635764..dcb7cd351a0568058e6d78299e7d65b92a2206a8 100644 (file)
@@ -650,7 +650,8 @@ tree_code_get_integer_value (unsigned char* chars, unsigned int length)
   for (ix = start; ix < length; ix++)
     val = val * 10 + chars[ix] - (unsigned char)'0';
   val = val*negative;
-  return build_int_cst_wide (NULL_TREE,
+  return build_int_cst_wide (start == 1 ?
+                               integer_type_node : unsigned_type_node,
                             val & 0xffffffff, (val >> 32) & 0xffffffff);
 }