This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] h8300.c: Remove warnings.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 20 Jan 2003 23:10:45 -0500 (EST)
- Subject: [patch] h8300.c: Remove warnings.
Hi,
Attached is a patch to remove warnings.
In the first hunk, I did not assume anything about the integer size,
so I put an if statement.
In the other hunks, I assumed the input is 32-bit because only SImode
integers are considered, so I used a cast to unsigned int.
Tested on h8300 port. Committed.
Kazu Hirata
2003-01-20 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/h8300.c (const_costs): Remove a warning.
(output_plussi): Likewise.
(compute_plussi_length): Likewise.
(compute_plussi_cc): Likewise.
Index: h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.203
diff -u -r1.203 h8300.c
--- h8300.c 21 Jan 2003 03:54:49 -0000 1.203
+++ h8300.c 21 Jan 2003 04:04:11 -0000
@@ -1106,24 +1106,30 @@
switch (c)
{
case CONST_INT:
- switch (INTVAL (r))
- {
- case 0:
- return 0;
- case 1:
- case 2:
- case -1:
- case -2:
- return 0 + (outer_code == SET);
- case 4:
- case -4:
- if (TARGET_H8300H || TARGET_H8300S)
- return 0 + (outer_code == SET);
- else
- return 1;
- default:
- return 1;
- }
+ {
+ HOST_WIDE_INT n = INTVAL (r);
+
+ if (-4 <= n || n <= 4)
+ {
+ switch ((int) n)
+ {
+ case 0:
+ return 0;
+ case 1:
+ case 2:
+ case -1:
+ case -2:
+ return 0 + (outer_code == SET);
+ case 4:
+ case -4:
+ if (TARGET_H8300H || TARGET_H8300S)
+ return 0 + (outer_code == SET);
+ else
+ return 1;
+ }
+ }
+ return 1;
+ }
case CONST:
case LABEL_REF:
@@ -1908,7 +1914,7 @@
/* See if we can finish with 2 bytes. */
- switch (intval & 0xffffffff)
+ switch ((unsigned int) intval & 0xffffffff)
{
case 0x00000001:
case 0x00000002:
@@ -1968,7 +1974,7 @@
/* See if we can finish with 2 bytes. */
- switch (intval & 0xffffffff)
+ switch ((unsigned int) intval & 0xffffffff)
{
case 0x00000001:
case 0x00000002:
@@ -2023,7 +2029,7 @@
/* See if we can finish with 2 bytes. */
- switch (intval & 0xffffffff)
+ switch ((unsigned int) intval & 0xffffffff)
{
case 0x00000001:
case 0x00000002: