aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c/c-decl.c19
-rw-r--r--gcc/cp/decl.c19
-rw-r--r--gcc/gimple-ssa-sprintf.c18
4 files changed, 49 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c8100e2..783ae7a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2019-04-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR translation/79183
+ * gimple-ssa-sprintf.c (format_directive): Use inform_n instead of
+ inform where appropriate.
+
2019-04-18 Richard Biener <rguenther@suse.de>
* tree.c (get_qualified_type): Put found type variants at the
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index ef9b874..a788879 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -2513,7 +2513,24 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
{
tree remove = TREE_TYPE (newdecl);
if (TYPE_MAIN_VARIANT (remove) == remove)
- gcc_assert (TYPE_NEXT_VARIANT (remove) == NULL_TREE);
+ {
+ gcc_assert (TYPE_NEXT_VARIANT (remove) == NULL_TREE);
+ /* If remove is the main variant, no need to remove that
+ from the list. One of the DECL_ORIGINAL_TYPE
+ variants, e.g. created for aligned attribute, might still
+ refer to the newdecl TYPE_DECL though, so remove that one
+ in that case. */
+ if (DECL_ORIGINAL_TYPE (newdecl)
+ && DECL_ORIGINAL_TYPE (newdecl) != remove)
+ for (tree t = TYPE_MAIN_VARIANT (DECL_ORIGINAL_TYPE (newdecl));
+ ; t = TYPE_MAIN_VARIANT (t))
+ if (TYPE_NAME (TYPE_NEXT_VARIANT (t)) == newdecl)
+ {
+ TYPE_NEXT_VARIANT (t)
+ = TYPE_NEXT_VARIANT (TYPE_NEXT_VARIANT (t));
+ break;
+ }
+ }
else
for (tree t = TYPE_MAIN_VARIANT (remove); ;
t = TYPE_NEXT_VARIANT (t))
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 67d9244..f7cfacc 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2133,7 +2133,24 @@ next_arg:;
{
tree remove = TREE_TYPE (newdecl);
if (TYPE_MAIN_VARIANT (remove) == remove)
- gcc_assert (TYPE_NEXT_VARIANT (remove) == NULL_TREE);
+ {
+ gcc_assert (TYPE_NEXT_VARIANT (remove) == NULL_TREE);
+ /* If remove is the main variant, no need to remove that
+ from the list. One of the DECL_ORIGINAL_TYPE
+ variants, e.g. created for aligned attribute, might still
+ refer to the newdecl TYPE_DECL though, so remove that one
+ in that case. */
+ if (tree orig = DECL_ORIGINAL_TYPE (newdecl))
+ if (orig != remove)
+ for (tree t = TYPE_MAIN_VARIANT (orig); ;
+ t = TYPE_MAIN_VARIANT (t))
+ if (TYPE_NAME (TYPE_NEXT_VARIANT (t)) == newdecl)
+ {
+ TYPE_NEXT_VARIANT (t)
+ = TYPE_NEXT_VARIANT (TYPE_NEXT_VARIANT (t));
+ break;
+ }
+ }
else
for (tree t = TYPE_MAIN_VARIANT (remove); ;
t = TYPE_NEXT_VARIANT (t))
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index b6527bf..80b0bf8 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -3016,12 +3016,10 @@ format_directive (const sprintf_dom_walker::call_info &info,
help the user figure out how big a buffer they need. */
if (min == max)
- inform (callloc,
- (min == 1
- ? G_("%qE output %wu byte into a destination of size %wu")
- : G_("%qE output %wu bytes into a destination of size "
- "%wu")),
- info.func, min, info.objsize);
+ inform_n (callloc, min,
+ "%qE output %wu byte into a destination of size %wu",
+ "%qE output %wu bytes into a destination of size %wu",
+ info.func, min, info.objsize);
else if (max < HOST_WIDE_INT_MAX)
inform (callloc,
"%qE output between %wu and %wu bytes into "
@@ -3044,11 +3042,9 @@ format_directive (const sprintf_dom_walker::call_info &info,
of printf with no destination size just print the computed
result. */
if (min == max)
- inform (callloc,
- (min == 1
- ? G_("%qE output %wu byte")
- : G_("%qE output %wu bytes")),
- info.func, min);
+ inform_n (callloc, min,
+ "%qE output %wu byte", "%qE output %wu bytes",
+ info.func, min);
else if (max < HOST_WIDE_INT_MAX)
inform (callloc,
"%qE output between %wu and %wu bytes",