This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, There used to be a discrepancy between the type the treelang frontend thought integer constants should be and what the frontend told the rest of the compiler. This patch cleans that up a bit. It also does comparisons in the type of the first expression to the comparison. The attached testcase used to have a bunch of useless casts. This patch has been bootstrapped and treelang tested on sparc-linux. -- Thanks, Jim http://www.student.cs.uwaterloo.ca/~ja2morri/ http://phython.blogspot.com http://open.nit.ca/wiki/?page=jim
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. Index: parse.y =================================================================== RCS file: /cvs/gcc/gcc/gcc/treelang/parse.y,v retrieving revision 1.20 diff -u -p -r1.20 parse.y --- parse.y 24 Feb 2005 16:12:39 -0000 1.20 +++ parse.y 26 Feb 2005 04:43:26 -0000 @@ -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: treetree.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/treelang/treetree.c,v retrieving revision 1.55 diff -u -p -r1.55 treetree.c --- treetree.c 24 Feb 2005 16:23:14 -0000 1.55 +++ treetree.c 26 Feb 2005 04:43:27 -0000 @@ -650,7 +637,8 @@ tree_code_get_integer_value (unsigned ch 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); }
Attachment:
unsigned.tree
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |