Commit ce889f00 by Richard Stallman

(build_binary_op): Improve shift warning messages.

From-SVN: r1595
parent 74bd77a8
...@@ -2356,7 +2356,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p) ...@@ -2356,7 +2356,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
else if (TREE_INT_CST_LOW (op1) < 0) else if (TREE_INT_CST_LOW (op1) < 0)
warning ("shift count is negative"); warning ("shift count is negative");
if (TREE_INT_CST_LOW (op1) >= TYPE_PRECISION (type0)) if (TREE_INT_CST_LOW (op1) >= TYPE_PRECISION (type0))
warning ("shift count exceeds width of value shifted"); warning ("shift count >= width of type");
} }
/* Use the type of the value to be shifted. /* Use the type of the value to be shifted.
This is what most traditional C compilers do. */ This is what most traditional C compilers do. */
...@@ -2381,7 +2381,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p) ...@@ -2381,7 +2381,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
warning ("shift count is negative"); warning ("shift count is negative");
if (TREE_CODE (op1) == INTEGER_CST if (TREE_CODE (op1) == INTEGER_CST
&& TREE_INT_CST_LOW (op1) >= TYPE_PRECISION (type0)) && TREE_INT_CST_LOW (op1) >= TYPE_PRECISION (type0))
warning ("shift count exceeds width of value shifted"); warning ("shift count >= width of type");
/* Use the type of the value to be shifted. /* Use the type of the value to be shifted.
This is what most traditional C compilers do. */ This is what most traditional C compilers do. */
result_type = type0; result_type = type0;
...@@ -2406,7 +2406,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p) ...@@ -2406,7 +2406,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
warning ("shift count is negative"); warning ("shift count is negative");
if (TREE_CODE (op1) == INTEGER_CST if (TREE_CODE (op1) == INTEGER_CST
&& TREE_INT_CST_LOW (op1) >= TYPE_PRECISION (type0)) && TREE_INT_CST_LOW (op1) >= TYPE_PRECISION (type0))
warning ("shift count >= width of value shifted"); warning ("shift count >= width of type");
/* Use the type of the value to be shifted. /* Use the type of the value to be shifted.
This is what most traditional C compilers do. */ This is what most traditional C compilers do. */
result_type = type0; result_type = type0;
......
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