Fix rl78 port WRT fallthru and sprintf warnings

Jeff Law law@redhat.com
Wed Oct 26 15:45:00 GMT 2016



rl78_calclate_death_nodes, with one exception wants to treat JUMP_INSNs 
and CALL_INSNs the same.  Naturally it's implemented with a case 
statement like

   case JUMP_INSN:
     <special case code>
   case CALL_INSN:
     <common code>

We're just missing the fallthru comment to silence the warning.

Like the stormy16, rl78 gets the buffer size wrong for ctor/dtor sections.

This patch fixes both issues.  Installed on the trunk.

Jeff
-------------- next part --------------
commit 7432dcb6fb3b23ce80d6631691d0a8150255cd93
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Oct 26 15:42:11 2016 +0000

    	* config/rl78/rl78.c (rl78_calculate_death_notes): Add fallthru
    	comment.
    	(rl78_asm_ctor_dtor): Increase buffer size.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241565 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d778e95..5214b9d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
 2016-10-26  Jeff Law  <law@redhat.com>
 
+	* config/rl78/rl78.c (rl78_calculate_death_notes): Add fallthru
+	comment.
+	(rl78_asm_ctor_dtor): Increase buffer size.
+
 	* config/stormy16/stormy16.c (xstormy16_asm_output_destrutor): Increase
 	buffer size.
 	(xstormy16_asm_output_constructor): Likewise.
diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
index 08ab899..5375e18 100644
--- a/gcc/config/rl78/rl78.c
+++ b/gcc/config/rl78/rl78.c
@@ -3863,6 +3863,7 @@ rtx_insn *insn;
 		 after this pass.  */
 	      break;
 	    }
+	  /* FALLTHRU */
 	case CALL_INSN:
 	  memset (dead, 0, sizeof (dead));
 	  break;
@@ -4657,7 +4658,7 @@ rl78_asm_ctor_dtor (rtx symbol, int priority, bool is_ctor)
     {
       /* This section of the function is based upon code copied
 	 from: gcc/varasm.c:get_cdtor_priority_section().  */
-      char buf[16];
+      char buf[18];
 
       sprintf (buf, "%s.%.5u", is_ctor ? ".ctors" : ".dtors",
 	       MAX_INIT_PRIORITY - priority);


More information about the Gcc-patches mailing list