aarch64.c (aarch64_elf_asm_constructor): Increase size of buf.
authorAndreas Tobler <andreast@gcc.gnu.org>
Mon, 23 Jan 2017 19:35:50 +0000 (20:35 +0100)
committerAndreas Tobler <andreast@gcc.gnu.org>
Mon, 23 Jan 2017 19:35:50 +0000 (20:35 +0100)
2017-01-23  Andreas Tobler  <andreast@gcc.gnu.org>

    * config/aarch64/aarch64.c (aarch64_elf_asm_constructor): Increase
    size of buf.
    (aarch64_elf_asm_destructor): Likewise.

From-SVN: r244828

gcc/ChangeLog
gcc/config/aarch64/aarch64.c

index 320298fefcc946d85377c709a5f98afa1504e3af..29d55742cc1d118290a4f088549cc3d0288c1976 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-23  Andreas Tobler  <andreast@gcc.gnu.org>
+
+       * config/aarch64/aarch64.c (aarch64_elf_asm_constructor): Increase
+       size of buf.
+       (aarch64_elf_asm_destructor): Likewise.
+
 2017-01-23  Bernd Schmidt  <bschmidt@redhat.com>
 
        PR rtl-optimization/78634
index c3992d8aceb9d7b52082f5ac8856a37ec2bc91cc..4607a3501e48c46ba6ee3bdd88b8f0d93da48853 100644 (file)
@@ -5787,7 +5787,10 @@ aarch64_elf_asm_constructor (rtx symbol, int priority)
   else
     {
       section *s;
-      char buf[18];
+      /* While priority is known to be in range [0, 65535], so 18 bytes
+         would be enough, the compiler might not know that.  To avoid
+         -Wformat-truncation false positive, use a larger size.  */
+      char buf[23];
       snprintf (buf, sizeof (buf), ".init_array.%.5u", priority);
       s = get_section (buf, SECTION_WRITE, NULL);
       switch_to_section (s);
@@ -5804,7 +5807,10 @@ aarch64_elf_asm_destructor (rtx symbol, int priority)
   else
     {
       section *s;
-      char buf[18];
+      /* While priority is known to be in range [0, 65535], so 18 bytes
+         would be enough, the compiler might not know that.  To avoid
+         -Wformat-truncation false positive, use a larger size.  */
+      char buf[23];
       snprintf (buf, sizeof (buf), ".fini_array.%.5u", priority);
       s = get_section (buf, SECTION_WRITE, NULL);
       switch_to_section (s);