Hi!
We ICE on the following testcase, because while we save optimize,
and optimize_{size,debug} vars during option saving/restoring, we don't save
optimize_fast, and because of that end up with optimize 0 optimize_fast 1
which the option handling code ICEs on -
if (fast)
gcc_assert (level == 3);
in maybe_default_option. Fixed thusly, just treat optimize_fast like
the other flags, bootstrapped/regtested on x86_64-linux and i686-linux, ok
for trunk/8.3?
2019-02-14 Jakub Jelinek <[email protected]>
PR other/89342
* optc-save-gen.awk: Handle optimize_fast like optimize_size or
optimize_debug.
* opth-gen.awk: Likewise.
* gcc.dg/pr89342.c: New test.
--- gcc/optc-save-gen.awk.jj 2019-02-14 08:06:39.436519588 +0100
+++ gcc/optc-save-gen.awk 2019-02-14 13:12:37.789488847 +0100
@@ -81,7 +81,7 @@ print "void";
print "cl_optimization_save (struct cl_optimization *ptr, struct gcc_options
*opts)";
print "{";
-n_opt_char = 3;
+n_opt_char = 4;
n_opt_short = 0;
n_opt_int = 0;
n_opt_enum = 0;
@@ -90,9 +90,11 @@ n_opt_other = 0;
var_opt_char[0] = "optimize";
var_opt_char[1] = "optimize_size";
var_opt_char[2] = "optimize_debug";
+var_opt_char[3] = "optimize_fast";
var_opt_range["optimize"] = "0, 255";
var_opt_range["optimize_size"] = "0, 1";
var_opt_range["optimize_debug"] = "0, 1";
+var_opt_range["optimize_fast"] = "0, 1";
# Sort by size to mimic how the structure is laid out to be friendlier to the
# cache.
@@ -767,16 +769,19 @@ for (i = 0; i < n_target_val; i++) {
print "}";
-n_opt_val = 3;
+n_opt_val = 4;
var_opt_val[0] = "x_optimize"
var_opt_val_type[0] = "char "
var_opt_hash[0] = 1;
var_opt_val[1] = "x_optimize_size"
+var_opt_val_type[1] = "char "
var_opt_hash[1] = 1;
var_opt_val[2] = "x_optimize_debug"
-var_opt_hash[2] = 1;
-var_opt_val_type[1] = "char "
var_opt_val_type[2] = "char "
+var_opt_hash[2] = 1;
+var_opt_val[3] = "x_optimize_fast"
+var_opt_val_type[3] = "char "
+var_opt_hash[3] = 1;
for (i = 0; i < n_opts; i++) {
if (flag_set_p("(Optimization|PerFunction)", flags[i])) {
name = var_name(flags[i])
--- gcc/opth-gen.awk.jj 2019-01-01 12:37:18.562951898 +0100
+++ gcc/opth-gen.awk 2019-02-14 13:13:15.919858043 +0100
@@ -132,7 +132,7 @@ print "/* Structure to save/restore opti
print "struct GTY(()) cl_optimization";
print "{";
-n_opt_char = 3;
+n_opt_char = 4;
n_opt_short = 0;
n_opt_int = 0;
n_opt_enum = 0;
@@ -140,6 +140,7 @@ n_opt_other = 0;
var_opt_char[0] = "unsigned char x_optimize";
var_opt_char[1] = "unsigned char x_optimize_size";
var_opt_char[2] = "unsigned char x_optimize_debug";
+var_opt_char[3] = "unsigned char x_optimize_fast";
for (i = 0; i < n_opts; i++) {
if (flag_set_p("(Optimization|PerFunction)", flags[i])) {
--- gcc/testsuite/gcc.dg/pr89342.c.jj 2019-02-14 13:17:48.061355967 +0100
+++ gcc/testsuite/gcc.dg/pr89342.c 2019-02-14 13:17:03.494093205 +0100
@@ -0,0 +1,11 @@
+/* PR other/89342 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+__attribute__((optimize("Ofast")))
+void foo (void)
+{
+ __attribute__((optimize("no-inline")))
+ void bar (void) {}
+ bar ();
+}
Jakub