From d172f538fd607f6e603af086ddcb0c112d199d7d Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay Date: Tue, 25 Jul 2017 09:59:44 +0000 Subject: [PATCH] re PR lto/81487 ([mingw32] ld.exe: error: asprintf failed) gcc/ PR 81487 * hsa-brig.c (brig_init): Use xasprintf instead of asprintf. * gimple-pretty-print.c (dump_profile, dump_probability): Same. * tree-ssa-structalias.c (alias_get_name): Same. From-SVN: r250499 --- gcc/ChangeLog | 7 +++++++ gcc/gimple-pretty-print.c | 14 +++++++------- gcc/hsa-brig.c | 2 +- gcc/tree-ssa-structalias.c | 21 +++++++-------------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 24d9088b3f7..453fc02f61c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-07-25 Georg-Johann Lay + + PR 81487 + * hsa-brig.c (brig_init): Use xasprintf instead of asprintf. + * gimple-pretty-print.c (dump_profile, dump_probability): Same. + * tree-ssa-structalias.c (alias_get_name): Same. + 2017-07-25 Bin Cheng PR target/81414 diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index 4012b3b9e2d..c8eb9c4a7bf 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -91,10 +91,10 @@ dump_profile (int frequency, profile_count &count) char *buf; if (count.initialized_p ()) - asprintf (&buf, "[%.2f%%] [count: %" PRId64 "]", fvalue, - count.to_gcov_type ()); + buf = xasprintf ("[%.2f%%] [count: %" PRId64 "]", fvalue, + count.to_gcov_type ()); else - asprintf (&buf, "[%.2f%%] [count: INV]", fvalue); + buf = xasprintf ("[%.2f%%] [count: INV]", fvalue); const char *ret = xstrdup_for_dump (buf); free (buf); @@ -121,12 +121,12 @@ dump_probability (profile_probability probability, profile_count &count) char *buf; if (count.initialized_p ()) - asprintf (&buf, "[%.2f%%] [count: %" PRId64 "]", fvalue, - count.to_gcov_type ()); + buf = xasprintf ("[%.2f%%] [count: %" PRId64 "]", fvalue, + count.to_gcov_type ()); else if (probability.initialized_p ()) - asprintf (&buf, "[%.2f%%] [count: INV]", fvalue); + buf = xasprintf ("[%.2f%%] [count: INV]", fvalue); else - asprintf (&buf, "[INV] [count: INV]"); + buf = xasprintf ("[INV] [count: INV]"); const char *ret = xstrdup_for_dump (buf); free (buf); diff --git a/gcc/hsa-brig.c b/gcc/hsa-brig.c index 6eed0140492..0f6cac57776 100644 --- a/gcc/hsa-brig.c +++ b/gcc/hsa-brig.c @@ -500,7 +500,7 @@ brig_init (void) else part++; char *modname2; - asprintf (&modname2, "%s_%s", modname, part); + modname2 = xasprintf ("%s_%s", modname, part); free (modname); modname = modname2; } diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index e563e9dee72..16746e3da92 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -2827,7 +2827,6 @@ alias_get_name (tree decl) { const char *res = NULL; char *temp; - int num_printed = 0; if (!dump_file) return "NULL"; @@ -2836,14 +2835,11 @@ alias_get_name (tree decl) { res = get_name (decl); if (res) - num_printed = asprintf (&temp, "%s_%u", res, SSA_NAME_VERSION (decl)); + temp = xasprintf ("%s_%u", res, SSA_NAME_VERSION (decl)); else - num_printed = asprintf (&temp, "_%u", SSA_NAME_VERSION (decl)); - if (num_printed > 0) - { - res = ggc_strdup (temp); - free (temp); - } + temp = xasprintf ("_%u", SSA_NAME_VERSION (decl)); + res = ggc_strdup (temp); + free (temp); } else if (DECL_P (decl)) { @@ -2854,12 +2850,9 @@ alias_get_name (tree decl) res = get_name (decl); if (!res) { - num_printed = asprintf (&temp, "D.%u", DECL_UID (decl)); - if (num_printed > 0) - { - res = ggc_strdup (temp); - free (temp); - } + temp = xasprintf ("D.%u", DECL_UID (decl)); + res = ggc_strdup (temp); + free (temp); } } } -- 2.30.2