Commit d172f538 by Georg-Johann Lay Committed by Georg-Johann Lay

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
parent d49718d6
2017-07-25 Georg-Johann Lay <avr@gjlay.de>
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 <bin.cheng@arm.com> 2017-07-25 Bin Cheng <bin.cheng@arm.com>
PR target/81414 PR target/81414
......
...@@ -91,10 +91,10 @@ dump_profile (int frequency, profile_count &count) ...@@ -91,10 +91,10 @@ dump_profile (int frequency, profile_count &count)
char *buf; char *buf;
if (count.initialized_p ()) if (count.initialized_p ())
asprintf (&buf, "[%.2f%%] [count: %" PRId64 "]", fvalue, buf = xasprintf ("[%.2f%%] [count: %" PRId64 "]", fvalue,
count.to_gcov_type ()); count.to_gcov_type ());
else else
asprintf (&buf, "[%.2f%%] [count: INV]", fvalue); buf = xasprintf ("[%.2f%%] [count: INV]", fvalue);
const char *ret = xstrdup_for_dump (buf); const char *ret = xstrdup_for_dump (buf);
free (buf); free (buf);
...@@ -121,12 +121,12 @@ dump_probability (profile_probability probability, profile_count &count) ...@@ -121,12 +121,12 @@ dump_probability (profile_probability probability, profile_count &count)
char *buf; char *buf;
if (count.initialized_p ()) if (count.initialized_p ())
asprintf (&buf, "[%.2f%%] [count: %" PRId64 "]", fvalue, buf = xasprintf ("[%.2f%%] [count: %" PRId64 "]", fvalue,
count.to_gcov_type ()); count.to_gcov_type ());
else if (probability.initialized_p ()) else if (probability.initialized_p ())
asprintf (&buf, "[%.2f%%] [count: INV]", fvalue); buf = xasprintf ("[%.2f%%] [count: INV]", fvalue);
else else
asprintf (&buf, "[INV] [count: INV]"); buf = xasprintf ("[INV] [count: INV]");
const char *ret = xstrdup_for_dump (buf); const char *ret = xstrdup_for_dump (buf);
free (buf); free (buf);
......
...@@ -500,7 +500,7 @@ brig_init (void) ...@@ -500,7 +500,7 @@ brig_init (void)
else else
part++; part++;
char *modname2; char *modname2;
asprintf (&modname2, "%s_%s", modname, part); modname2 = xasprintf ("%s_%s", modname, part);
free (modname); free (modname);
modname = modname2; modname = modname2;
} }
......
...@@ -2827,7 +2827,6 @@ alias_get_name (tree decl) ...@@ -2827,7 +2827,6 @@ alias_get_name (tree decl)
{ {
const char *res = NULL; const char *res = NULL;
char *temp; char *temp;
int num_printed = 0;
if (!dump_file) if (!dump_file)
return "NULL"; return "NULL";
...@@ -2836,14 +2835,11 @@ alias_get_name (tree decl) ...@@ -2836,14 +2835,11 @@ alias_get_name (tree decl)
{ {
res = get_name (decl); res = get_name (decl);
if (res) if (res)
num_printed = asprintf (&temp, "%s_%u", res, SSA_NAME_VERSION (decl)); temp = xasprintf ("%s_%u", res, SSA_NAME_VERSION (decl));
else else
num_printed = asprintf (&temp, "_%u", SSA_NAME_VERSION (decl)); temp = xasprintf ("_%u", SSA_NAME_VERSION (decl));
if (num_printed > 0) res = ggc_strdup (temp);
{ free (temp);
res = ggc_strdup (temp);
free (temp);
}
} }
else if (DECL_P (decl)) else if (DECL_P (decl))
{ {
...@@ -2854,12 +2850,9 @@ alias_get_name (tree decl) ...@@ -2854,12 +2850,9 @@ alias_get_name (tree decl)
res = get_name (decl); res = get_name (decl);
if (!res) if (!res)
{ {
num_printed = asprintf (&temp, "D.%u", DECL_UID (decl)); temp = xasprintf ("D.%u", DECL_UID (decl));
if (num_printed > 0) res = ggc_strdup (temp);
{ free (temp);
res = ggc_strdup (temp);
free (temp);
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment