]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR other/89342 (ICE in maybe_default_option, at opts.c:347)
authorJakub Jelinek <jakub@redhat.com>
Fri, 30 Aug 2019 12:01:02 +0000 (14:01 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 30 Aug 2019 12:01:02 +0000 (14:01 +0200)
Backported from mainline
2019-02-15  Jakub Jelinek  <jakub@redhat.com>

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.

From-SVN: r275112

gcc/ChangeLog
gcc/optc-save-gen.awk
gcc/opth-gen.awk
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr89342.c [new file with mode: 0644]

index 2d31992d9bac248e36b5c17ca5690e613120b475..d00c11b5d6b6b17aa3c41c3168a9935dc19478cf 100644 (file)
@@ -1,6 +1,13 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-02-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR other/89342
+       * optc-save-gen.awk: Handle optimize_fast like optimize_size or
+       optimize_debug.
+       * opth-gen.awk: Likewise.
+
        2019-02-14  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/89354
index d79d1e9cd8d99cf21a914287f06f8795f2e2c238..00cf0a4c67271b8a76ec3e93916cfc42ef95b0e8 100644 (file)
@@ -84,7 +84,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;
@@ -92,9 +92,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.
@@ -735,13 +737,15 @@ 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_val[1] = "x_optimize_size"
-var_opt_val[2] = "x_optimize_debug"
 var_opt_val_type[1] = "char "
+var_opt_val[2] = "x_optimize_debug"
 var_opt_val_type[2] = "char "
+var_opt_val[3] = "x_optimize_fast"
+var_opt_val_type[3] = "char "
 for (i = 0; i < n_opts; i++) {
        if (flag_set_p("(Optimization|PerFunction)", flags[i])) {
                name = var_name(flags[i])
index 13577550a86fd9b9efe52887d935d77b5109ba80..e3584ec5a5742dc83958f1f3c3483db69b9c07fe 100644 (file)
@@ -132,7 +132,7 @@ print "/* Structure to save/restore optimization and target specific options.  *
 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])) {
index 57e6aa69d90dd81fdd2d913e1341850443f590c8..c83e4bfd021c67bb36eaeea840700edfd3bfac57 100644 (file)
@@ -1,6 +1,11 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-02-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR other/89342
+       * gcc.dg/pr89342.c: New test.
+
        2019-02-14  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/89354
diff --git a/gcc/testsuite/gcc.dg/pr89342.c b/gcc/testsuite/gcc.dg/pr89342.c
new file mode 100644 (file)
index 0000000..3bc779c
--- /dev/null
@@ -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 ();
+}