]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-ada-spec.c (dump_ada_function_declaration): Increase buffer size to guarantee it...
authorMartin Sebor <msebor@redhat.com>
Thu, 1 Sep 2016 22:47:49 +0000 (22:47 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Thu, 1 Sep 2016 22:47:49 +0000 (16:47 -0600)
gcc/c-family/ChangeLog:

* c-ada-spec.c (dump_ada_function_declaration): Increase buffer
size to guarantee it fits the output of the formatted function
regardless of its arguments.

gcc/cp/ChangeLog:

* mangle.c: Increase buffer size to guarantee it fits the output
of the formatted function regardless of its arguments.

gcc/go/ChangeLog:

* gofrontend/expressions.cc: Increase buffer size to guarantee
it fits the output of the formatted function regardless of its
arguments.

gcc/java/ChangeLog:

* decl.c (give_name_to_locals): Increase buffer size to guarantee
it fits the output of the formatted function regardless of its
arguments.
* mangle_name.c (append_unicode_mangled_name): Same.

gcc/ChangeLog:

* genmatch.c (parser::parse_expr): Increase buffer size to guarantee
it fits the output of the formatted function regardless of its
arguments.
* gcc/genmodes.c (parser::parse_expr): Same.
* gimplify.c (gimplify_asm_expr): Same.
* passes.c (pass_manager::register_one_dump_file): Same.
* print-tree.c (print_node): Same.

From-SVN: r239949

15 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-ada-spec.c
gcc/cp/ChangeLog
gcc/cp/mangle.c
gcc/genmatch.c
gcc/genmodes.c
gcc/gimplify.c
gcc/go/ChangeLog
gcc/go/gofrontend/expressions.cc
gcc/java/ChangeLog
gcc/java/decl.c
gcc/java/mangle_name.c
gcc/passes.c
gcc/print-tree.c

index aa5b1e007387209a3685b8cd9df190f149dab1cb..854bcc0cbdf8f0f3921fe40e6a7926a1dd7fdaca 100644 (file)
@@ -1,3 +1,13 @@
+2016-09-01 Martin Sebor  <msebor@redhat.com>
+
+       * genmatch.c (parser::parse_expr): Increase buffer size to guarantee
+       it fits the output of the formatted function regardless of its
+       arguments.
+       * gcc/genmodes.c (parser::parse_expr): Same.
+       * gimplify.c (gimplify_asm_expr): Same.
+       * passes.c (pass_manager::register_one_dump_file): Same.
+       * print-tree.c (print_node): Same.
+
 2016-09-01  Segher Boessenkool  <segher@kernel.crashing.org>
 
        * config/rs6000/altivec.md: Use VSCR_REGNO instead of 110 throughout.
index 8a40f75da4f4fd70d62a6dda9c9bbee7dba88111..622a288daac92e8c4a1ac862c3574c84c7e8e8cc 100644 (file)
@@ -1,3 +1,9 @@
+2016-09-01 Martin Sebor  <msebor@redhat.com>
+
+       * c-ada-spec.c (dump_ada_function_declaration): Increase buffer
+       size to guarantee it fits the output of the formatted function
+       regardless of its arguments.
+
 2016-09-01  Marek Polacek  <polacek@redhat.com>
 
        PR c/7652
index a4e0c38cef9f0a52beea23bdb981d933dacbfc5d..6a8e04b8d365108cb0b972dcda37eb2b04f3ca66 100644 (file)
@@ -1603,7 +1603,7 @@ dump_ada_function_declaration (pretty_printer *buffer, tree func,
 {
   tree arg;
   const tree node = TREE_TYPE (func);
-  char buf[16];
+  char buf[17];
   int num = 0, num_args = 0, have_args = true, have_ellipsis = false;
 
   /* Compute number of arguments.  */
index e68ee629600ae9ad1de847b6e48d84b60c4ea7e3..c5738561dc196c9944aa29bd7278c2a36a7ea4f9 100644 (file)
@@ -1,3 +1,8 @@
+2016-09-01 Martin Sebor  <msebor@redhat.com>
+
+       * mangle.c: Increase buffer size to guarantee it fits the output
+       of the formatted function regardless of its arguments.
+
 2016-09-01  Marek Polacek  <polacek@redhat.com>
 
        PR c/7652
index d34743c9c68c9d970a023f0c51417049d3d7f538..bd23260c0883c5cfdc176183f1bb32e8abc0ae53 100644 (file)
@@ -1740,7 +1740,9 @@ static void
 write_real_cst (const tree value)
 {
   long target_real[4];  /* largest supported float */
-  char buffer[9];       /* eight hex digits in a 32-bit number */
+  /* Buffer for eight hex digits in a 32-bit number but big enough
+     even for 64-bit long to avoid warnings.  */
+  char buffer[17];
   int i, limit, dir;
 
   tree type = TREE_TYPE (value);
index 02e945af71d8bb0fdfa4c0589654228d6b0a7ac8..6195a3b7ed00732f64552c879ce19bfa1308bc7b 100644 (file)
@@ -4051,7 +4051,8 @@ parser::parse_expr ()
   else if (force_capture)
     {
       unsigned num = capture_ids->elements ();
-      char id[8];
+      /* Big enough for a 32-bit UINT_MAX plus prefix.  */
+      char id[13];
       bool existed;
       sprintf (id, "__%u", num);
       capture_ids->get_or_insert (xstrdup (id), &existed);
index 1170d4f5b0cd84c8b36aaa5a1e2c50bd229113b9..92ca055f4eb07301ba1c96dc74ca7393cab6ca45 100644 (file)
@@ -486,7 +486,8 @@ make_vector_modes (enum mode_class cl, unsigned int width,
 {
   struct mode_data *m;
   struct mode_data *v;
-  char buf[8];
+  /* Big enough for a 32-bit UINT_MAX plus the text.  */
+  char buf[12];
   unsigned int ncomponents;
   enum mode_class vclass = vector_class (cl);
 
index 288b4727dd82709940cdfe31d6819aacb11bd341..21e1c093385c6f1a417ed9c2020752d16a29e529 100644 (file)
@@ -5346,7 +5346,8 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
             flexibility, split it into separate input and output
             operands.  */
          tree input;
-         char buf[10];
+         /* Buffer big enough to format a 32-bit UINT_MAX into.  */
+         char buf[11];
 
          /* Turn the in/out constraint into an output constraint.  */
          char *p = xstrdup (constraint);
@@ -5356,7 +5357,7 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
          /* And add a matching input constraint.  */
          if (allows_reg)
            {
-             sprintf (buf, "%d", i);
+             sprintf (buf, "%u", i);
 
              /* If there are multiple alternatives in the constraint,
                 handle each of them individually.  Those that allow register
index 2052a977029f260e25eed447c17cdc27837c116b..4c75010e900f594756fc9f2125f109d9fd083271 100644 (file)
@@ -1,3 +1,9 @@
+2016-09-01 Martin Sebor  <msebor@redhat.com>
+
+       * gofrontend/expressions.cc: Increase buffer size to guarantee
+       it fits the output of the formatted function regardless of its
+       arguments.
+
 2016-08-29  Ian Lance Taylor  <iant@google.com>
 
        * lang.opt (fgo-c-header, fgo-compiling-runtime): New options.
index 803611d544210c857b0560fc74641c9ea4f8f91f..99f9f6694077f45f73f56a798a356e8cdb3a01e0 100644 (file)
@@ -9050,7 +9050,8 @@ Call_expression::do_flatten(Gogo* gogo, Named_object*,
       Location loc = this->location();
 
       int i = 0;
-      char buf[10];
+      /* Buffer large enough for INT_MAX plus the prefix.  */
+      char buf[14];
       for (Typed_identifier_list::const_iterator p = results->begin();
            p != results->end();
            ++p, ++i)
index 74c5be8cc5d65b07ca9e44095883b0ca85b8bc20..781fecdefc14fdc7bdfc90513a39fd81b80b4431 100644 (file)
@@ -1,3 +1,10 @@
+2016-09-01 Martin Sebor  <msebor@redhat.com>
+
+       * decl.c (give_name_to_locals): Increase buffer size to guarantee
+       it fits the output of the formatted function regardless of its
+       arguments.
+       * mangle_name.c (append_unicode_mangled_name): Same.
+
 2016-08-26  Richard Biener  <rguenther@suse.de>
 
        java/
index 36989d380abcb6be6fe53a1f872e4b21f73206b8..70eac31511373398935b6afbdc4b162f7671f1eb 100644 (file)
@@ -1721,7 +1721,8 @@ give_name_to_locals (JCF *jcf)
            DECL_NAME (parm) = get_identifier ("this");
          else
            {
-             char buffer[12];
+             /* Buffer large enough for INT_MAX plus prefix.  */
+             char buffer[15];
              sprintf (buffer, "ARG_%d", arg_i);
              DECL_NAME (parm) = get_identifier (buffer);
            }
index 00374dbd298fd9904cc8b3c2447221786c71d2ad..7627c5d5df30e558648d47b59a6ebb268e4e25fa 100644 (file)
@@ -231,7 +231,8 @@ void
 append_gpp_mangled_name (const char *name, int len)
 {
   int encoded_len, needs_escapes;
-  char buf[6];
+  /* Buffer large enough for INT_MIN.  */
+  char buf[9];
 
   MANGLE_CXX_KEYWORDS (name, len);
 
@@ -270,7 +271,8 @@ append_unicode_mangled_name (const char *name, int len)
       /* Everything else needs encoding */
       else
        {
-         char buf [9];
+         /* Buffer large enough for UINT_MAX plus the prefix.  */
+         char buf [13];
          if (ch == '_' || ch == 'U')
            {
              /* Prepare to recognize __U */
index c7d7dbe7e9115806083f6954ce40d4a5b742c10d..07ebf8b4a2fe1ca1f67b008be37df8645a3215ac 100644 (file)
@@ -771,7 +771,9 @@ pass_manager::register_one_dump_file (opt_pass *pass)
 {
   char *dot_name, *flag_name, *glob_name;
   const char *name, *full_name, *prefix;
-  char num[10];
+
+  /* Buffer big enough to format a 32-bit UINT_MAX into.  */
+  char num[11];
   int flags, id;
   int optgroup_flags = OPTGROUP_NONE;
   gcc::dump_manager *dumps = m_ctxt->get_dumps ();
@@ -779,7 +781,7 @@ pass_manager::register_one_dump_file (opt_pass *pass)
   /* See below in next_pass_1.  */
   num[0] = '\0';
   if (pass->static_pass_number != -1)
-    sprintf (num, "%d", ((int) pass->static_pass_number < 0
+    sprintf (num, "%u", ((int) pass->static_pass_number < 0
                         ? 1 : pass->static_pass_number));
 
   /* The name is both used to identify the pass for the purposes of plugins,
index 7546f19e33e96df03d29aa6c63e09135bf7b7e25..e55b6bd6fb6c6151cbdc10ef7972b45b8c794fdf 100644 (file)
@@ -694,8 +694,10 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
          i = 0;
          FOR_EACH_CALL_EXPR_ARG (arg, iter, node)
            {
-             char temp[10];
-             sprintf (temp, "arg %d", i);
+             /* Buffer big enough to format a 32-bit UINT_MAX into, plus
+                the text.  */
+             char temp[15];
+             sprintf (temp, "arg %u", i);
              print_node (file, temp, arg, indent + 4);
              i++;
            }
@@ -706,7 +708,9 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
 
          for (i = 0; i < len; i++)
            {
-             char temp[10];
+             /* Buffer big enough to format a 32-bit UINT_MAX into, plus
+                the text.  */
+             char temp[15];
 
              sprintf (temp, "arg %d", i);
              print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
@@ -824,7 +828,9 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
          for (i = 0; i < len; i++)
            if (TREE_VEC_ELT (node, i))
              {
-               char temp[10];
+             /* Buffer big enough to format a 32-bit UINT_MAX into, plus
+                the text.  */
+               char temp[15];
                sprintf (temp, "elt %d", i);
                print_node (file, temp, TREE_VEC_ELT (node, i), indent + 4);
              }