Hi!

I've backported these 15 commits from trunk to 9.x branch,
bootstrapped/regtested them on x86_64-linux and i686-linux and
committed.

        Jakub
        PR c++/92992
        * call.c (convert_arg_to_ellipsis): For decltype(nullptr) arguments
        that have side-effects use cp_build_compound_expr.

        * g++.dg/cpp0x/nullptr45.C: New test.
---
 gcc/cp/ChangeLog                       |  9 +++++++++
 gcc/cp/call.c                          |  7 ++++++-
 gcc/testsuite/ChangeLog                |  8 ++++++++
 gcc/testsuite/g++.dg/cpp0x/nullptr45.C | 24 ++++++++++++++++++++++++
 4 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr45.C

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0e1557c936e..f0e314fd354 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2019-12-20  Jakub Jelinek  <ja...@redhat.com>
+
+       PR c++/92992
+       * call.c (convert_arg_to_ellipsis): For decltype(nullptr) arguments
+       that have side-effects use cp_build_compound_expr.
+
 2020-01-21  Jason Merrill  <ja...@redhat.com>
 
        PR c++/91476 - anon-namespace reference temp clash between TUs.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 8e14e89d5d4..787a7ed387b 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -7543,7 +7543,12 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t 
complain)
       arg = convert_to_real_nofold (double_type_node, arg);
     }
   else if (NULLPTR_TYPE_P (arg_type))
-    arg = null_pointer_node;
+    {
+      if (TREE_SIDE_EFFECTS (arg))
+       arg = cp_build_compound_expr (arg, null_pointer_node, complain);
+      else
+       arg = null_pointer_node;
+    }
   else if (INTEGRAL_OR_ENUMERATION_TYPE_P (arg_type))
     {
       if (SCOPED_ENUM_P (arg_type))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d76c0598245..2e507fdfe50 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2019-12-20  Jakub Jelinek  <ja...@redhat.com>
+
+       PR c++/92992
+       * g++.dg/cpp0x/nullptr45.C: New test.
+
 2020-01-22  Joseph Myers  <jos...@codesourcery.com>
 
        Backport from mainline:
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr45.C 
b/gcc/testsuite/g++.dg/cpp0x/nullptr45.C
new file mode 100644
index 00000000000..3ff226803df
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr45.C
@@ -0,0 +1,24 @@
+// PR c++/92992
+// { dg-do run { target c++11 } }
+
+int a;
+
+void
+bar (int, ...)
+{
+}
+
+decltype (nullptr)
+baz ()
+{
+  a++;
+  return nullptr;
+}
+
+int
+main ()
+{
+  bar (0, baz ());
+  if (a != 1)
+    __builtin_abort ();
+}
-- 
2.20.1

        PR c++/92438
        * parser.c (cp_parser_constructor_declarator_p): If open paren
        is followed by RID_ATTRIBUTE, skip over the attribute tokens and
        try to parse type specifier.

        * g++.dg/ext/attrib61.C: New test.
---
 gcc/cp/ChangeLog                    | 10 ++++++++++
 gcc/cp/parser.c                     | 17 ++++++++++++++++-
 gcc/testsuite/ChangeLog             |  8 ++++++++
 gcc/testsuite/g++.dg/ext/attrib61.C | 26 ++++++++++++++++++++++++++
 4 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/g++.dg/ext/attrib61.C

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f0e314fd354..13601ce975e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,13 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2019-12-26  Jakub Jelinek  <ja...@redhat.com>
+
+       PR c++/92438
+       * parser.c (cp_parser_constructor_declarator_p): If open paren
+       is followed by RID_ATTRIBUTE, skip over the attribute tokens and
+       try to parse type specifier.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 4df5d5797dc..54b3522dc8e 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -27619,7 +27619,15 @@ cp_parser_constructor_declarator_p (cp_parser *parser, 
cp_parser_flags flags,
          /* A parameter declaration begins with a decl-specifier,
             which is either the "attribute" keyword, a storage class
             specifier, or (usually) a type-specifier.  */
-         && !cp_lexer_next_token_is_decl_specifier_keyword (parser->lexer)
+         && (!cp_lexer_next_token_is_decl_specifier_keyword (parser->lexer)
+             /* GNU attributes can actually appear both at the start of
+                a parameter and parenthesized declarator.
+                S (__attribute__((unused)) int);
+                is a constructor, but
+                S (__attribute__((unused)) foo) (int);
+                is a function declaration.  */
+             || (cp_parser_allow_gnu_extensions_p (parser)
+                 && cp_next_tokens_can_be_gnu_attribute_p (parser)))
          /* A parameter declaration can also begin with [[attribute]].  */
          && !cp_next_tokens_can_be_std_attribute_p (parser))
        {
@@ -27627,6 +27635,13 @@ cp_parser_constructor_declarator_p (cp_parser *parser, 
cp_parser_flags flags,
          tree pushed_scope = NULL_TREE;
          unsigned saved_num_template_parameter_lists;
 
+         if (cp_next_tokens_can_be_gnu_attribute_p (parser))
+           {
+             unsigned int n = cp_parser_skip_gnu_attributes_opt (parser, 1);
+             while (--n)
+               cp_lexer_consume_token (parser->lexer);
+           }
+
          /* Names appearing in the type-specifier should be looked up
             in the scope of the class.  */
          if (current_class_type)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2e507fdfe50..c306cf6c296 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2019-12-26  Jakub Jelinek  <ja...@redhat.com>
+
+       PR c++/92438
+       * g++.dg/ext/attrib61.C: New test.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/testsuite/g++.dg/ext/attrib61.C 
b/gcc/testsuite/g++.dg/ext/attrib61.C
new file mode 100644
index 00000000000..231830616ea
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attrib61.C
@@ -0,0 +1,26 @@
+// PR c++/92438
+// { dg-do compile }
+
+typedef struct S { int x; } T;
+T (foo) (T x);
+T __attribute__((unused)) bar (T x);
+struct S (__attribute__((unused)) baz) (T x);
+T (__attribute__((unused)) qux) (T x);
+
+struct U
+{
+  U (__attribute__((unused)) int);
+  U (__attribute__((unused)) corge) (int);
+};
+
+void
+test ()
+{
+  T a, b;
+  a = foo (b);
+  b = bar (a);
+  a = baz (b);
+  b = qux (a);
+  U u (5);
+  U v = u.corge (3);
+}
-- 
2.20.1

        PR libgomp/93065
        * oacc-init.c (goacc_runtime_deinitialize): New function.
---
 libgomp/ChangeLog   | 8 ++++++++
 libgomp/oacc-init.c | 9 +++++++++
 2 files changed, 17 insertions(+)

diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index da2b99fa933..bcc1b0e7131 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2019-12-31  Ayush Mittal  <ayus...@samsung.com>
+
+       PR libgomp/93065
+       * oacc-init.c (goacc_runtime_deinitialize): New function.
+
 2019-12-20  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/libgomp/oacc-init.c b/libgomp/oacc-init.c
index f30cf2f81d8..033fac463c6 100644
--- a/libgomp/oacc-init.c
+++ b/libgomp/oacc-init.c
@@ -657,6 +657,15 @@ goacc_runtime_initialize (void)
   goacc_host_init ();
 }
 
+static void __attribute__((destructor))
+goacc_runtime_deinitialize (void)
+{
+#if !(defined HAVE_TLS || defined USE_EMUTLS)
+  pthread_key_delete (goacc_tls_key);
+#endif
+  pthread_key_delete (goacc_cleanup_key);
+}
+
 /* Compiler helper functions */
 
 attribute_hidden void
-- 
2.20.1

        PR ipa/93087
        * predict.c (compute_function_frequency): Don't call
        warn_function_cold on functions that already have cold attribute.

        * c-c++-common/cold-1.c: New test.
---
 gcc/ChangeLog                       |  9 +++++++++
 gcc/predict.c                       | 12 +++++++-----
 gcc/testsuite/ChangeLog             |  8 ++++++++
 gcc/testsuite/c-c++-common/cold-1.c | 22 ++++++++++++++++++++++
 4 files changed, 46 insertions(+), 5 deletions(-)
 create mode 100644 gcc/testsuite/c-c++-common/cold-1.c

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d31312299a8..d95b6af6573 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2020-01-02  Jakub Jelinek  <ja...@redhat.com>
+
+       PR ipa/93087
+       * predict.c (compute_function_frequency): Don't call
+       warn_function_cold on functions that already have cold attribute.
+
 2020-01-20  Richard Biener  <rguent...@suse.de>
 
        Backport from mainline
diff --git a/gcc/predict.c b/gcc/predict.c
index 60a19d7edd1..eaab47f992a 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -3937,12 +3937,14 @@ compute_function_frequency (void)
   if (profile_status_for_fn (cfun) != PROFILE_READ)
     {
       int flags = flags_from_decl_or_type (current_function_decl);
-      if ((ENTRY_BLOCK_PTR_FOR_FN (cfun)->count.ipa_p ()
-          && ENTRY_BLOCK_PTR_FOR_FN (cfun)->count.ipa() == profile_count::zero 
())
-         || lookup_attribute ("cold", DECL_ATTRIBUTES (current_function_decl))
-            != NULL)
+      if (lookup_attribute ("cold", DECL_ATTRIBUTES (current_function_decl))
+         != NULL)
+       node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED;
+      else if (ENTRY_BLOCK_PTR_FOR_FN (cfun)->count.ipa_p ()
+              && (ENTRY_BLOCK_PTR_FOR_FN (cfun)->count.ipa ()
+                  == profile_count::zero ()))
        {
-          node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED;
+         node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED;
          warn_function_cold (current_function_decl);
        }
       else if (lookup_attribute ("hot", DECL_ATTRIBUTES 
(current_function_decl))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c306cf6c296..cd4f7f44484 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2020-01-02  Jakub Jelinek  <ja...@redhat.com>
+
+       PR ipa/93087
+       * c-c++-common/cold-1.c: New test.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/testsuite/c-c++-common/cold-1.c 
b/gcc/testsuite/c-c++-common/cold-1.c
new file mode 100644
index 00000000000..3493623e1eb
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cold-1.c
@@ -0,0 +1,22 @@
+/* PR ipa/93087 */
+/* { dg-do compile { target nonpic } } */
+/* { dg-options "-O1 -Wsuggest-attribute=cold" } */
+
+extern void *getdata (void);
+extern int set_error (char const *message) __attribute__((cold));
+
+__attribute__((cold)) int
+set_nomem (void)       /* { dg-bogus "function might be candidate for 
attribute 'cold'" } */
+{
+  return set_error ("Allocation failed");
+}
+
+void *
+getdata_or_set_error (void)
+{
+  void *result;
+  result = getdata ();
+  if (!result)
+    set_nomem ();
+  return result;
+}
-- 
2.20.1

        PR rtl-optimization/93088
        * loop-iv.c (find_single_def_src): Punt after looking through
        128 reg copies for regs with single definitions.  Move definitions
        to first uses.

        * gcc.target/i386/pr93088.c: New test.
---
 gcc/ChangeLog                           | 10 ++++++++++
 gcc/loop-iv.c                           | 15 +++++++--------
 gcc/testsuite/ChangeLog                 |  8 ++++++++
 gcc/testsuite/gcc.target/i386/pr93088.c |  5 +++++
 4 files changed, 30 insertions(+), 8 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr93088.c

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d95b6af6573..3a024ce8f6e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2020-01-03  Jakub Jelinek  <ja...@redhat.com>
+
+       PR rtl-optimization/93088
+       * loop-iv.c (find_single_def_src): Punt after looking through
+       128 reg copies for regs with single definitions.  Move definitions
+       to first uses.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
index 82b4bdb1523..340045ce8b2 100644
--- a/gcc/loop-iv.c
+++ b/gcc/loop-iv.c
@@ -1380,24 +1380,23 @@ simple_rhs_p (rtx rhs)
 static rtx
 find_single_def_src (unsigned int regno)
 {
-  df_ref adef;
-  rtx set, src;
+  rtx src = NULL_RTX;
 
-  for (;;)
+  /* Don't look through unbounded number of single definition REG copies,
+     there might be loops for sources with uninitialized variables.  */
+  for (int cnt = 0; cnt < 128; cnt++)
     {
-      rtx note;
-      adef = DF_REG_DEF_CHAIN (regno);
+      df_ref adef = DF_REG_DEF_CHAIN (regno);
       if (adef == NULL || DF_REF_NEXT_REG (adef) != NULL
          || DF_REF_IS_ARTIFICIAL (adef))
        return NULL_RTX;
 
-      set = single_set (DF_REF_INSN (adef));
+      rtx set = single_set (DF_REF_INSN (adef));
       if (set == NULL || !REG_P (SET_DEST (set))
          || REGNO (SET_DEST (set)) != regno)
        return NULL_RTX;
 
-      note = find_reg_equal_equiv_note (DF_REF_INSN (adef));
-
+      rtx note = find_reg_equal_equiv_note (DF_REF_INSN (adef));
       if (note && function_invariant_p (XEXP (note, 0)))
        {
          src = XEXP (note, 0);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index cd4f7f44484..61eadf79eba 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2020-01-03  Jakub Jelinek  <ja...@redhat.com>
+
+       PR rtl-optimization/93088
+       * gcc.target/i386/pr93088.c: New test.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/testsuite/gcc.target/i386/pr93088.c 
b/gcc/testsuite/gcc.target/i386/pr93088.c
new file mode 100644
index 00000000000..dc986cfaa80
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr93088.c
@@ -0,0 +1,5 @@
+/* PR rtl-optimization/93088 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -funroll-loops -fno-tree-dominator-opts -fno-tree-vrp -w" 
} */
+
+#include "pr56348.c"
-- 
2.20.1

        PR inline-asm/93202
        * config/riscv/riscv.c (riscv_print_operand_reloc): Use
        output_operand_lossage instead of gcc_unreachable.
        * doc/md.texi (riscv f constraint): Fix typo.

        * gcc.target/riscv/pr93202.c: New test.
---
 gcc/ChangeLog                            | 10 ++++++++++
 gcc/config/riscv/riscv.c                 |  3 ++-
 gcc/doc/md.texi                          |  2 +-
 gcc/testsuite/ChangeLog                  |  8 ++++++++
 gcc/testsuite/gcc.target/riscv/pr93202.c | 10 ++++++++++
 5 files changed, 31 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/riscv/pr93202.c

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3a024ce8f6e..41478485b52 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2020-01-09  Jakub Jelinek  <ja...@redhat.com>
+
+       PR inline-asm/93202
+       * config/riscv/riscv.c (riscv_print_operand_reloc): Use
+       output_operand_lossage instead of gcc_unreachable.
+       * doc/md.texi (riscv f constraint): Fix typo.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
index 5cb295d3abb..92e7f312583 100644
--- a/gcc/config/riscv/riscv.c
+++ b/gcc/config/riscv/riscv.c
@@ -3089,7 +3089,8 @@ riscv_print_operand_reloc (FILE *file, rtx op, bool 
hi_reloc)
        break;
 
       default:
-       gcc_unreachable ();
+       output_operand_lossage ("invalid use of '%%%c'", hi_reloc ? 'h' : 'R');
+       return;
     }
 
   fprintf (file, "%s(", reloc);
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index 30612a6aecb..50e13124bc3 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -3566,7 +3566,7 @@ The @code{X} register.
 @table @code
 
 @item f
-A floating-point register (if availiable).
+A floating-point register (if available).
 
 @item I
 An I-type 12-bit signed immediate.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 61eadf79eba..0c26e201151 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2020-01-09  Jakub Jelinek  <ja...@redhat.com>
+
+       PR inline-asm/93202
+       * gcc.target/riscv/pr93202.c: New test.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/testsuite/gcc.target/riscv/pr93202.c 
b/gcc/testsuite/gcc.target/riscv/pr93202.c
new file mode 100644
index 00000000000..d8091b93179
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/pr93202.c
@@ -0,0 +1,10 @@
+/* PR inline-asm/93202 */
+/* { dg-do compile { target fpic } } */
+/* { dg-options "-fpic" } */
+
+void
+foo (void)
+{
+  asm volatile ("%h0" :: "i" (&foo));  /* { dg-error "invalid use of '%h'" } */
+  asm volatile ("%R0" :: "i" (&foo));  /* { dg-error "invalid use of '%R'" } */
+}
-- 
2.20.1

        PR libgomp/93219
        * libgomp.h (gomp_print_string): Change return type from void to int.
        * affinity-fmt.c (gomp_print_string): Likewise.  Return true if
        not all characters have been written.
---
 libgomp/ChangeLog      | 10 ++++++++++
 libgomp/affinity-fmt.c |  4 ++--
 libgomp/libgomp.h      |  2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index bcc1b0e7131..7588fdb7a6a 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,13 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2020-01-10  Jakub Jelinek  <ja...@redhat.com>
+
+       PR libgomp/93219
+       * libgomp.h (gomp_print_string): Change return type from void to int.
+       * affinity-fmt.c (gomp_print_string): Likewise.  Return true if
+       not all characters have been written.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/libgomp/affinity-fmt.c b/libgomp/affinity-fmt.c
index d9c6e181233..61417c9e5ae 100644
--- a/libgomp/affinity-fmt.c
+++ b/libgomp/affinity-fmt.c
@@ -37,10 +37,10 @@
 #include <sys/utsname.h>
 #endif
 
-void
+bool
 gomp_print_string (const char *str, size_t len)
 {
-  fwrite (str, 1, len, stderr);
+  return fwrite (str, 1, len, stderr) != len;
 }
 
 void
diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h
index afea659445d..c98c1452bd4 100644
--- a/libgomp/libgomp.h
+++ b/libgomp/libgomp.h
@@ -751,7 +751,7 @@ extern void gomp_display_affinity_place (char *, size_t, 
size_t *, int);
 
 /* affinity-fmt.c */
 
-extern void gomp_print_string (const char *str, size_t len);
+extern bool gomp_print_string (const char *str, size_t len);
 extern void gomp_set_affinity_format (const char *, size_t);
 extern void gomp_display_string (char *, size_t, size_t *, const char *,
                                 size_t);
-- 
2.20.1

        PR target/93009
        * config/i386/sse.md
        (*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_1,
        *<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_1,
        *<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_1,
        *<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_1): Use
        just a single alternative instead of two, make operands 1 and 2
        commutative.

        * gcc.target/i386/avx512vl-pr93009.c: New test.
---
 gcc/ChangeLog                                 | 14 +++++++
 gcc/config/i386/sse.md                        | 32 ++++++++--------
 gcc/testsuite/ChangeLog                       |  8 ++++
 .../gcc.target/i386/avx512vl-pr93009.c        | 38 +++++++++++++++++++
 4 files changed, 76 insertions(+), 16 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/avx512vl-pr93009.c

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 41478485b52..a48cb990a45 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2020-01-15  Jakub Jelinek  <ja...@redhat.com>
+
+       PR target/93009
+       * config/i386/sse.md
+       (*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_1,
+       *<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_1,
+       *<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_1,
+       *<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_1): Use
+       just a single alternative instead of two, make operands 1 and 2
+       commutative.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index c1b7ce99125..659cbff22f3 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -3914,12 +3914,12 @@
    (set_attr "mode" "<MODE>")])
 
 (define_insn "*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_1"
-  [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
+  [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
        (fma:VF_AVX512
-         (match_operand:VF_AVX512 1 "register_operand" "0,v")
-         (match_operand:VF_AVX512 2 "register_operand" "v,0")
+         (match_operand:VF_AVX512 1 "register_operand" "%0")
+         (match_operand:VF_AVX512 2 "register_operand" "v")
          (vec_duplicate:VF_AVX512
-           (match_operand:<ssescalarmode> 3 "memory_operand" "m,m"))))]
+           (match_operand:<ssescalarmode> 3 "memory_operand" "m"))))]
   "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
   "vfmadd213<ssemodesuffix>\t{%3<avx512bcst>, %2, 
%0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<avx512bcst>}"
   [(set_attr "type" "ssemuladd")
@@ -4031,13 +4031,13 @@
    (set_attr "mode" "<MODE>")])
 
 (define_insn "*<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_1"
-  [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
+  [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
        (fma:VF_AVX512
-         (match_operand:VF_AVX512 1 "register_operand" "0,v")
-         (match_operand:VF_AVX512 2 "register_operand" "v,0")
+         (match_operand:VF_AVX512 1 "register_operand" "%0")
+         (match_operand:VF_AVX512 2 "register_operand" "v")
          (neg:VF_AVX512
            (vec_duplicate:VF_AVX512
-             (match_operand:<ssescalarmode> 3 "memory_operand" "m,m")))))]
+             (match_operand:<ssescalarmode> 3 "memory_operand" "m")))))]
   "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
   "vfmsub213<ssemodesuffix>\t{%3<avx512bcst>, %2, 
%0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<avx512bcst>}"
   [(set_attr "type" "ssemuladd")
@@ -4153,13 +4153,13 @@
    (set_attr "mode" "<MODE>")])
 
 (define_insn "*<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_1"
-  [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
+  [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
        (fma:VF_AVX512
          (neg:VF_AVX512
-           (match_operand:VF_AVX512 1 "register_operand" "0,v"))
-         (match_operand:VF_AVX512 2 "register_operand" "v,0")
+           (match_operand:VF_AVX512 1 "register_operand" "%0"))
+         (match_operand:VF_AVX512 2 "register_operand" "v")
          (vec_duplicate:VF_AVX512
-           (match_operand:<ssescalarmode> 3 "memory_operand" "m,m"))))]
+           (match_operand:<ssescalarmode> 3 "memory_operand" "m"))))]
   "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
   "vfnmadd213<ssemodesuffix>\t{%3<avx512bcst>, %2, 
%0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<avx512bcst>}"
   [(set_attr "type" "ssemuladd")
@@ -4277,14 +4277,14 @@
    (set_attr "mode" "<MODE>")])
 
 (define_insn "*<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_1"
-  [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
+  [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
        (fma:VF_AVX512
          (neg:VF_AVX512
-           (match_operand:VF_AVX512 1 "register_operand" "0,v"))
-         (match_operand:VF_AVX512 2 "register_operand" "v,0")
+           (match_operand:VF_AVX512 1 "register_operand" "%0"))
+         (match_operand:VF_AVX512 2 "register_operand" "v")
          (neg:VF_AVX512
            (vec_duplicate:VF_AVX512
-             (match_operand:<ssescalarmode> 3 "memory_operand" "m,m")))))]
+             (match_operand:<ssescalarmode> 3 "memory_operand" "m")))))]
   "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
   "vfnmsub213<ssemodesuffix>\t{%3<avx512bcst>, %2, 
%0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<avx512bcst>}"
   [(set_attr "type" "ssemuladd")
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0c26e201151..c313090d064 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2020-01-15  Jakub Jelinek  <ja...@redhat.com>
+
+       PR target/93009
+       * gcc.target/i386/avx512vl-pr93009.c: New test.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr93009.c 
b/gcc/testsuite/gcc.target/i386/avx512vl-pr93009.c
new file mode 100644
index 00000000000..4dfc4a9f3c3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-pr93009.c
@@ -0,0 +1,38 @@
+/* PR target/93009 */
+/* { dg-do run { target { avx512vl } } } */
+/* { dg-options "-O2 -mavx512vl" } */
+
+#define AVX512VL
+#define AVX512F_LEN 512
+#define AVX512F_LEN_HALF 256
+
+#include "avx512f-check.h"
+
+typedef double v2df __attribute__((vector_size (16)));
+
+__attribute__((noipa)) v2df
+foo (v2df x, v2df y, double *z)
+{
+  return x * y + (v2df) { z[0], z[0] };
+}
+
+__attribute__((noipa)) v2df
+bar (v2df x, v2df y, double *z)
+{
+  return y * x + (v2df) { z[0], z[0] };
+}
+
+static void
+test_256 (void)
+{
+}
+
+static void
+test_128 (void)
+{
+  double z = 5.0;
+  v2df x = foo ((v2df) { 1.0, 2.0 }, (v2df) { 3.0, 4.0 }, &z);
+  v2df y = bar ((v2df) { 6.0, 7.0 }, (v2df) { 8.0, 9.0 }, &z);
+  if (x[0] != 8.0 || x[1] != 13.0 || y[0] != 53.0 || y[1] != 68.0)
+    abort ();
+}
-- 
2.20.1

        PR c++/93228
        * parser.c (cp_parser_template_name): Look up deprecated attribute
        in DECL_TEMPLATE_RESULT or its type's attributes.

        * g++.dg/cpp1y/attr-deprecated-3.C: New test.
---
 gcc/cp/ChangeLog                               |  9 +++++++++
 gcc/cp/parser.c                                | 12 +++++++++++-
 gcc/testsuite/ChangeLog                        |  8 ++++++++
 gcc/testsuite/g++.dg/cpp1y/attr-deprecated-3.C | 13 +++++++++++++
 4 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp1y/attr-deprecated-3.C

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 13601ce975e..da55c7ae07b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2020-01-17  Jakub Jelinek  <ja...@redhat.com>
+
+       PR c++/93228
+       * parser.c (cp_parser_template_name): Look up deprecated attribute
+       in DECL_TEMPLATE_RESULT or its type's attributes.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 54b3522dc8e..3e9950bcbed 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -16732,7 +16732,17 @@ cp_parser_template_name (cp_parser* parser,
     {
       if (TREE_DEPRECATED (decl)
          && deprecated_state != DEPRECATED_SUPPRESS)
-       warn_deprecated_use (decl, NULL_TREE);
+       {
+         tree d = DECL_TEMPLATE_RESULT (decl);
+         tree attr;
+         if (TREE_CODE (d) == TYPE_DECL)
+           attr = lookup_attribute ("deprecated",
+                                    TYPE_ATTRIBUTES (TREE_TYPE (d)));
+         else
+           attr = lookup_attribute ("deprecated",
+                                    DECL_ATTRIBUTES (d));
+         warn_deprecated_use (decl, attr);
+       }
     }
   else
     {
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c313090d064..d49da0ada27 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2020-01-17  Jakub Jelinek  <ja...@redhat.com>
+
+       PR c++/93228
+       * g++.dg/cpp1y/attr-deprecated-3.C: New test.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/testsuite/g++.dg/cpp1y/attr-deprecated-3.C 
b/gcc/testsuite/g++.dg/cpp1y/attr-deprecated-3.C
new file mode 100644
index 00000000000..16e5018f9cf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/attr-deprecated-3.C
@@ -0,0 +1,13 @@
+// PR c++/93228
+// { dg-do compile { target c++14 } }
+
+template <typename T>
+struct [[deprecated("foo")]] bar {};   // { dg-message "declared here" }
+struct [[deprecated("baz")]] qux {};   // { dg-message "declared here" }
+
+void
+quux ()
+{
+  bar<int> b;  // { dg-warning "is deprecated: foo" }
+  qux c;       // { dg-warning "is deprecated: baz" }
+}
-- 
2.20.1

2020-01-21  Jakub Jelinek  <ja...@redhat.com>

        PR target/93073
        * config/rs6000/rs6000.c (rs6000_emit_cmove): If using fsel, punt for
        compare_mode other than SFmode or DFmode.

        * gcc.target/powerpc/pr93073.c: New test.
---
 gcc/ChangeLog                              |  9 +++++++++
 gcc/config/rs6000/rs6000.c                 |  5 +++++
 gcc/testsuite/ChangeLog                    |  8 ++++++++
 gcc/testsuite/gcc.target/powerpc/pr93073.c | 16 ++++++++++++++++
 4 files changed, 38 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/pr93073.c

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a48cb990a45..2b0541ea1f0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2020-01-21  Jakub Jelinek  <ja...@redhat.com>
+
+       PR target/93073
+       * config/rs6000/rs6000.c (rs6000_emit_cmove): If using fsel, punt for
+       compare_mode other than SFmode or DFmode.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index a670096145b..87d60078bb0 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -23255,6 +23255,11 @@ rs6000_emit_cmove (rtx dest, rtx op, rtx true_cond, 
rtx false_cond)
 
   /* At this point we know we can use fsel.  */
 
+  /* Don't allow compare_mode other than SFmode or DFmode, for others there
+     is no fsel instruction.  */
+  if (compare_mode != SFmode && compare_mode != DFmode)
+    return 0;
+
   /* Reduce the comparison to a comparison against zero.  */
   if (! is_against_zero)
     {
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d49da0ada27..24c597b33c7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2020-01-21  Jakub Jelinek  <ja...@redhat.com>
+
+       PR target/93073
+       * gcc.target/powerpc/pr93073.c: New test.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/testsuite/gcc.target/powerpc/pr93073.c 
b/gcc/testsuite/gcc.target/powerpc/pr93073.c
new file mode 100644
index 00000000000..6a0a4731148
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr93073.c
@@ -0,0 +1,16 @@
+/* PR target/93073 */
+/* { dg-do compile { target powerpc_vsx_ok } } */
+/* { dg-options "-mvsx -O1 -ffinite-math-only -fno-trapping-math" } */
+
+void bar (void);
+
+void
+foo (long double x, double y, double z)
+{
+  for (;;)
+    {
+      double a = x > 0.0 ? y : z;
+      if (a == 0.0)
+       bar ();
+    }
+}
-- 
2.20.1

        PR target/93333
        * config/riscv/riscv.c (riscv_rtx_costs) <case ZERO_EXTRACT>: Verify
        the last two operands are CONST_INT_P before using them as such.

        * gcc.c-torture/compile/pr93333.c: New test.
---
 gcc/ChangeLog                                 |  9 +++++++++
 gcc/config/riscv/riscv.c                      |  5 ++++-
 gcc/testsuite/ChangeLog                       |  8 ++++++++
 gcc/testsuite/gcc.c-torture/compile/pr93333.c | 10 ++++++++++
 4 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr93333.c

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2b0541ea1f0..6048a8fdc60 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2020-01-21  Jakub Jelinek  <ja...@redhat.com>
+
+       PR target/93333
+       * config/riscv/riscv.c (riscv_rtx_costs) <case ZERO_EXTRACT>: Verify
+       the last two operands are CONST_INT_P before using them as such.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
index 92e7f312583..931662b3137 100644
--- a/gcc/config/riscv/riscv.c
+++ b/gcc/config/riscv/riscv.c
@@ -1612,7 +1612,10 @@ riscv_rtx_costs (rtx x, machine_mode mode, int 
outer_code, int opno ATTRIBUTE_UN
 
     case ZERO_EXTRACT:
       /* This is an SImode shift.  */
-      if (outer_code == SET && (INTVAL (XEXP (x, 2)) > 0)
+      if (outer_code == SET
+         && CONST_INT_P (XEXP (x, 1))
+         && CONST_INT_P (XEXP (x, 2))
+         && (INTVAL (XEXP (x, 2)) > 0)
          && (INTVAL (XEXP (x, 1)) + INTVAL (XEXP (x, 2)) == 32))
        {
          *total = COSTS_N_INSNS (SINGLE_SHIFT_COST);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 24c597b33c7..1346e461c30 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       Backported from mainline
+       2020-01-21  Jakub Jelinek  <ja...@redhat.com>
+
+       PR target/93333
+       * gcc.c-torture/compile/pr93333.c: New test.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr93333.c 
b/gcc/testsuite/gcc.c-torture/compile/pr93333.c
new file mode 100644
index 00000000000..801959bea75
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr93333.c
@@ -0,0 +1,10 @@
+/* PR target/93333 */
+
+unsigned
+foo (int b, int c, int d, unsigned long e, int x, int y, int g, int h,
+     unsigned i)
+{
+  e >>= b;
+  i >>= e & 31;
+  return i & 1;
+}
-- 
2.20.1

        PR fortran/93329
        * openmp.c (omp_code_to_statement): Handle remaining EXEC_OMP_*
        cases.

        * gfortran.dg/goacc/pr93329.f90: New test.
---
 gcc/fortran/ChangeLog                       |   6 +
 gcc/fortran/openmp.c                        |  75 +++++++
 gcc/testsuite/ChangeLog                     |   5 +
 gcc/testsuite/gfortran.dg/goacc/pr93329.f90 | 223 ++++++++++++++++++++
 4 files changed, 309 insertions(+)
 create mode 100644 gcc/testsuite/gfortran.dg/goacc/pr93329.f90

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ea6d1b8b4d6..4d3bfa6d2f9 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       PR fortran/93329
+       * openmp.c (omp_code_to_statement): Handle remaining EXEC_OMP_*
+       cases.
+
 2020-01-17  Mark Eggleston  <mark.eggles...@codethink.com>
 
         Backport from mainline
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 1c7bce6c300..716dd5ec3e2 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -5757,6 +5757,81 @@ omp_code_to_statement (gfc_code *code)
       return ST_OMP_PARALLEL_WORKSHARE;
     case EXEC_OMP_DO:
       return ST_OMP_DO;
+    case EXEC_OMP_ATOMIC:
+      return ST_OMP_ATOMIC;
+    case EXEC_OMP_BARRIER:
+      return ST_OMP_BARRIER;
+    case EXEC_OMP_CANCEL:
+      return ST_OMP_CANCEL;
+    case EXEC_OMP_CANCELLATION_POINT:
+      return ST_OMP_CANCELLATION_POINT;
+    case EXEC_OMP_FLUSH:
+      return ST_OMP_FLUSH;
+    case EXEC_OMP_DISTRIBUTE:
+      return ST_OMP_DISTRIBUTE;
+    case EXEC_OMP_DISTRIBUTE_PARALLEL_DO:
+      return ST_OMP_DISTRIBUTE_PARALLEL_DO;
+    case EXEC_OMP_DISTRIBUTE_PARALLEL_DO_SIMD:
+      return ST_OMP_DISTRIBUTE_PARALLEL_DO_SIMD;
+    case EXEC_OMP_DISTRIBUTE_SIMD:
+      return ST_OMP_DISTRIBUTE_SIMD;
+    case EXEC_OMP_DO_SIMD:
+      return ST_OMP_DO_SIMD;
+    case EXEC_OMP_SIMD:
+      return ST_OMP_SIMD;
+    case EXEC_OMP_TARGET:
+      return ST_OMP_TARGET;
+    case EXEC_OMP_TARGET_DATA:
+      return ST_OMP_TARGET_DATA;
+    case EXEC_OMP_TARGET_ENTER_DATA:
+      return ST_OMP_TARGET_ENTER_DATA;
+    case EXEC_OMP_TARGET_EXIT_DATA:
+      return ST_OMP_TARGET_EXIT_DATA;
+    case EXEC_OMP_TARGET_PARALLEL:
+      return ST_OMP_TARGET_PARALLEL;
+    case EXEC_OMP_TARGET_PARALLEL_DO:
+      return ST_OMP_TARGET_PARALLEL_DO;
+    case EXEC_OMP_TARGET_PARALLEL_DO_SIMD:
+      return ST_OMP_TARGET_PARALLEL_DO_SIMD;
+    case EXEC_OMP_TARGET_SIMD:
+      return ST_OMP_TARGET_SIMD;
+    case EXEC_OMP_TARGET_TEAMS:
+      return ST_OMP_TARGET_TEAMS;
+    case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE:
+      return ST_OMP_TARGET_TEAMS_DISTRIBUTE;
+    case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO:
+      return ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO;
+    case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD:
+      return ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD;
+    case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD:
+      return ST_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD;
+    case EXEC_OMP_TARGET_UPDATE:
+      return ST_OMP_TARGET_UPDATE;
+    case EXEC_OMP_TASKGROUP:
+      return ST_OMP_TASKGROUP;
+    case EXEC_OMP_TASKLOOP:
+      return ST_OMP_TASKLOOP;
+    case EXEC_OMP_TASKLOOP_SIMD:
+      return ST_OMP_TASKLOOP_SIMD;
+    case EXEC_OMP_TASKWAIT:
+      return ST_OMP_TASKWAIT;
+    case EXEC_OMP_TASKYIELD:
+      return ST_OMP_TASKYIELD;
+    case EXEC_OMP_TEAMS:
+      return ST_OMP_TEAMS;
+    case EXEC_OMP_TEAMS_DISTRIBUTE:
+      return ST_OMP_TEAMS_DISTRIBUTE;
+    case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO:
+      return ST_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO;
+    case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD:
+      return ST_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD;
+    case EXEC_OMP_TEAMS_DISTRIBUTE_SIMD:
+      return ST_OMP_TEAMS_DISTRIBUTE_SIMD;
+    case EXEC_OMP_PARALLEL_DO:
+      return ST_OMP_PARALLEL_DO;
+    case EXEC_OMP_PARALLEL_DO_SIMD:
+      return ST_OMP_PARALLEL_DO_SIMD;
+
     default:
       gcc_unreachable ();
     }
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1346e461c30..b458451fa8d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       PR fortran/93329
+       * gfortran.dg/goacc/pr93329.f90: New test.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/testsuite/gfortran.dg/goacc/pr93329.f90 
b/gcc/testsuite/gfortran.dg/goacc/pr93329.f90
new file mode 100644
index 00000000000..e1feafd2ba2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/pr93329.f90
@@ -0,0 +1,223 @@
+! PR fortran/93329
+! { dg-do compile { target fopenmp } }
+! { dg-additional-options "-fopenmp" }
+
+  integer :: x, y, z
+  integer :: a(32)
+!$acc kernels copyout(x)
+!$omp target map(from:x)       ! { dg-error "OMP TARGET directive cannot be 
specified within" }
+  x = 5
+!$omp end target
+!$acc end kernels
+  print *, x
+!$acc kernels
+!$omp atomic                   ! { dg-error "OMP ATOMIC directive cannot be 
specified within" }
+  x = x + 1
+!$omp end atomic
+!$acc end kernels
+!$acc kernels
+!$omp barrier                  ! { dg-error "OMP BARRIER directive cannot be 
specified within" }
+!$acc end kernels
+!$acc kernels
+!$omp cancel parallel          ! { dg-error "OMP CANCEL directive cannot be 
specified within" }
+!$acc end kernels
+!$acc kernels
+!$omp cancellation point parallel      ! { dg-error "OMP CANCELLATION POINT 
directive cannot be specified within" }
+!$acc end kernels
+!$acc kernels
+!$omp flush                    ! { dg-error "OMP FLUSH directive cannot be 
specified within" }
+!$acc end kernels
+!$acc kernels
+!$omp distribute               ! { dg-error "OMP DISTRIBUTE directive cannot 
be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp distribute parallel do   ! { dg-error "OMP DISTRIBUTE PARALLEL DO 
directive cannot be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp distribute parallel do simd      ! { dg-error "OMP DISTRIBUTE PARALLEL 
DO SIMD directive cannot be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp distribute simd          ! { dg-error "OMP DISTRIBUTE SIMD directive 
cannot be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp do simd                  ! { dg-error "OMP DO SIMD directive cannot be 
specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp simd                     ! { dg-error "OMP SIMD directive cannot be 
specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp target data map(from: x) ! { dg-error "OMP TARGET DATA directive cannot 
be specified within" }
+!$omp end target data
+!$acc end kernels
+!$acc kernels
+!$omp target enter data map(to: x)     ! { dg-error "OMP TARGET ENTER DATA 
directive cannot be specified within" }
+!$acc end kernels
+!$acc kernels
+!$omp target exit data map(from: x)    ! { dg-error "OMP TARGET EXIT DATA 
directive cannot be specified within" }
+!$acc end kernels
+!$acc kernels
+!!$omp target parallel
+!!$omp end target parallel
+!$acc end kernels
+!$acc kernels
+!$omp target parallel do       ! { dg-error "OMP TARGET PARALLEL DO directive 
cannot be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp target parallel do simd  ! { dg-error "OMP TARGET PARALLEL DO SIMD 
directive cannot be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!!$omp target simd
+!  do x = 0, 2
+!  end do
+!$acc end kernels
+!$acc kernels
+!$omp target teams             ! { dg-error "OMP TARGET TEAMS directive cannot 
be specified within" }
+!$omp end target teams
+!$acc end kernels
+!$acc kernels
+!$omp target teams distribute  ! { dg-error "OMP TARGET TEAMS DISTRIBUTE 
directive cannot be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp target teams distribute parallel do      ! { dg-error "OMP TARGET TEAMS 
DISTRIBUTE PARALLEL DO directive cannot be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp target teams distribute parallel do simd ! { dg-error "OMP TARGET TEAMS 
DISTRIBUTE PARALLEL DO SIMD directive cannot be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp target teams distribute simd     ! { dg-error "OMP TARGET TEAMS 
DISTRIBUTE SIMD directive cannot be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp target update to(x)      ! { dg-error "OMP TARGET UPDATE directive 
cannot be specified within" }
+!$acc end kernels
+!$acc kernels
+!$omp taskgroup                        ! { dg-error "OMP TASKGROUP directive 
cannot be specified within" }
+!$omp end taskgroup
+!$acc end kernels
+!$acc kernels
+!$omp taskloop                 ! { dg-error "OMP TASKLOOP directive cannot be 
specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp taskloop simd            ! { dg-error "OMP TASKLOOP SIMD directive 
cannot be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp taskwait                 ! { dg-error "OMP TASKWAIT directive cannot be 
specified within" }
+!$acc end kernels
+!$acc kernels
+!$omp taskyield                        ! { dg-error "OMP TASKYIELD directive 
cannot be specified within" }
+!$acc end kernels
+!$acc kernels
+!$omp teams                    ! { dg-error "OMP TEAMS directive cannot be 
specified within" }
+!$omp end teams
+!$acc end kernels
+!$acc kernels
+!$omp teams distribute         ! { dg-error "OMP TEAMS DISTRIBUTE directive 
cannot be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp teams distribute parallel do     ! { dg-error "OMP TEAMS DISTRIBUTE 
PARALLEL DO directive cannot be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp teams distribute parallel do simd        ! { dg-error "OMP TEAMS 
DISTRIBUTE PARALLEL DO SIMD directive cannot be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp teams distribute simd    ! { dg-error "OMP TEAMS DISTRIBUTE SIMD 
directive cannot be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp parallel do              ! { dg-error "OMP PARALLEL DO directive cannot 
be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp parallel do simd         ! { dg-error "OMP PARALLEL DO SIMD directive 
cannot be specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+!$acc kernels
+!$omp parallel                 ! { dg-error "OMP PARALLEL directive cannot be 
specified within" }
+!$omp end parallel
+!$acc end kernels
+!$acc kernels
+!$omp parallel sections                ! { dg-error "OMP PARALLEL SECTIONS 
directive cannot be specified within" }
+  y = 1
+!$omp section
+  z = 2
+!$omp end parallel sections
+!$acc end kernels
+!$acc kernels
+!$omp sections                 ! { dg-error "OMP SECTIONS directive cannot be 
specified within" }
+  y = 1
+!$omp section
+  z = 2
+!$omp end sections
+!$acc end kernels
+!$acc kernels
+!$omp ordered                  ! { dg-error "OMP ORDERED directive cannot be 
specified within" }
+!$omp end ordered
+!$acc end kernels
+!$acc kernels
+!$omp critical                 ! { dg-error "OMP CRITICAL directive cannot be 
specified within" }
+!$omp end critical
+!$acc end kernels
+!$acc kernels
+!$omp master                   ! { dg-error "OMP MASTER directive cannot be 
specified within" }
+!$omp end master
+!$acc end kernels
+!$acc kernels
+!$omp single                   ! { dg-error "OMP SINGLE directive cannot be 
specified within" }
+!$omp end single
+!$acc end kernels
+!$acc kernels
+!$omp task                     ! { dg-error "OMP TASK directive cannot be 
specified within" }
+!$omp end task
+!$acc end kernels
+!$acc kernels
+!$omp workshare                        ! { dg-error "OMP WORKSHARE directive 
cannot be specified within" }
+  a(:) = 1
+!$omp end workshare
+!$acc end kernels
+!$acc kernels
+!$omp parallel workshare       ! { dg-error "OMP PARALLEL WORKSHARE directive 
cannot be specified within" }
+  a(:) = 1
+!$omp end parallel workshare
+!$acc end kernels
+!$acc kernels
+!$omp do                       ! { dg-error "OMP DO directive cannot be 
specified within" }
+  do x = 0, 2
+  end do
+!$acc end kernels
+end
-- 
2.20.1

        * parse.c (parse_omp_structured_block): Handle ST_OMP_TARGET_PARALLEL.
        * trans-openmp.c (gfc_trans_omp_target)
        <case EXEC_OMP_TARGET_PARALLEL>: Call pushlevel first.

        * gfortran.dg/gomp/target-parallel1.f90: New test.
        * gfortran.dg/goacc/pr93329.f90: Enable commented out target parallel
        test.
---
 gcc/fortran/ChangeLog                               | 6 ++++++
 gcc/fortran/parse.c                                 | 3 +++
 gcc/fortran/trans-openmp.c                          | 1 +
 gcc/testsuite/ChangeLog                             | 6 ++++++
 gcc/testsuite/gfortran.dg/goacc/pr93329.f90         | 4 ++--
 gcc/testsuite/gfortran.dg/gomp/target-parallel1.f90 | 4 ++++
 6 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gfortran.dg/gomp/target-parallel1.f90

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 4d3bfa6d2f9..d0d6fb57bb5 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       * parse.c (parse_omp_structured_block): Handle ST_OMP_TARGET_PARALLEL.
+       * trans-openmp.c (gfc_trans_omp_target)
+       <case EXEC_OMP_TARGET_PARALLEL>: Call pushlevel first.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        PR fortran/93329
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 86af947d152..9e662a66126 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -5103,6 +5103,9 @@ parse_omp_structured_block (gfc_statement omp_st, bool 
workshare_stmts_only)
     case ST_OMP_TARGET_DATA:
       omp_end_st = ST_OMP_END_TARGET_DATA;
       break;
+    case ST_OMP_TARGET_PARALLEL:
+      omp_end_st = ST_OMP_END_TARGET_PARALLEL;
+      break;
     case ST_OMP_TARGET_TEAMS:
       omp_end_st = ST_OMP_END_TARGET_TEAMS;
       break;
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 98e3d58e174..52a2cc8a4da 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -4783,6 +4783,7 @@ gfc_trans_omp_target (gfc_code *code)
       {
        stmtblock_t iblock;
 
+       pushlevel ();
        gfc_start_block (&iblock);
        tree inner_clauses
          = gfc_trans_omp_clauses (&block, &clausesa[GFC_OMP_SPLIT_PARALLEL],
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b458451fa8d..d0d8279ef19 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       * gfortran.dg/gomp/target-parallel1.f90: New test.
+       * gfortran.dg/goacc/pr93329.f90: Enable commented out target parallel
+       test.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        PR fortran/93329
diff --git a/gcc/testsuite/gfortran.dg/goacc/pr93329.f90 
b/gcc/testsuite/gfortran.dg/goacc/pr93329.f90
index e1feafd2ba2..b277bb1243c 100644
--- a/gcc/testsuite/gfortran.dg/goacc/pr93329.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/pr93329.f90
@@ -68,8 +68,8 @@
 !$omp target exit data map(from: x)    ! { dg-error "OMP TARGET EXIT DATA 
directive cannot be specified within" }
 !$acc end kernels
 !$acc kernels
-!!$omp target parallel
-!!$omp end target parallel
+!$omp target parallel          ! { dg-error "OMP TARGET PARALLEL directive 
cannot be specified within" }
+!$omp end target parallel
 !$acc end kernels
 !$acc kernels
 !$omp target parallel do       ! { dg-error "OMP TARGET PARALLEL DO directive 
cannot be specified within" }
diff --git a/gcc/testsuite/gfortran.dg/gomp/target-parallel1.f90 
b/gcc/testsuite/gfortran.dg/gomp/target-parallel1.f90
new file mode 100644
index 00000000000..bb8561f1c73
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/target-parallel1.f90
@@ -0,0 +1,4 @@
+!$omp target parallel
+  print *, 'Hello, world'
+!$omp end target parallel
+end
-- 
2.20.1

        PR target/91298
        * output.h (assemble_name_resolve): Declare.
        * varasm.c (assemble_name_resolve): New function.
        (assemble_name): Use it.
        * config/i386/i386.h (ASM_OUTPUT_SYMBOL_REF): Define.

        * gcc.target/i386/pr91298-1.c: New test.
        * gcc.target/i386/pr91298-2.c: New test.
---
 gcc/ChangeLog                             |  8 ++++++
 gcc/config/i386/i386.h                    | 25 +++++++++++++++++
 gcc/output.h                              |  6 +++++
 gcc/testsuite/ChangeLog                   |  6 +++++
 gcc/testsuite/gcc.target/i386/pr91298-1.c | 14 ++++++++++
 gcc/testsuite/gcc.target/i386/pr91298-2.c |  5 ++++
 gcc/varasm.c                              | 33 ++++++++++++++---------
 7 files changed, 84 insertions(+), 13 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr91298-1.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr91298-2.c

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6048a8fdc60..1d62d16d808 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       PR target/91298
+       * output.h (assemble_name_resolve): Declare.
+       * varasm.c (assemble_name_resolve): New function.
+       (assemble_name): Use it.
+       * config/i386/i386.h (ASM_OUTPUT_SYMBOL_REF): Define.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        Backported from mainline
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 934352d6331..95e1733f12a 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2205,6 +2205,31 @@ extern int const 
svr4_dbx_register_map[FIRST_PSEUDO_REGISTER];
 #define ASM_OUTPUT_FUNCTION_LABEL(FILE, NAME, DECL) \
   ix86_asm_output_function_label ((FILE), (NAME), (DECL))
 
+/* A C statement (sans semicolon) to output a reference to SYMBOL_REF SYM.
+   If not defined, assemble_name will be used to output the name of the
+   symbol.  This macro may be used to modify the way a symbol is referenced
+   depending on information encoded by TARGET_ENCODE_SECTION_INFO.  */
+
+#ifndef ASM_OUTPUT_SYMBOL_REF
+#define ASM_OUTPUT_SYMBOL_REF(FILE, SYM) \
+  do {                                                 \
+    const char *name                                   \
+      = assemble_name_resolve (XSTR (x, 0));           \
+    /* In -masm=att wrap identifiers that start with $ \
+       into parens.  */                                        \
+    if (ASSEMBLER_DIALECT == ASM_ATT                   \
+       && name[0] == '$'                               \
+       && user_label_prefix[0] == '\0')                \
+      {                                                        \
+       fputc ('(', (FILE));                            \
+       assemble_name_raw ((FILE), name);               \
+       fputc (')', (FILE));                            \
+      }                                                        \
+    else                                               \
+      assemble_name_raw ((FILE), name);                        \
+  } while (0)
+#endif
+
 /* Under some conditions we need jump tables in the text section,
    because the assembler cannot handle label differences between
    sections.  This is the case for x86_64 on Mach-O for example.  */
diff --git a/gcc/output.h b/gcc/output.h
index 835d63556e6..e4017bb6b8e 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -236,6 +236,12 @@ extern void assemble_label (FILE *, const char *);
    addition of an underscore).  */
 extern void assemble_name_raw (FILE *, const char *);
 
+/* Return NAME that should actually be emitted, looking through
+   transparent aliases.  If NAME refers to an entity that is also
+   represented as a tree (like a function or variable), mark the entity
+   as referenced.  */
+extern const char *assemble_name_resolve (const char *);
+
 /* Like assemble_name_raw, but should be used when NAME might refer to
    an entity that is also represented as a tree (like a function or
    variable).  If NAME does refer to such an entity, that entity will
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d0d8279ef19..bebe9a75fa5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       PR target/91298
+       * gcc.target/i386/pr91298-1.c: New test.
+       * gcc.target/i386/pr91298-2.c: New test.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        * gfortran.dg/gomp/target-parallel1.f90: New test.
diff --git a/gcc/testsuite/gcc.target/i386/pr91298-1.c 
b/gcc/testsuite/gcc.target/i386/pr91298-1.c
new file mode 100644
index 00000000000..45ef553fcf1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr91298-1.c
@@ -0,0 +1,14 @@
+/* PR target/91298 */
+/* { dg-do assemble } */
+/* { dg-options "-O2 -g -fdollars-in-identifiers" } */
+
+int $a[18];
+int *foo (void) { return &$a[0]; }
+int *bar (int x) { return &$a[x]; }
+int baz (void) { return $a[0]; }
+int qux (void) { return $a[4]; }
+int $quux (void) { return 1; }
+int corge (void) { return $quux (); }
+int grault (void) { return $quux () + 1; }
+typedef int (*fn) (void);
+fn foobar (void) { return $quux; }
diff --git a/gcc/testsuite/gcc.target/i386/pr91298-2.c 
b/gcc/testsuite/gcc.target/i386/pr91298-2.c
new file mode 100644
index 00000000000..20e47ab6c83
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr91298-2.c
@@ -0,0 +1,5 @@
+/* PR target/91298 */
+/* { dg-do assemble { target fpic } } */
+/* { dg-options "-O2 -g -fdollars-in-identifiers -fpic" } */
+
+#include "pr91298-1.c"
diff --git a/gcc/varasm.c b/gcc/varasm.c
index cb43248ec49..8f006dcff67 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2585,20 +2585,16 @@ assemble_name_raw (FILE *file, const char *name)
     ASM_OUTPUT_LABELREF (file, name);
 }
 
-/* Like assemble_name_raw, but should be used when NAME might refer to
-   an entity that is also represented as a tree (like a function or
-   variable).  If NAME does refer to such an entity, that entity will
-   be marked as referenced.  */
-
-void
-assemble_name (FILE *file, const char *name)
+/* Return NAME that should actually be emitted, looking through
+   transparent aliases.  If NAME refers to an entity that is also
+   represented as a tree (like a function or variable), mark the entity
+   as referenced.  */
+const char *
+assemble_name_resolve (const char *name)
 {
-  const char *real_name;
-  tree id;
+  const char *real_name = targetm.strip_name_encoding (name);
+  tree id = maybe_get_identifier (real_name);
 
-  real_name = targetm.strip_name_encoding (name);
-
-  id = maybe_get_identifier (real_name);
   if (id)
     {
       tree id_orig = id;
@@ -2610,7 +2606,18 @@ assemble_name (FILE *file, const char *name)
       gcc_assert (! TREE_CHAIN (id));
     }
 
-  assemble_name_raw (file, name);
+  return name;
+}
+
+/* Like assemble_name_raw, but should be used when NAME might refer to
+   an entity that is also represented as a tree (like a function or
+   variable).  If NAME does refer to such an entity, that entity will
+   be marked as referenced.  */
+
+void
+assemble_name (FILE *file, const char *name)
+{
+  assemble_name_raw (file, assemble_name_resolve (name));
 }
 
 /* Allocate SIZE bytes writable static space with a gensym name
-- 
2.20.1

        PR target/93335
        * config/aarch64/aarch64.c (aarch64_expand_subvti): Only use
        gen_subdi3_compare1_imm if low_in2 satisfies aarch64_plus_immediate
        predicate, not whenever it is CONST_INT.  Otherwise, force_reg it.
        Call force_reg on high_in2 unconditionally.

        * gcc.c-torture/compile/pr93335.c: New test.
---
 gcc/ChangeLog                                 |  8 ++
 gcc/config/aarch64/aarch64.c                  | 13 +--
 gcc/testsuite/ChangeLog                       |  5 +
 gcc/testsuite/gcc.c-torture/compile/pr93335.c | 98 +++++++++++++++++++
 4 files changed, 118 insertions(+), 6 deletions(-)
 create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr93335.c

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1d62d16d808..b91e5ca1682 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       PR target/93335
+       * config/aarch64/aarch64.c (aarch64_expand_subvti): Only use
+       gen_subdi3_compare1_imm if low_in2 satisfies aarch64_plus_immediate
+       predicate, not whenever it is CONST_INT.  Otherwise, force_reg it.
+       Call force_reg on high_in2 unconditionally.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        PR target/91298
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 82e9b1fbfd8..90c6ea35dc1 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -17247,14 +17247,15 @@ aarch64_expand_subvti (rtx op0, rtx low_dest, rtx 
low_in1,
     }
   else
     {
-      if (CONST_INT_P (low_in2))
+      if (aarch64_plus_immediate (low_in2, DImode))
+       emit_insn (gen_subdi3_compare1_imm (low_dest, low_in1, low_in2,
+                                           GEN_INT (-INTVAL (low_in2))));
+      else
        {
-         high_in2 = force_reg (DImode, high_in2);
-         emit_insn (gen_subdi3_compare1_imm (low_dest, low_in1, low_in2,
-                                             GEN_INT (-INTVAL (low_in2))));
+         low_in2 = force_reg (DImode, low_in2);
+         emit_insn (gen_subdi3_compare1 (low_dest, low_in1, low_in2));
        }
-      else
-       emit_insn (gen_subdi3_compare1 (low_dest, low_in1, low_in2));
+      high_in2 = force_reg (DImode, high_in2);
 
       if (unsigned_p)
        emit_insn (gen_usubdi3_carryinC (high_dest, high_in1, high_in2));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bebe9a75fa5..60c0a8ad578 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-22  Jakub Jelinek  <ja...@redhat.com>
+
+       PR target/93335
+       * gcc.c-torture/compile/pr93335.c: New test.
+
 2020-01-22  Jakub Jelinek  <ja...@redhat.com>
 
        PR target/91298
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr93335.c 
b/gcc/testsuite/gcc.c-torture/compile/pr93335.c
new file mode 100644
index 00000000000..c6e984cc6fe
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr93335.c
@@ -0,0 +1,98 @@
+/* PR target/93335 */
+/* { dg-do compile { target int128 } } */
+
+int
+f1 (unsigned int x)
+{
+  return __builtin_sub_overflow_p (x, 4096, (unsigned __int128) 0);
+}
+
+int
+f2 (unsigned int x)
+{
+  return __builtin_sub_overflow_p (x, 4097, (unsigned __int128) 0);
+}
+
+int
+f3 (int x)
+{
+  return __builtin_sub_overflow_p (x, 4096, (__int128) 0);
+}
+
+int
+f4 (int x)
+{
+  return __builtin_sub_overflow_p (x, 4097, (__int128) 0);
+}
+
+int
+f5 (unsigned int x)
+{
+  return __builtin_sub_overflow_p (x, -4096, (unsigned __int128) 0);
+}
+
+int
+f6 (unsigned int x)
+{
+  return __builtin_sub_overflow_p (x, -4097, (unsigned __int128) 0);
+}
+
+int
+f7 (int x)
+{
+  return __builtin_sub_overflow_p (x, -4096, (__int128) 0);
+}
+
+int
+f8 (int x)
+{
+  return __builtin_sub_overflow_p (x, -4097, (__int128) 0);
+}
+
+int
+f9 (unsigned int x)
+{
+  return __builtin_add_overflow_p (x, 4096, (unsigned __int128) 0);
+}
+
+int
+f10 (unsigned int x)
+{
+  return __builtin_add_overflow_p (x, 4097, (unsigned __int128) 0);
+}
+
+int
+f11 (int x)
+{
+  return __builtin_add_overflow_p (x, 4096, (__int128) 0);
+}
+
+int
+f12 (int x)
+{
+  return __builtin_add_overflow_p (x, 4097, (__int128) 0);
+}
+
+int
+f13 (unsigned int x)
+{
+  return __builtin_add_overflow_p (x, -4096, (unsigned __int128) 0);
+}
+
+int
+f14 (unsigned int x)
+{
+  return __builtin_add_overflow_p (x, -4097, (unsigned __int128) 0);
+}
+
+int
+f15 (int x)
+{
+  return __builtin_add_overflow_p (x, -4096, (__int128) 0);
+}
+
+int
+f16 (int x)
+{
+  return __builtin_add_overflow_p (x, -4097, (__int128) 0);
+}
-- 
2.20.1

Reply via email to