Re: pdp11: Fix warnings to allow compilation with a recent GCC and --enable-werror-always

2021-06-29 Thread Jan-Benedict Glaw
On Mon, 2021-06-28 16:17:13 +, Koning, Paul  wrote:
> > On Jun 28, 2021, at 11:33 AM, Jan-Benedict Glaw  wrote:
> > 
> > I'd like to install this patch to let the pdp11-aout configuration
> > build again with eg.
[...]
> > Okay for master?
> Yes, thanks!

Pushed. Thanks!

MfG, JBG

-- 


signature.asc
Description: PGP signature


Re: pdp11: Fix warnings to allow compilation with a recent GCC and --enable-werror-always

2021-06-28 Thread Koning, Paul via Gcc-patches



> On Jun 28, 2021, at 11:33 AM, Jan-Benedict Glaw  wrote:
> 
> Hi Paul!
> 
> I'd like to install this patch to let the pdp11-aout configuration
> build again with eg.
> 
> ../gcc/configure --target=pdp11-aout --enable-werror-always \
>   --enable-languages=all --disable-gcov --disable-shared \
>   --disable-threads --without-headers \
>   --prefix=/var/lib/laminar/run/gcc-pdp11-aout/5/toolchain-install
> 
> No testsuite (yet? Maybe I'd add a bit), but re-checked some Hello
> World'ish code for no changes and it still runs on a SIMH pdp11.
> ...
> Okay for master?
> 
> MfG, JBG

Yes, thanks!

The test suite "compile" section isn't completely clean yet but it mostly 
works.  Execution is more problematic at this point.

paul



pdp11: Fix warnings to allow compilation with a recent GCC and --enable-werror-always

2021-06-28 Thread Jan-Benedict Glaw
Hi Paul!

I'd like to install this patch to let the pdp11-aout configuration
build again with eg.

../gcc/configure --target=pdp11-aout --enable-werror-always \
--enable-languages=all --disable-gcov --disable-shared \
--disable-threads --without-headers \
--prefix=/var/lib/laminar/run/gcc-pdp11-aout/5/toolchain-install

No testsuite (yet? Maybe I'd add a bit), but re-checked some Hello
World'ish code for no changes and it still runs on a SIMH pdp11.

  * config/pdp11/pdp11.h (ASM_OUTPUT_SKIP): Fix signedness warning.
  * config/pdp11/pdp11.c (pdp11_asm_print_operand_punct_valid_p):
  Remove "register" keyword.
  (pdp11_initial_elimination_offset) Remove unused variable.
  (pdp11_cmp_length) Ditto.
  (pdp11_insn_cost): Ditto, and fix signedness warning.

diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h
index a21ae648439..9bc5e089f49 100644
--- a/gcc/config/pdp11/pdp11.h
+++ b/gcc/config/pdp11/pdp11.h
@@ -618,10 +618,12 @@ extern int current_first_parm_offset;
 fprintf (FILE, "\t.even\n")
 
 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
-  if (TARGET_DEC_ASM) \
-fprintf (FILE, "\t.blkb\t%o\n", (SIZE) & 0x);  \
-  else \
-fprintf (FILE, "\t.=.+ %#o\n", (SIZE) & 0x);
+  do { \
+if (TARGET_DEC_ASM)\
+  fprintf (FILE, "\t.blkb\t%o\n", (int) ((SIZE) & 0x));\
+else   \
+  fprintf (FILE, "\t.=.+ %#o\n", (int) ((SIZE) & 0x)); \
+  } while (0)
 
 /* This says how to output an assembler line
to define a global common symbol.  */
diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c
index b663b43a29c..4cab3aee598 100644
--- a/gcc/config/pdp11/pdp11.c
+++ b/gcc/config/pdp11/pdp11.c
@@ -829,12 +829,12 @@ pdp11_asm_print_operand_punct_valid_p (unsigned char c)
 }
 
 void
-print_operand_address (FILE *file, register rtx addr)
+print_operand_address (FILE *file, rtx addr)
 {
-  register rtx breg;
+  rtx breg;
   rtx offset;
   int again = 0;
-  
+
  retry:
 
   switch (GET_CODE (addr))
@@ -1160,12 +1160,11 @@ pdp11_addr_cost (rtx addr, machine_mode mode, 
addr_space_t as ATTRIBUTE_UNUSED,
 static int
 pdp11_insn_cost (rtx_insn *insn, bool speed)
 {
-  int base_cost, i;
+  int base_cost;
   rtx pat, set, dest, src, src2;
   machine_mode mode;
-  const char *fmt;
   enum rtx_code op;
-  
+
   if (recog_memoized (insn) < 0)
 return 0;
 
@@ -1462,24 +1461,24 @@ bool
 pushpop_regeq (rtx op, int regno)
 {
   rtx addr;
-  
+
   /* False if not memory reference.  */
   if (GET_CODE (op) != MEM)
 return FALSE;
-  
+
   /* Get the address of the memory reference.  */
   addr = XEXP (op, 0);
 
   if (GET_CODE (addr) == MEM)
 addr = XEXP (addr, 0);
-
+
   switch (GET_CODE (addr))
 {
 case PRE_DEC:
 case POST_INC:
 case PRE_MODIFY:
 case POST_MODIFY:
-  return REGNO (XEXP (addr, 0)) == regno;
+  return REGNO (XEXP (addr, 0)) == (unsigned) regno;
 default:
   return FALSE;
 }
@@ -1771,8 +1770,7 @@ int
 pdp11_initial_elimination_offset (int from, int to)
 {
   /* Get the size of the register save area.  */
-  int spoff;
-  
+
   if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
 return get_frame_size ();
   else if (from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
@@ -2106,15 +2104,14 @@ pdp11_cmp_length (rtx *operands, int words)
 {
   rtx inops[2];
   rtx exops[4][2];
-  rtx lb[1];
   int i, len = 0;
 
   if (!reload_completed)
 return 2;
-  
+
   inops[0] = operands[0];
   inops[1] = operands[1];
-  
+
   pdp11_expand_operands (inops, exops, 2, words, NULL, big);
 
   for (i = 0; i < words; i++)


Okay for master?

MfG, JBG

-- 


signature.asc
Description: PGP signature