This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

[PATCH 5/7] tc-i960.c: add some casts when assigning literals to args[i]


From: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>

parse_ldconst () takes a char ** as a in / out argument, and sometimes points
args[0] to a constant string.  Then in some cases after parse_ldconst ()
     returns md_assemble () twiddles the contents of arg[0].  So it seems like
     it would take some work to avoid these casts, and its not really clear
     that work is worth it.

gas/ChangeLog:

2016-03-29  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-i960.c (parse_ldconst): Cast to char * when assigning to
	args[0].
---
 gas/config/tc-i960.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/gas/config/tc-i960.c b/gas/config/tc-i960.c
index 45e8a44..667ab4c 100644
--- a/gas/config/tc-i960.c
+++ b/gas/config/tc-i960.c
@@ -1246,7 +1246,7 @@ parse_ldconst (char *arg[])	/* See above.  */
     {
     default:
       /* We're dependent on one or more symbols -- use "lda".  */
-      arg[0] = "lda";
+      arg[0] = (char *) "lda";
       break;
 
     case O_constant:
@@ -1263,26 +1263,26 @@ parse_ldconst (char *arg[])	/* See above.  */
                 lda xxx,<reg>.  */
       n = offs (e);
       if ((0 <= n) && (n <= 31))
-	arg[0] = "mov";
+	arg[0] = (char *) "mov";
       else if ((-31 <= n) && (n <= -1))
 	{
-	  arg[0] = "subo";
+	  arg[0] = (char *) "subo";
 	  arg[3] = arg[2];
 	  sprintf (buf, "%d", -n);
 	  arg[1] = buf;
-	  arg[2] = "0";
+	  arg[2] = (char *) "0";
 	}
       else if ((32 <= n) && (n <= 62))
 	{
-	  arg[0] = "addo";
+	  arg[0] = (char *) "addo";
 	  arg[3] = arg[2];
-	  arg[1] = "31";
+	  arg[1] = (char *) "31";
 	  sprintf (buf, "%d", n - 31);
 	  arg[2] = buf;
 	}
       else if ((shift = shift_ok (n)) != 0)
 	{
-	  arg[0] = "shlo";
+	  arg[0] = (char *) "shlo";
 	  arg[3] = arg[2];
 	  sprintf (buf, "%d", shift);
 	  arg[1] = buf;
@@ -1290,7 +1290,7 @@ parse_ldconst (char *arg[])	/* See above.  */
 	  arg[2] = buf2;
 	}
       else
-	arg[0] = "lda";
+	arg[0] = (char *) "lda";
       break;
 
     case O_illegal:
-- 
2.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]