re PR bootstrap/90543 (Build failure on MINGW for gcc-9.1.0)

PR bootstrap/90543
	* optc-save-gen.awk: In cl_optimization_print, use correct condition
	for var_opt_string printing.  In cl_optimization_print_diff, print
	(null) instead of invoking undefined behavior if one of the
	var_opt_string pointers is NULL and use && instead of first || in the
	guarding condition.  For var_target_other options, handle const char *
	target variables similarly to const char * optimize node variables.

From-SVN: r271736
This commit is contained in:
Jakub Jelinek 2019-05-29 11:33:02 +02:00 committed by Jakub Jelinek
parent 8fc16d7252
commit b54ecc769f
2 changed files with 47 additions and 4 deletions

View File

@ -1,3 +1,13 @@
2019-05-29 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/90543
* optc-save-gen.awk: In cl_optimization_print, use correct condition
for var_opt_string printing. In cl_optimization_print_diff, print
(null) instead of invoking undefined behavior if one of the
var_opt_string pointers is NULL and use && instead of first || in the
guarding condition. For var_target_other options, handle const char *
target variables similarly to const char * optimize node variables.
2019-05-29 Sam Tebbs <sam.tebbs@arm.com>
* config/aarch64/aarch64-builtins.c (aarch64_builtins): Add

View File

@ -253,7 +253,7 @@ for (i = 0; i < n_opt_char; i++) {
}
for (i = 0; i < n_opt_string; i++) {
print " if (ptr->x_" var_opt_char[i] ")";
print " if (ptr->x_" var_opt_string[i] ")";
print " fprintf (file, \"%*s%s (%s)\\n\",";
print " indent_to, \"\",";
print " \"" var_opt_string[i] "\",";
@ -326,13 +326,13 @@ for (i = 0; i < n_opt_char; i++) {
for (i = 0; i < n_opt_string; i++) {
name = var_opt_string[i]
print " if (ptr1->x_" name " != ptr2->x_" name "";
print " || (!ptr1->x_" name" || !ptr2->x_" name
print " && (!ptr1->x_" name" || !ptr2->x_" name
print " || strcmp (ptr1->x_" name", ptr2->x_" name ")))";
print " fprintf (file, \"%*s%s (%s/%s)\\n\",";
print " indent_to, \"\",";
print " \"" name "\",";
print " ptr1->x_" name ",";
print " ptr2->x_" name ");";
print " ptr1->x_" name " ? ptr1->x_" name " : \"(null)\",";
print " ptr2->x_" name " ? ptr1->x_" name " : \"(null)\");";
print "";
}
@ -349,6 +349,7 @@ n_target_char = 0;
n_target_short = 0;
n_target_int = 0;
n_target_enum = 0;
n_target_string = 0;
n_target_other = 0;
if (have_save) {
@ -381,6 +382,8 @@ if (have_save) {
if (otype == var_type(flags[i]))
var_target_range[name] = ""
}
else if (otype ~ "^const char \\**$")
var_target_string[n_target_string++] = name;
else
var_target_other[n_target_other++] = name;
}
@ -429,6 +432,10 @@ for (i = 0; i < n_target_char; i++) {
print " ptr->x_" var_target_char[i] " = opts->x_" var_target_char[i] ";";
}
for (i = 0; i < n_target_string; i++) {
print " ptr->x_" var_target_string[i] " = opts->x_" var_target_string[i] ";";
}
print "}";
print "";
@ -461,6 +468,10 @@ for (i = 0; i < n_target_char; i++) {
print " opts->x_" var_target_char[i] " = ptr->x_" var_target_char[i] ";";
}
for (i = 0; i < n_target_string; i++) {
print " opts->x_" var_target_string[i] " = ptr->x_" var_target_string[i] ";";
}
# This must occur after the normal variables in case the code depends on those
# variables.
print "";
@ -530,6 +541,15 @@ for (i = 0; i < n_target_char; i++) {
print "";
}
for (i = 0; i < n_target_string; i++) {
print " if (ptr->x_" var_target_string[i] ")";
print " fprintf (file, \"%*s%s (%s)\\n\",";
print " indent, \"\",";
print " \"" var_target_string[i] "\",";
print " ptr->x_" var_target_string[i] ");";
print "";
}
print "";
print " if (targetm.target_option.print)";
print " targetm.target_option.print (file, indent, ptr);";
@ -605,6 +625,19 @@ for (i = 0; i < n_target_char; i++) {
print "";
}
for (i = 0; i < n_target_string; i++) {
name = var_target_string[i]
print " if (ptr1->x_" name " != ptr2->x_" name "";
print " && (!ptr1->x_" name" || !ptr2->x_" name
print " || strcmp (ptr1->x_" name", ptr2->x_" name ")))";
print " fprintf (file, \"%*s%s (%s/%s)\\n\",";
print " indent, \"\",";
print " \"" name "\",";
print " ptr1->x_" name " ? ptr1->x_" name " : \"(null)\",";
print " ptr2->x_" name " ? ptr1->x_" name " : \"(null)\");";
print "";
}
print "}";
print "";