From: Jakub Jelinek Date: Wed, 29 May 2019 09:33:02 +0000 (+0200) Subject: re PR bootstrap/90543 (Build failure on MINGW for gcc-9.1.0) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b54ecc769f598fcb7f88c6a7c9217ee7c32be789;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 407b248b5ac..92b2282a7af 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2019-05-29 Jakub Jelinek + + 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 * config/aarch64/aarch64-builtins.c (aarch64_builtins): Add diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk index 7ecd1eb9cc7..74096bc5462 100644 --- a/gcc/optc-save-gen.awk +++ b/gcc/optc-save-gen.awk @@ -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 "";