public inbox for gcc-regression@sourceware.org
help / color / mirror / Atom feed
* [TCWG CI] Regression caused by gdb: PR 28447: implement multiple parameters for .file on XCOFF
@ 2021-11-10 10:15 ci_notify
  0 siblings, 0 replies; only message in thread
From: ci_notify @ 2021-11-10 10:15 UTC (permalink / raw)
  To: Clément Chigot; +Cc: gcc-regression

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 149242 bytes --]

[TCWG CI] Regression caused by gdb: PR 28447: implement multiple parameters for .file on XCOFF:
commit e86fc4a5bc3747a6b811d93648a2afa4c1c74217
Author: Clément Chigot <clement.chigot@atos.net>

    PR 28447: implement multiple parameters for .file on XCOFF

Results regressed to
# reset_artifacts:
-10
# true:
0
# build_abe binutils:
1
# build_abe stage1:
2
# build_abe linux:
3
# build_abe glibc:
4
# build_abe stage2:
5
# First few build errors in logs:
# 00:01:18 ../../../../../../gdb/gdb/coffread.c:1343:29: error: ‘union internal_auxent::<unnamed struct>::<unnamed>’ has no member named ‘x_zeroes’
# 00:01:18 ../../../../../../gdb/gdb/coffread.c:1345:53: error: ‘union internal_auxent::<unnamed struct>::<unnamed>’ has no member named ‘x_offset’
# 00:01:18 ../../../../../../gdb/gdb/coffread.c:1347:57: error: ‘union internal_auxent::<unnamed struct>::<unnamed>’ has no member named ‘x_offset’
# 00:01:18 ../../../../../../gdb/gdb/coffread.c:1351:42: error: ‘struct internal_auxent::<unnamed>’ has no member named ‘x_fname’
# 00:01:18 make[1]: *** [Makefile:1651: coffread.o] Error 1
# 00:01:18 make: *** [Makefile:10436: all-gdb] Error 2

from
# reset_artifacts:
-10
# true:
0
# build_abe binutils:
1
# build_abe stage1:
2
# build_abe linux:
3
# build_abe glibc:
4
# build_abe stage2:
5
# build_abe gdb:
6
# build_abe qemu:
7

THIS IS THE END OF INTERESTING STUFF.  BELOW ARE LINKS TO BUILDS, REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT.

This commit has regressed these CI configurations:
 - tcwg_gnu_cross_build/master-aarch64

First_bad build: https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-aarch64/5/artifact/artifacts/build-e86fc4a5bc3747a6b811d93648a2afa4c1c74217/
Last_good build: https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-aarch64/5/artifact/artifacts/build-f493b71179ab70d5e278234cb763eede55d44e61/
Baseline build: https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-aarch64/5/artifact/artifacts/build-baseline/
Even more details: https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-aarch64/5/artifact/artifacts/

Reproduce builds:
<cut>
mkdir investigate-gdb-e86fc4a5bc3747a6b811d93648a2afa4c1c74217
cd investigate-gdb-e86fc4a5bc3747a6b811d93648a2afa4c1c74217

# Fetch scripts
git clone https://git.linaro.org/toolchain/jenkins-scripts

# Fetch manifests and test.sh script
mkdir -p artifacts/manifests
curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-aarch64/5/artifact/artifacts/manifests/build-baseline.sh --fail
curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-aarch64/5/artifact/artifacts/manifests/build-parameters.sh --fail
curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-aarch64/5/artifact/artifacts/test.sh --fail
chmod +x artifacts/test.sh

# Reproduce the baseline build (build all pre-requisites)
./jenkins-scripts/tcwg_gnu-build.sh @@ artifacts/manifests/build-baseline.sh

# Save baseline build state (which is then restored in artifacts/test.sh)
mkdir -p ./bisect
rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /gdb/ ./ ./bisect/baseline/

cd gdb

# Reproduce first_bad build
git checkout --detach e86fc4a5bc3747a6b811d93648a2afa4c1c74217
../artifacts/test.sh

# Reproduce last_good build
git checkout --detach f493b71179ab70d5e278234cb763eede55d44e61
../artifacts/test.sh

cd ..
</cut>

Full commit (up to 1000 lines):
<cut>
commit e86fc4a5bc3747a6b811d93648a2afa4c1c74217
Author: Clément Chigot <clement.chigot@atos.net>
Date:   Fri Oct 15 16:12:39 2021 +0200

    PR 28447: implement multiple parameters for .file on XCOFF
    
    On XCOFF, ".file" pseudo-op allows 3 extras parameters to provide
    additional information to AIX linker, or its debugger. These are
    stored in auxiliary entries of the C_FILE symbol.
    
    bfd/
            PR 28447
            * coffcode.h (combined_entry_type): Add extrap field.
            (coff_bigobj_swap_aux_in): Adjust names of x_file fields.
            (coff_bigobj_swap_aux_out): Likewise.
            * coffgen.c (coff_write_auxent_fname): New function.
            (coff_fix_symbol_name): Write x_file using
             coff_write_auxent_fname.
            (coff_write_symbol): Likewise.
            (coff_write_symbols): Add C_FILE auxiliary entries to
            string table if needed.
            (coff_get_normalized_symtab): Adjust names of x_file fields.
            Normalize C_FILE auxiliary entries.
            (coff_print_symbol): Print C_FILE auxiliary entries.
            * coff-rs6000.c (_bfd_xcoff_swap_aux_in): Adjust names of
            x_file fields.
            (_bfd_xcoff_swap_aux_out): Likewise.
            * coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Likewise.
            (_bfd_xcoff64_swap_aux_out): Likewise.
            * cofflink.c (_bfd_coff_final_link): Likewise.
            (_bfd_coff_link_input_bfd): Likewise.
            * coffswap.h (coff_swap_aux_in): Likewise.
            * peXXigen.c (_bfd_XXi_swap_aux_in): Likewise.
            (_bfd_XXi_swap_aux_out): Likewise.
            * xcofflink.c (xcoff_link_input_bfd): Likewise.
            * libcoff.h: Regenerate.
    gas/
            * config/tc-ppc.c (ppc_file): New function.
            * config/tc-ppc.h (OBJ_COFF_MAX_AUXENTRIES): Change to 4.
            * testsuite/gas/ppc/aix.exp: Add tests.
            * testsuite/gas/ppc/xcoff-file-32.d: New test.
            * testsuite/gas/ppc/xcoff-file-64.d: New test.
            * testsuite/gas/ppc/xcoff-file.s: New test.
    include/
            * coff/internal.h (union internal_auxent): Change x_file to be a
              struct instead of a union. Add x_ftype field.
            * coff/rs6000.h (union external_auxent): Add x_resv field.
            * coff/xcoff.h (XFT_FN): New define.
            (XFT_CT): Likewise.
            (XFT_CV): Likewise.
            (XFT_CD): Likewise.
---
 bfd/coff-rs6000.c                     |  14 ++--
 bfd/coff64-rs6000.c                   |  14 ++--
 bfd/coffcode.h                        |  10 ++-
 bfd/coffgen.c                         | 134 ++++++++++++++++++++++++++--------
 bfd/cofflink.c                        |  14 ++--
 bfd/coffswap.h                        |  14 ++--
 bfd/libcoff.h                         |   4 +
 bfd/peXXigen.c                        |  12 +--
 bfd/xcofflink.c                       |  12 +--
 gas/config/tc-ppc.c                   |  63 ++++++++++++++++
 gas/config/tc-ppc.h                   |   2 +-
 gas/testsuite/gas/ppc/aix.exp         |   3 +
 gas/testsuite/gas/ppc/xcoff-file-32.d |  13 ++++
 gas/testsuite/gas/ppc/xcoff-file-64.d |  13 ++++
 gas/testsuite/gas/ppc/xcoff-file.s    |   1 +
 include/coff/internal.h               |  25 ++++---
 include/coff/rs6000.h                 |   1 +
 include/coff/xcoff.h                  |   6 ++
 18 files changed, 273 insertions(+), 82 deletions(-)

diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 31d91190103..1cc2162e7d8 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -489,12 +489,13 @@ _bfd_xcoff_swap_aux_in (bfd *abfd, void * ext1, int type ATTRIBUTE_UNUSED,
     case C_FILE:
       if (ext->x_file.x_n.x_fname[0] == 0)
 	{
-	  in->x_file.x_n.x_zeroes = 0;
-	  in->x_file.x_n.x_offset =
+	  in->x_file.x_n.x_n.x_zeroes = 0;
+	  in->x_file.x_n.x_n.x_offset =
 	    H_GET_32 (abfd, ext->x_file.x_n.x_n.x_offset);
 	}
       else
-	memcpy (in->x_file.x_fname, ext->x_file.x_n.x_fname, FILNMLEN);
+	memcpy (in->x_file.x_n.x_fname, ext->x_file.x_n.x_fname, FILNMLEN);
+      in->x_file.x_ftype = H_GET_8 (abfd, ext->x_file.x_ftype);
       break;
 
       /* RS/6000 "csect" auxents.
@@ -573,14 +574,15 @@ _bfd_xcoff_swap_aux_out (bfd *abfd, void * inp, int type ATTRIBUTE_UNUSED,
       break;
 
     case C_FILE:
-      if (in->x_file.x_fname[0] == 0)
+      if (in->x_file.x_n.x_fname[0] == 0)
 	{
 	  H_PUT_32 (abfd, 0, ext->x_file.x_n.x_n.x_zeroes);
-	  H_PUT_32 (abfd, in->x_file.x_n.x_offset,
+	  H_PUT_32 (abfd, in->x_file.x_n.x_n.x_offset,
 		    ext->x_file.x_n.x_n.x_offset);
 	}
       else
-	memcpy (ext->x_file.x_n.x_fname, in->x_file.x_fname, FILNMLEN);
+	memcpy (ext->x_file.x_n.x_fname, in->x_file.x_n.x_fname, FILNMLEN);
+      H_PUT_8 (abfd, in->x_file.x_ftype, ext->x_file.x_ftype);
       break;
 
       /* RS/6000 "csect" auxents */
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index 8c206959fd3..95a31b606c8 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -386,12 +386,13 @@ _bfd_xcoff64_swap_aux_in (bfd *abfd, void *ext1, int type ATTRIBUTE_UNUSED,
 
       if (ext->x_file.x_n.x_n.x_zeroes[0] == 0)
 	{
-	  in->x_file.x_n.x_zeroes = 0;
-	  in->x_file.x_n.x_offset =
+	  in->x_file.x_n.x_n.x_zeroes = 0;
+	  in->x_file.x_n.x_n.x_offset =
 	    H_GET_32 (abfd, ext->x_file.x_n.x_n.x_offset);
 	}
       else
-	memcpy (in->x_file.x_fname, ext->x_file.x_n.x_fname, FILNMLEN);
+	memcpy (in->x_file.x_n.x_fname, ext->x_file.x_n.x_fname, FILNMLEN);
+      in->x_file.x_ftype = H_GET_8 (abfd, ext->x_file.x_ftype);
       break;
 
       /* RS/6000 "csect" auxents.
@@ -499,14 +500,15 @@ _bfd_xcoff64_swap_aux_out (bfd *abfd, void *inp, int type ATTRIBUTE_UNUSED,
       break;
 
     case C_FILE:
-      if (in->x_file.x_n.x_zeroes == 0)
+      if (in->x_file.x_n.x_n.x_zeroes == 0)
 	{
 	  H_PUT_32 (abfd, 0, ext->x_file.x_n.x_n.x_zeroes);
-	  H_PUT_32 (abfd, in->x_file.x_n.x_offset,
+	  H_PUT_32 (abfd, in->x_file.x_n.x_n.x_offset,
 		    ext->x_file.x_n.x_n.x_offset);
 	}
       else
-	memcpy (ext->x_file.x_n.x_fname, in->x_file.x_fname, FILNMLEN);
+	memcpy (ext->x_file.x_n.x_fname, in->x_file.x_n.x_fname, FILNMLEN);
+      H_PUT_8 (abfd, in->x_file.x_ftype, ext->x_file.x_ftype);
       H_PUT_8 (abfd, _AUX_FILE, ext->x_file.x_auxtype);
       break;
 
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 7967cedf918..f0b73a98881 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -326,6 +326,10 @@ CODE_FRAGMENT
 .
 . {* Selector for the union above.  *}
 . bool is_sym;
+.
+. {* An extra pointer which can used by format based on COFF (like XCOFF)
+.    to provide extra information to their backend.  *}
+. void *extrap;
 .} combined_entry_type;
 .
 .
@@ -5663,11 +5667,11 @@ coff_bigobj_swap_aux_in (bfd *abfd,
       if (numaux > 1)
 	{
 	  if (indx == 0)
-	    memcpy (in->x_file.x_fname, ext->File.Name,
+	    memcpy (in->x_file.x_n.x_fname, ext->File.Name,
 		    numaux * sizeof (AUXENT_BIGOBJ));
 	}
       else
-	memcpy (in->x_file.x_fname, ext->File.Name, sizeof (ext->File.Name));
+	memcpy (in->x_file.x_n.x_fname, ext->File.Name, sizeof (ext->File.Name));
       break;
 
     case C_STAT:
@@ -5712,7 +5716,7 @@ coff_bigobj_swap_aux_out (bfd * abfd,
   switch (in_class)
     {
     case C_FILE:
-      memcpy (ext->File.Name, in->x_file.x_fname, sizeof (ext->File.Name));
+      memcpy (ext->File.Name, in->x_file.x_n.x_fname, sizeof (ext->File.Name));
 
       return AUXESZ;
 
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 6627a9af4b6..40f1ac718e4 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -847,6 +847,34 @@ coff_mangle_symbols (bfd *bfd_ptr)
     }
 }
 
+static void
+coff_write_auxent_fname (bfd *abfd,
+			 char *str,
+			 union internal_auxent *auxent,
+			 bfd_size_type *string_size_p)
+{
+  unsigned int str_length = strlen (str);
+  unsigned int filnmlen = bfd_coff_filnmlen (abfd);
+
+  if (bfd_coff_long_filenames (abfd))
+    {
+      if (str_length <= filnmlen)
+	strncpy (auxent->x_file.x_n.x_fname, str, filnmlen);
+      else
+	{
+	  auxent->x_file.x_n.x_n.x_offset = *string_size_p + STRING_SIZE_SIZE;
+	  auxent->x_file.x_n.x_n.x_zeroes = 0;
+	  *string_size_p += str_length + 1;
+	}
+    }
+  else
+    {
+      strncpy (auxent->x_file.x_n.x_fname, str, filnmlen);
+      if (str_length > filnmlen)
+	str[filnmlen] = '\0';
+    }
+}
+
 static void
 coff_fix_symbol_name (bfd *abfd,
 		      asymbol *symbol,
@@ -856,7 +884,6 @@ coff_fix_symbol_name (bfd *abfd,
 		      bfd_size_type *debug_string_size_p)
 {
   unsigned int name_length;
-  union internal_auxent *auxent;
   char *name = (char *) (symbol->name);
 
   if (name == NULL)
@@ -871,8 +898,6 @@ coff_fix_symbol_name (bfd *abfd,
   if (native->u.syment.n_sclass == C_FILE
       && native->u.syment.n_numaux > 0)
     {
-      unsigned int filnmlen;
-
       if (bfd_coff_force_symnames_in_strings (abfd))
 	{
 	  native->u.syment._n._n_n._n_offset =
@@ -884,27 +909,8 @@ coff_fix_symbol_name (bfd *abfd,
 	strncpy (native->u.syment._n._n_name, ".file", SYMNMLEN);
 
       BFD_ASSERT (! (native + 1)->is_sym);
-      auxent = &(native + 1)->u.auxent;
-
-      filnmlen = bfd_coff_filnmlen (abfd);
-
-      if (bfd_coff_long_filenames (abfd))
-	{
-	  if (name_length <= filnmlen)
-	    strncpy (auxent->x_file.x_fname, name, filnmlen);
-	  else
-	    {
-	      auxent->x_file.x_n.x_offset = *string_size_p + STRING_SIZE_SIZE;
-	      auxent->x_file.x_n.x_zeroes = 0;
-	      *string_size_p += name_length + 1;
-	    }
-	}
-      else
-	{
-	  strncpy (auxent->x_file.x_fname, name, filnmlen);
-	  if (name_length > filnmlen)
-	    name[filnmlen] = '\0';
-	}
+      coff_write_auxent_fname (abfd, name, &(native + 1)->u.auxent,
+			       string_size_p);
     }
   else
     {
@@ -1029,6 +1035,11 @@ coff_write_symbol (bfd *abfd,
       for (j = 0; j < native->u.syment.n_numaux; j++)
 	{
 	  BFD_ASSERT (! (native + j + 1)->is_sym);
+
+	  if (native->u.syment.n_sclass == C_FILE && j > 0)
+	    coff_write_auxent_fname (abfd, (char *) (native + j + 1)->extrap,
+				     &(native + j + 1)->u.auxent, string_size_p);
+
 	  bfd_coff_swap_aux_out (abfd,
 				 &((native + j + 1)->u.auxent),
 				 type, n_sclass, (int) j,
@@ -1358,6 +1369,7 @@ coff_write_symbols (bfd *abfd)
 	  size_t name_length = strlen (q->name);
 	  coff_symbol_type *c_symbol = coff_symbol_from (q);
 	  size_t maxlen;
+	  bool is_c_file = false;
 
 	  /* Figure out whether the symbol name should go in the string
 	     table.  Symbol names that are short enough are stored
@@ -1384,6 +1396,7 @@ coff_write_symbols (bfd *abfd)
 	  else if (c_symbol->native->u.syment.n_sclass == C_FILE
 		   && c_symbol->native->u.syment.n_numaux > 0)
 	    {
+	      is_c_file=true;
 	      if (bfd_coff_force_symnames_in_strings (abfd))
 		{
 		  if (bfd_bwrite (".file", (bfd_size_type) 6, abfd) != 6)
@@ -1400,6 +1413,30 @@ coff_write_symbols (bfd *abfd)
 			     abfd) != name_length + 1)
 		return false;
 	    }
+
+	  /* Add strings for C_FILE aux entries. */
+	  if (is_c_file
+	      && c_symbol->native->u.syment.n_numaux > 1)
+	    {
+	      for (int j = 1; j < c_symbol->native->u.syment.n_numaux; j++)
+		{
+		  char *str;
+		  size_t str_length;
+
+		  if (c_symbol->native[j + 1].u.auxent.x_file.x_n.x_fname[0] != 0)
+		    continue;
+
+		  str = (char *) c_symbol->native[j + 1].extrap;
+		  str_length = strlen (str);
+		  if (str_length > maxlen)
+		    {
+		      if (bfd_bwrite ((void *) (str), (bfd_size_type) str_length + 1,
+				      abfd) != str_length + 1)
+			return false;
+		    }
+
+		}
+	    }
 	}
     }
   else
@@ -1872,7 +1909,7 @@ coff_get_normalized_symtab (bfd *abfd)
 	     the text ".file" is redundant.  */
 	  BFD_ASSERT (! aux->is_sym);
 
-	  if (aux->u.auxent.x_file.x_n.x_zeroes == 0)
+	  if (aux->u.auxent.x_file.x_n.x_n.x_zeroes == 0)
 	    {
 	      /* The filename is a long one, point into the string table.  */
 	      if (string_table == NULL)
@@ -1882,12 +1919,12 @@ coff_get_normalized_symtab (bfd *abfd)
 		    return NULL;
 		}
 
-	      if ((bfd_size_type)(aux->u.auxent.x_file.x_n.x_offset)
+	      if ((bfd_size_type)(aux->u.auxent.x_file.x_n.x_n.x_offset)
 		  >= obj_coff_strings_len (abfd))
 		internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) _("<corrupt>");
 	      else
 		internal_ptr->u.syment._n._n_n._n_offset =
-		  (bfd_hostptr_t) (string_table + (aux->u.auxent.x_file.x_n.x_offset));
+		  (bfd_hostptr_t) (string_table + (aux->u.auxent.x_file.x_n.x_n.x_offset));
 	    }
 	  else
 	    {
@@ -1899,15 +1936,48 @@ coff_get_normalized_symtab (bfd *abfd)
 		internal_ptr->u.syment._n._n_n._n_offset =
 		  (bfd_hostptr_t)
 		  copy_name (abfd,
-			     aux->u.auxent.x_file.x_fname,
+			     aux->u.auxent.x_file.x_n.x_fname,
 			     internal_ptr->u.syment.n_numaux * symesz);
 	      else
 		internal_ptr->u.syment._n._n_n._n_offset =
 		  ((bfd_hostptr_t)
 		   copy_name (abfd,
-			      aux->u.auxent.x_file.x_fname,
+			      aux->u.auxent.x_file.x_n.x_fname,
 			      (size_t) bfd_coff_filnmlen (abfd)));
 	    }
+
+	  /* Normalize other strings available in C_FILE aux entries.  */
+	  if (!coff_data (abfd)->pe)
+	    for (int numaux = 1; numaux < internal_ptr->u.syment.n_numaux; numaux++)
+	      {
+		aux = internal_ptr + numaux + 1;
+		BFD_ASSERT (! aux->is_sym);
+
+		if (aux->u.auxent.x_file.x_n.x_n.x_zeroes == 0)
+		  {
+		    /* The string information is a long one, point into the string table.  */
+		    if (string_table == NULL)
+		      {
+			string_table = _bfd_coff_read_string_table (abfd);
+			if (string_table == NULL)
+			  return NULL;
+		      }
+
+		    if ((bfd_size_type)(aux->u.auxent.x_file.x_n.x_n.x_offset)
+			>= obj_coff_strings_len (abfd))
+		      aux->u.auxent.x_file.x_n.x_n.x_offset = (bfd_hostptr_t) _("<corrupt>");
+		    else
+		      aux->u.auxent.x_file.x_n.x_n.x_offset =
+			(bfd_hostptr_t) (string_table + (aux->u.auxent.x_file.x_n.x_n.x_offset));
+		  }
+		else
+		  aux->u.auxent.x_file.x_n.x_n.x_offset =
+		    ((bfd_hostptr_t)
+		     copy_name (abfd,
+				aux->u.auxent.x_file.x_n.x_fname,
+				(size_t) bfd_coff_filnmlen (abfd)));
+	      }
+
 	}
       else
 	{
@@ -2135,6 +2205,12 @@ coff_print_symbol (bfd *abfd,
 		{
 		case C_FILE:
 		  fprintf (file, "File ");
+		  /* Add additional information if this isn't the filename
+		     auxiliary entry.  */
+		  if (aux)
+		    fprintf (file, "ftype %d fname \"%s\"",
+			     auxp->u.auxent.x_file.x_ftype,
+			     (char *) auxp->u.auxent.x_file.x_n.x_n.x_offset);
 		  break;
 
 		case C_DWARF:
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index b8a370933be..67d9c62b0b4 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -963,7 +963,7 @@ _bfd_coff_final_link (bfd *abfd,
 		  else
 		    {
 		      BFD_ASSERT (isym.n_numaux == 1);
-		      iaux.x_file.x_n.x_offset = STRING_SIZE_SIZE + indx;
+		      iaux.x_file.x_n.x_n.x_offset = STRING_SIZE_SIZE + indx;
 		      bfd_coff_swap_aux_out (abfd, &iaux, isym.n_type, C_FILE,
 					     0, 1, flaginfo.outsyms + symesz);
 		      if (bfd_seek (abfd, pos + symesz, SEEK_SET) != 0
@@ -2006,13 +2006,13 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
 		{
 		  /* If this is a long filename, we must put it in the
 		     string table.  */
-		  if (auxp->x_file.x_n.x_zeroes == 0
-		      && auxp->x_file.x_n.x_offset != 0)
+		  if (auxp->x_file.x_n.x_n.x_zeroes == 0
+		      && auxp->x_file.x_n.x_n.x_offset != 0)
 		    {
 		      const char *filename;
 		      bfd_size_type indx;
 
-		      BFD_ASSERT (auxp->x_file.x_n.x_offset
+		      BFD_ASSERT (auxp->x_file.x_n.x_n.x_offset
 				  >= STRING_SIZE_SIZE);
 		      if (strings == NULL)
 			{
@@ -2020,15 +2020,15 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
 			  if (strings == NULL)
 			    return false;
 			}
-		      if ((bfd_size_type) auxp->x_file.x_n.x_offset >= obj_coff_strings_len (input_bfd))
+		      if ((bfd_size_type) auxp->x_file.x_n.x_n.x_offset >= obj_coff_strings_len (input_bfd))
 			filename = _("<corrupt>");
 		      else
-			filename = strings + auxp->x_file.x_n.x_offset;
+			filename = strings + auxp->x_file.x_n.x_n.x_offset;
 		      indx = _bfd_stringtab_add (flaginfo->strtab, filename,
 						 hash, copy);
 		      if (indx == (bfd_size_type) -1)
 			return false;
-		      auxp->x_file.x_n.x_offset = STRING_SIZE_SIZE + indx;
+		      auxp->x_file.x_n.x_n.x_offset = STRING_SIZE_SIZE + indx;
 		    }
 		}
 	      else if ((isymp->n_sclass != C_STAT || isymp->n_type != T_NULL)
diff --git a/bfd/coffswap.h b/bfd/coffswap.h
index e0dbd04f399..a8bd932daf7 100644
--- a/bfd/coffswap.h
+++ b/bfd/coffswap.h
@@ -418,8 +418,8 @@ coff_swap_aux_in (bfd *abfd,
     case C_FILE:
       if (ext->x_file.x_fname[0] == 0)
 	{
-	  in->x_file.x_n.x_zeroes = 0;
-	  in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
+	  in->x_file.x_n.x_n.x_zeroes = 0;
+	  in->x_file.x_n.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
 	}
       else
 	{
@@ -429,11 +429,11 @@ coff_swap_aux_in (bfd *abfd,
 	  if (numaux > 1 && coff_data (abfd)->pe)
 	    {
 	      if (indx == 0)
-		memcpy (in->x_file.x_fname, ext->x_file.x_fname,
+		memcpy (in->x_file.x_n.x_fname, ext->x_file.x_fname,
 			numaux * sizeof (AUXENT));
 	    }
 	  else
-	    memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
+	    memcpy (in->x_file.x_n.x_fname, ext->x_file.x_fname, FILNMLEN);
 #endif
 	}
       goto end;
@@ -522,17 +522,17 @@ coff_swap_aux_out (bfd * abfd,
   switch (in_class)
     {
     case C_FILE:
-      if (in->x_file.x_fname[0] == 0)
+      if (in->x_file.x_n.x_fname[0] == 0)
 	{
 	  H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes);
-	  H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
+	  H_PUT_32 (abfd, in->x_file.x_n.x_n.x_offset, ext->x_file.x_n.x_offset);
 	}
       else
 	{
 #if FILNMLEN != E_FILNMLEN
 #error we need to cope with truncating or extending FILNMLEN
 #else
-	  memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
+	  memcpy (ext->x_file.x_fname, in->x_file.x_n.x_fname, FILNMLEN);
 #endif
 	}
       goto end;
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index 6dc68d1a398..1b4f988bb0b 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -658,6 +658,10 @@ typedef struct coff_ptr_struct
 
  /* Selector for the union above.  */
  bool is_sym;
+
+ /* An extra pointer which can used by format based on COFF (like XCOFF)
+    to provide extra information to their backend.  */
+ void *extrap;
 } combined_entry_type;
 
 
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index c41c3299277..e2a9cbb65c1 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -298,11 +298,11 @@ _bfd_XXi_swap_aux_in (bfd *	abfd,
     case C_FILE:
       if (ext->x_file.x_fname[0] == 0)
 	{
-	  in->x_file.x_n.x_zeroes = 0;
-	  in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
+	  in->x_file.x_n.x_n.x_zeroes = 0;
+	  in->x_file.x_n.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
 	}
       else
-	memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
+	memcpy (in->x_file.x_n.x_fname, ext->x_file.x_fname, FILNMLEN);
       return;
 
     case C_STAT:
@@ -370,13 +370,13 @@ _bfd_XXi_swap_aux_out (bfd *  abfd,
   switch (in_class)
     {
     case C_FILE:
-      if (in->x_file.x_fname[0] == 0)
+      if (in->x_file.x_n.x_fname[0] == 0)
 	{
 	  H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes);
-	  H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
+	  H_PUT_32 (abfd, in->x_file.x_n.x_n.x_offset, ext->x_file.x_n.x_offset);
 	}
       else
-	memcpy (ext->x_file.x_fname, in->x_file.x_fname, sizeof (ext->x_file.x_fname));
+	memcpy (ext->x_file.x_fname, in->x_file.x_n.x_fname, sizeof (ext->x_file.x_fname));
 
       return AUXESZ;
 
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index 3ca74ce0277..e87ed0e683b 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -4550,13 +4550,13 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo,
 		  /* This is the file name (or some comment put in by
 		     the compiler).  If it is long, we must put it in
 		     the string table.  */
-		  if (aux.x_file.x_n.x_zeroes == 0
-		      && aux.x_file.x_n.x_offset != 0)
+		  if (aux.x_file.x_n.x_n.x_zeroes == 0
+		      && aux.x_file.x_n.x_n.x_offset != 0)
 		    {
 		      const char *filename;
 		      bfd_size_type indx;
 
-		      BFD_ASSERT (aux.x_file.x_n.x_offset
+		      BFD_ASSERT (aux.x_file.x_n.x_n.x_offset
 				  >= STRING_SIZE_SIZE);
 		      if (strings == NULL)
 			{
@@ -4564,15 +4564,15 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo,
 			  if (strings == NULL)
 			    return false;
 			}
-		      if ((bfd_size_type) aux.x_file.x_n.x_offset >= obj_coff_strings_len (input_bfd))
+		      if ((bfd_size_type) aux.x_file.x_n.x_n.x_offset >= obj_coff_strings_len (input_bfd))
 			filename = _("<corrupt>");
 		      else
-			filename = strings + aux.x_file.x_n.x_offset;
+			filename = strings + aux.x_file.x_n.x_n.x_offset;
 		      indx = _bfd_stringtab_add (flinfo->strtab, filename,
 						 hash, copy);
 		      if (indx == (bfd_size_type) -1)
 			return false;
-		      aux.x_file.x_n.x_offset = STRING_SIZE_SIZE + indx;
+		      aux.x_file.x_n.x_n.x_offset = STRING_SIZE_SIZE + indx;
 		    }
 		}
 	      else if (CSECT_SYM_P (isymp->n_sclass)
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index af025af32ff..8750e379158 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -107,6 +107,7 @@ static void ppc_es (int);
 static void ppc_csect (int);
 static void ppc_dwsect (int);
 static void ppc_change_csect (symbolS *, offsetT);
+static void ppc_file (int);
 static void ppc_function (int);
 static void ppc_extern (int);
 static void ppc_lglobl (int);
@@ -227,6 +228,7 @@ const pseudo_typeS md_pseudo_table[] =
   { "ei",	ppc_biei,	1 },
   { "es",	ppc_es,		0 },
   { "extern",	ppc_extern,	0 },
+  { "file",	ppc_file,	0 },
   { "function",	ppc_function,	0 },
   { "lglobl",	ppc_lglobl,	0 },
   { "ref",	ppc_ref,	0 },
@@ -5073,6 +5075,67 @@ ppc_stabx (int ignore ATTRIBUTE_UNUSED)
   demand_empty_rest_of_line ();
 }
 
+/* The .file pseudo-op. On XCOFF, .file can have several parameters
+   which are being added to the symbol table to provide additional
+   information.  */
+
+static void
+ppc_file (int ignore ATTRIBUTE_UNUSED)
+{
+  char *sfname, *s1 = NULL, *s2 = NULL, *s3 = NULL;
+  int length, auxnb = 1;
+
+  /* Some assemblers tolerate immediately following '"'.  */
+  if ((sfname = demand_copy_string (&length)) != 0)
+    {
+      coff_symbol_type *coffsym;
+      if (*input_line_pointer == ',')
+	{
+	  ++input_line_pointer;
+	  s1 = demand_copy_string (&length);
+	  auxnb++;
+
+	  if (*input_line_pointer == ',')
+	    {
+	      ++input_line_pointer;
+	      s2 = demand_copy_string (&length);
+	      auxnb++;
+
+	      if (*input_line_pointer == ',')
+		{
+		  ++input_line_pointer;
+		  s3 = demand_copy_string (&length);
+		  auxnb++;
+		}
+	    }
+	}
+
+      /* Use coff dot_file creation and adjust auxiliary entries.  */
+      c_dot_file_symbol (sfname, 0);
+      S_SET_NUMBER_AUXILIARY (symbol_rootP, auxnb);
+      coffsym = coffsymbol (symbol_get_bfdsym (symbol_rootP));
+      coffsym->native[1].u.auxent.x_file.x_ftype = XFT_FN;
+
+      if (s1)
+	{
+	  coffsym->native[2].u.auxent.x_file.x_ftype = XFT_CT;
+	  coffsym->native[2].extrap = s1;
+	}
+      if (s2)
+	{
+	  coffsym->native[3].u.auxent.x_file.x_ftype = XFT_CV;
+	  coffsym->native[3].extrap = s2;
+	}
+      if (s3)
+	{
+	  coffsym->native[4].u.auxent.x_file.x_ftype = XFT_CD;
+	  coffsym->native[4].extrap = s3;
+	}
+
+      demand_empty_rest_of_line ();
+    }
+}
+
 /* The .function pseudo-op.  This takes several arguments.  The first
    argument seems to be the external name of the symbol.  The second
    argument seems to be the label for the start of the function.  gcc
diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h
index fb18730db3c..2d0a8865d98 100644
--- a/gas/config/tc-ppc.h
+++ b/gas/config/tc-ppc.h
@@ -146,7 +146,7 @@ struct ppc_tc_sy
 #define TC_SYMFIELD_TYPE struct ppc_tc_sy
 
 /* We need an additional auxent for function symbols.  */
-#define OBJ_COFF_MAX_AUXENTRIES 2
+#define OBJ_COFF_MAX_AUXENTRIES 4
 
 /* Square and curly brackets are permitted in symbol names.  */
 #define LEX_BR 3
diff --git a/gas/testsuite/gas/ppc/aix.exp b/gas/testsuite/gas/ppc/aix.exp
index aef295bc3b9..c6d10d5fb84 100644
--- a/gas/testsuite/gas/ppc/aix.exp
+++ b/gas/testsuite/gas/ppc/aix.exp
@@ -84,4 +84,7 @@ if { [istarget "powerpc*-*-aix*"] || [istarget "rs6000-*-aix*"] } then {
 
     run_dump_test "xcoff-stsym-32"
     run_dump_test "xcoff-stsym-64"
+
+    run_dump_test "xcoff-file-32"
+    run_dump_test "xcoff-file-64"
 }
diff --git a/gas/testsuite/gas/ppc/xcoff-file-32.d b/gas/testsuite/gas/ppc/xcoff-file-32.d
new file mode 100644
index 00000000000..a831b3b4587
--- /dev/null
+++ b/gas/testsuite/gas/ppc/xcoff-file-32.d
@@ -0,0 +1,13 @@
+#as: -a32
+#source: xcoff-file.s
+#objdump: -t
+#name: XCOFF file test (32-bit)
+
+.*
+
+SYMBOL TABLE:
+\[  0\].*\(scl 103\) \(nx 4\) .* file.s
+File 
+File ftype 1 fname "A long string"
+File ftype 2 fname "short"
+File ftype 128 fname "Another long string inside the strign table."
diff --git a/gas/testsuite/gas/ppc/xcoff-file-64.d b/gas/testsuite/gas/ppc/xcoff-file-64.d
new file mode 100644
index 00000000000..12bb6efc93b
--- /dev/null
+++ b/gas/testsuite/gas/ppc/xcoff-file-64.d
@@ -0,0 +1,13 @@
+#as: -a64
+#source: xcoff-file.s
+#objdump: -t
+#name: XCOFF file test (64-bit)
+
+.*
+
+SYMBOL TABLE:
+\[  0\].*\(scl 103\) \(nx 4\) .* file.s
+File 
+File ftype 1 fname "A long string"
+File ftype 2 fname "short"
+File ftype 128 fname "Another long string inside the strign table."
diff --git a/gas/testsuite/gas/ppc/xcoff-file.s b/gas/testsuite/gas/ppc/xcoff-file.s
new file mode 100644
index 00000000000..229ab889f49
--- /dev/null
+++ b/gas/testsuite/gas/ppc/xcoff-file.s
@@ -0,0 +1 @@
+.file "file.s", "A long string", "short", "Another long string inside the strign table."
diff --git a/include/coff/internal.h b/include/coff/internal.h
index 8d757acb333..d01af7380c8 100644
--- a/include/coff/internal.h
+++ b/include/coff/internal.h
@@ -578,18 +578,21 @@ union internal_auxent
     unsigned short x_tvndx;	/* tv index */
   }      x_sym;
 
-  union
+  struct
   {
-    /* PR 17754: We use to FILNMLEN for the size of the x_fname
-       array, but that causes problems as PE targets use a larger
-       value.  We cannot use their definition of E_FILNMLEN as this
-       header can be used without including any PE headers.  */
-    char x_fname[20];
-    struct
-    {
-      long x_zeroes;
-      long x_offset;
-    }      x_n;
+    union {
+      /* PR 17754: We use to FILNMLEN for the size of the x_fname
+	 array, but that causes problems as PE targets use a larger
+	 value.  We cannot use their definition of E_FILNMLEN as this
+	 header can be used without including any PE headers.  */
+      char x_fname[20];
+      struct
+      {
+	long x_zeroes;
+	long x_offset;
+      }      x_n;
+    } x_n;
+    unsigned char x_ftype;
   }     x_file;
 
   struct
diff --git a/include/coff/rs6000.h b/include/coff/rs6000.h
index e60efff23b6..fd3f01dccbc 100644
--- a/include/coff/rs6000.h
+++ b/include/coff/rs6000.h
@@ -176,6 +176,7 @@ union external_auxent {
       } x_n;
     } x_n;
     char x_ftype[1];
+    char x_resv[3];
   } x_file;
 
   struct {
diff --git a/include/coff/xcoff.h b/include/coff/xcoff.h
index 2b61545d611..1cff7dc30d5 100644
--- a/include/coff/xcoff.h
+++ b/include/coff/xcoff.h
@@ -190,6 +190,12 @@
 #define XMC_UL     21          /* Read-write uninitialized TLS data */
 #define XMC_TE     22          /* Same as XMC_TC but mapped after it */
 
+/* x_ftype values:  */
+#define XFT_FN 0    /* Specifies the source-file name */
+#define XFT_CT 1    /* Specifies the compiler time stamp */
+#define XFT_CV 2    /* Specifies the compiler version number */
+#define XFT_CD 128  /*Specifies compiler-defined information */
+
 /* The ldhdr structure.  This appears at the start of the .loader
    section.  */
 
</cut>
>From ci_notify@linaro.org  Wed Nov 10 15:27:17 2021
Return-Path: <ci_notify@linaro.org>
X-Original-To: gcc-regression@gcc.gnu.org
Delivered-To: gcc-regression@gcc.gnu.org
Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com
 [IPv6:2a00:1450:4864:20::436])
 by sourceware.org (Postfix) with ESMTPS id 658C03858400
 for <gcc-regression@gcc.gnu.org>; Wed, 10 Nov 2021 15:27:12 +0000 (GMT)
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 658C03858400
Received: by mail-wr1-x436.google.com with SMTP id w29so4650062wra.12
 for <gcc-regression@gcc.gnu.org>; Wed, 10 Nov 2021 07:27:12 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d\x1e100.net; s 210112;
 h=x-gm-message-state:from:date:to:cc:message-id:subject:mime-version;
 bh=SaFbPTYwTUJ7dXFJsguLW9cOAfwEIASsi3Knd+X5jzM=;
 b=NoT3xnLRKqojWsRCCoEal1TsMCsytfMCD42j/5XncUibokJBG7DzxzJQAZq01aO0ET
 c2MUu6AVrma9WrxiMUDu8d5ChnTkvvG4tYw6JQShdtqAwTVznW9V08S8CkMDhTaWuLmv
 sVyoUzYnuXFKqxsWyUQ4i6gVgvEQ8mFoyaZSUzDvBFsQgl7KMN8IjRYNDr/v6Lc6ILbP
 G8pET+7WsFs91fnuwpws5d240c7qzsZ14NnYqBrpX3pcZkArXljVZIlSh/4vQrIe2AIk
 ENu4wpDsukxhb3FWqGSctTDG63+9zB+cq23q+HLDsNQTpFgR/i5ba7FsUvr5kWTn57P7
 OP0Q=X-Gm-Message-State: AOAM530+sO2OH0AahscatREztY/FKHWB/0BTvyEtiexzVD+IAdAtazeN
 56+v7m1WvhtlUY1uNAusuafvew=X-Google-Smtp-Source: ABdhPJxjVXvzLC7UU5AhYevNkHHSh5LXJhqdZPDsBcWAl8WZ10ovV4xZOBFBnmCHsM83XjqJSJDymw=X-Received: by 2002:adf:e50b:: with SMTP id j11mr669733wrm.430.1636558031200;
 Wed, 10 Nov 2021 07:27:11 -0800 (PST)
Received: from jenkins.jenkins (ci.linaro.org. [88.99.136.175])
 by smtp.gmail.com with ESMTPSA id k27sm6601014wms.41.2021.11.10.07.27.10
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits\x128/128);
 Wed, 10 Nov 2021 07:27:10 -0800 (PST)
From: ci_notify@linaro.org
X-Google-Original-From: linaro-infrastructure-errors@lists.linaro.org
Date: Wed, 10 Nov 2021 15:27:09 +0000 (UTC)
To: liuhongt <hongtao.liu@intel.com>
Cc: gcc-regression@gcc.gnu.org
Message-ID: <1551052421.6500.1636558030604@jenkins.jenkins>
Subject: [TCWG CI] Regression caused by gcc: Improve integer bit test on
 __atomic_fetch_[or|and]_* returns
MIME-Version: 1.0
X-Jenkins-Job: TCWG Bisect tcwg_gnu_native_build/master-aarch64
X-Jenkins-Result: SUCCESS
X-Spam-Status: No, score=-13.6 required=5.0 testsºYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH,
 KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS,
 TXREP autolearn=ham autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
 server2.sourceware.org
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
X-BeenThere: gcc-regression@gcc.gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Gcc-regression mailing list <gcc-regression.gcc.gnu.org>
List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-regression>,
 <mailto:gcc-regression-request@gcc.gnu.org?subject=unsubscribe>
List-Archive: <https://gcc.gnu.org/pipermail/gcc-regression/>
List-Post: <mailto:gcc-regression@gcc.gnu.org>
List-Help: <mailto:gcc-regression-request@gcc.gnu.org?subject=help>
List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-regression>,
 <mailto:gcc-regression-request@gcc.gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 10 Nov 2021 15:27:17 -0000

[TCWG CI] Regression caused by gcc: Improve integer bit test on __atomic_fetch_[or|and]_* returns:
commit fb161782545224f55ba26ba663889c5e6e9a04d1
Author: liuhongt <hongtao.liu@intel.com>

    Improve integer bit test on __atomic_fetch_[or|and]_* returns

Results regressed to
# reset_artifacts:
-10
# true:
0
# build_abe binutils:
1
# build_abe gcc:
2
# build_abe linux:
4
# First few build errors in logs:
# 00:00:04     vfprintf-internal.c:2093:15: error: 'memmove' specified bound between 9223372036854775808 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
# 00:00:41 pthread_cancel.c:60:1: error: type mismatch in binary expression
# 00:00:41 pthread_cancel.c:60:1: internal compiler error: verify_gimple failed
# 00:00:41 make[2]: *** [../o-iterator.mk:9: /home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/builds/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/glibc-glibc.git~master/nptl/pthread_cancel.o] Error 1
# 00:00:41 make[1]: *** [Makefile:483: nptl/subdir_lib] Error 2
# 00:00:41 make: *** [Makefile:9: all] Error 2

from
# reset_artifacts:
-10
# true:
0
# build_abe binutils:
1
# build_abe gcc:
2
# build_abe linux:
4
# build_abe glibc:
5
# build_abe gdb:
6

THIS IS THE END OF INTERESTING STUFF.  BELOW ARE LINKS TO BUILDS, REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT.

This commit has regressed these CI configurations:
 - tcwg_gnu_native_build/master-aarch64

First_bad build: https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-aarch64/5/artifact/artifacts/build-fb161782545224f55ba26ba663889c5e6e9a04d1/
Last_good build: https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-aarch64/5/artifact/artifacts/build-f15ad1e3f9488a31abf1c122bd186c1a3d2a5dbc/
Baseline build: https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-aarch64/5/artifact/artifacts/build-baseline/
Even more details: https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-aarch64/5/artifact/artifacts/

Reproduce builds:
<cut>
mkdir investigate-gcc-fb161782545224f55ba26ba663889c5e6e9a04d1
cd investigate-gcc-fb161782545224f55ba26ba663889c5e6e9a04d1

# Fetch scripts
git clone https://git.linaro.org/toolchain/jenkins-scripts

# Fetch manifests and test.sh script
mkdir -p artifacts/manifests
curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-aarch64/5/artifact/artifacts/manifests/build-baseline.sh --fail
curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-aarch64/5/artifact/artifacts/manifests/build-parameters.sh --fail
curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-aarch64/5/artifact/artifacts/test.sh --fail
chmod +x artifacts/test.sh

# Reproduce the baseline build (build all pre-requisites)
./jenkins-scripts/tcwg_gnu-build.sh @@ artifacts/manifests/build-baseline.sh

# Save baseline build state (which is then restored in artifacts/test.sh)
mkdir -p ./bisect
rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /gcc/ ./ ./bisect/baseline/

cd gcc

# Reproduce first_bad build
git checkout --detach fb161782545224f55ba26ba663889c5e6e9a04d1
../artifacts/test.sh

# Reproduce last_good build
git checkout --detach f15ad1e3f9488a31abf1c122bd186c1a3d2a5dbc
../artifacts/test.sh

cd ..
</cut>

Full commit (up to 1000 lines):
<cut>
commit fb161782545224f55ba26ba663889c5e6e9a04d1
Author: liuhongt <hongtao.liu@intel.com>
Date:   Mon Oct 25 13:59:51 2021 +0800

    Improve integer bit test on __atomic_fetch_[or|and]_* returns

    commit adedd5c173388ae505470df152b9cb3947339566
    Author: Jakub Jelinek <jakub@redhat.com>
    Date:   Tue May 3 13:37:25 2016 +0200

        re PR target/49244 (__sync or __atomic builtins will not emit 'lock bts/btr/btc')

    optimized bit test on __atomic_fetch_or_* and __atomic_fetch_and_* returns
    with lock bts/btr/btc by turning

      mask_2 = 1 << cnt_1;
      _4 = __atomic_fetch_or_* (ptr_6, mask_2, _3);
      _5 = _4 & mask_2;

    into

      _4 = ATOMIC_BIT_TEST_AND_SET (ptr_6, cnt_1, 0, _3);
      _5 = _4;

    and

      mask_6 = 1 << bit_5(D);
      _1 = ~mask_6;
      _2 = __atomic_fetch_and_4 (v_8(D), _1, 0);
      _3 = _2 & mask_6;
      _4 = _3 != 0;

    into

      mask_6 = 1 << bit_5(D);
      _1 = ~mask_6;
      _11 = .ATOMIC_BIT_TEST_AND_RESET (v_8(D), bit_5(D), 1, 0);
      _4 = _11 != 0;

    But it failed to optimize many equivalent, but slighly different cases:

    1.
      _1 = __atomic_fetch_or_4 (ptr_6, 1, _3);
      _4 = (_Bool) _1;
    2.
      _1 = __atomic_fetch_and_4 (ptr_6, ~1, _3);
      _4 = (_Bool) _1;
    3.
      _1 = __atomic_fetch_or_4 (ptr_6, 1, _3);
      _7 = ~_1;
      _5 = (_Bool) _7;
    4.
      _1 = __atomic_fetch_and_4 (ptr_6, ~1, _3);
      _7 = ~_1;
      _5 = (_Bool) _7;
    5.
      _1 = __atomic_fetch_or_4 (ptr_6, 1, _3);
      _2 = (int) _1;
      _7 = ~_2;
      _5 = (_Bool) _7;
    6.
      _1 = __atomic_fetch_and_4 (ptr_6, ~1, _3);
      _2 = (int) _1;
      _7 = ~_2;
      _5 = (_Bool) _7;
    7.
      _1 = __atomic_fetch_or_4 (ptr_6, 0x80000000, _3);
      _5 = (signed int) _1;
      _4 = _5 < 0;
    8.
      _1 = __atomic_fetch_and_4 (ptr_6, 0x7fffffff, _3);
      _5 = (signed int) _1;
      _4 = _5 < 0;
    9.
      _1 = 1 << bit_4(D);
      mask_5 = (unsigned int) _1;
      _2 = __atomic_fetch_or_4 (v_7(D), mask_5, 0);
      _3 = _2 & mask_5;
    10.
      mask_7 = 1 << bit_6(D);
      _1 = ~mask_7;
      _2 = (unsigned int) _1;
      _3 = __atomic_fetch_and_4 (v_9(D), _2, 0);
      _4 = (int) _3;
      _5 = _4 & mask_7;

    We make

      mask_2 = 1 << cnt_1;
      _4 = __atomic_fetch_or_* (ptr_6, mask_2, _3);
      _5 = _4 & mask_2;

    and

      mask_6 = 1 << bit_5(D);
      _1 = ~mask_6;
      _2 = __atomic_fetch_and_4 (v_8(D), _1, 0);
      _3 = _2 & mask_6;
      _4 = _3 != 0;

    the canonical forms for this optimization and transform cases 1-9 to the
    equivalent canonical form.  For cases 10 and 11, we simply remove the cast
    before __atomic_fetch_or_4/__atomic_fetch_and_4 with

      _1 = 1 << bit_4(D);
      _2 = __atomic_fetch_or_4 (v_7(D), _1, 0);
      _3 = _2 & _1;

    and

      mask_7 = 1 << bit_6(D);
      _1 = ~mask_7;
      _3 = __atomic_fetch_and_4 (v_9(D), _1, 0);
      _6 = _3 & mask_7;
      _5 = (int) _6;

    2021-11-04  H.J. Lu  <hongjiu.lu@intel.com>
                Hongtao Liu  <hongtao.liu@intel.com>
    gcc/

            PR middle-end/102566
            * match.pd (nop_atomic_bit_test_and_p): New match.
            * tree-ssa-ccp.c (convert_atomic_bit_not): New function.
            (gimple_nop_atomic_bit_test_and_p): New prototype.
            (optimize_atomic_bit_test_and): Transform equivalent, but slighly
            different cases to their canonical forms.

    gcc/testsuite/

            PR middle-end/102566
            * g++.target/i386/pr102566-1.C: New test.
            * g++.target/i386/pr102566-2.C: Likewise.
            * g++.target/i386/pr102566-3.C: Likewise.
            * g++.target/i386/pr102566-4.C: Likewise.
            * g++.target/i386/pr102566-5a.C: Likewise.
            * g++.target/i386/pr102566-5b.C: Likewise.
            * g++.target/i386/pr102566-6a.C: Likewise.
            * g++.target/i386/pr102566-6b.C: Likewise.
            * gcc.target/i386/pr102566-1a.c: Likewise.
            * gcc.target/i386/pr102566-1b.c: Likewise.
            * gcc.target/i386/pr102566-2.c: Likewise.
            * gcc.target/i386/pr102566-3a.c: Likewise.
            * gcc.target/i386/pr102566-3b.c: Likewise.
            * gcc.target/i386/pr102566-4.c: Likewise.
            * gcc.target/i386/pr102566-5.c: Likewise.
            * gcc.target/i386/pr102566-6.c: Likewise.
            * gcc.target/i386/pr102566-7.c: Likewise.
            * gcc.target/i386/pr102566-8a.c: Likewise.
            * gcc.target/i386/pr102566-8b.c: Likewise.
            * gcc.target/i386/pr102566-9a.c: Likewise.
            * gcc.target/i386/pr102566-9b.c: Likewise.
            * gcc.target/i386/pr102566-10a.c: Likewise.
            * gcc.target/i386/pr102566-10b.c: Likewise.
            * gcc.target/i386/pr102566-11.c: Likewise.
            * gcc.target/i386/pr102566-12.c: Likewise.
            * gcc.target/i386/pr102566-13.c: New test.
            * gcc.target/i386/pr102566-14.c: New test.
---
 gcc/match.pd                                 | 103 ++++++
 gcc/testsuite/g++.target/i386/pr102566-1.C   |  31 ++
 gcc/testsuite/g++.target/i386/pr102566-2.C   |  31 ++
 gcc/testsuite/g++.target/i386/pr102566-3.C   |  31 ++
 gcc/testsuite/g++.target/i386/pr102566-4.C   |  29 ++
 gcc/testsuite/g++.target/i386/pr102566-5a.C  |  31 ++
 gcc/testsuite/g++.target/i386/pr102566-5b.C  |  31 ++
 gcc/testsuite/g++.target/i386/pr102566-6a.C  |  31 ++
 gcc/testsuite/g++.target/i386/pr102566-6b.C  |  31 ++
 gcc/testsuite/gcc.target/i386/pr102566-10a.c |  15 +
 gcc/testsuite/gcc.target/i386/pr102566-10b.c |  15 +
 gcc/testsuite/gcc.target/i386/pr102566-11.c  |  28 ++
 gcc/testsuite/gcc.target/i386/pr102566-12.c  |  28 ++
 gcc/testsuite/gcc.target/i386/pr102566-13.c  |  66 ++++
 gcc/testsuite/gcc.target/i386/pr102566-14.c  |  65 ++++
 gcc/testsuite/gcc.target/i386/pr102566-1a.c  | 188 +++++++++++
 gcc/testsuite/gcc.target/i386/pr102566-1b.c  | 107 +++++++
 gcc/testsuite/gcc.target/i386/pr102566-2.c   |  32 ++
 gcc/testsuite/gcc.target/i386/pr102566-3a.c  |  15 +
 gcc/testsuite/gcc.target/i386/pr102566-3b.c  |  15 +
 gcc/testsuite/gcc.target/i386/pr102566-4.c   |  15 +
 gcc/testsuite/gcc.target/i386/pr102566-5.c   |  15 +
 gcc/testsuite/gcc.target/i386/pr102566-6.c   |  32 ++
 gcc/testsuite/gcc.target/i386/pr102566-7.c   |  30 ++
 gcc/testsuite/gcc.target/i386/pr102566-8a.c  |  32 ++
 gcc/testsuite/gcc.target/i386/pr102566-8b.c  |  32 ++
 gcc/testsuite/gcc.target/i386/pr102566-9a.c  |  32 ++
 gcc/testsuite/gcc.target/i386/pr102566-9b.c  |  32 ++
 gcc/tree-ssa-ccp.c                           | 456 ++++++++++++++++++++++++---
 29 files changed, 1557 insertions(+), 42 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 7826af1998a..a319aefa808 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -105,6 +105,39 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 (define_operator_list COND_TERNARY
   IFN_COND_FMA IFN_COND_FMS IFN_COND_FNMA IFN_COND_FNMS)

+/* __atomic_fetch_or_*, __atomic_fetch_xor_*, __atomic_xor_fetch_*  */
+(define_operator_list ATOMIC_FETCH_OR_XOR_N
+  BUILT_IN_ATOMIC_FETCH_OR_1 BUILT_IN_ATOMIC_FETCH_OR_2
+  BUILT_IN_ATOMIC_FETCH_OR_4 BUILT_IN_ATOMIC_FETCH_OR_8
+  BUILT_IN_ATOMIC_FETCH_OR_16
+  BUILT_IN_ATOMIC_FETCH_XOR_1 BUILT_IN_ATOMIC_FETCH_XOR_2
+  BUILT_IN_ATOMIC_FETCH_XOR_4 BUILT_IN_ATOMIC_FETCH_XOR_8
+  BUILT_IN_ATOMIC_FETCH_XOR_16
+  BUILT_IN_ATOMIC_XOR_FETCH_1 BUILT_IN_ATOMIC_XOR_FETCH_2
+  BUILT_IN_ATOMIC_XOR_FETCH_4 BUILT_IN_ATOMIC_XOR_FETCH_8
+  BUILT_IN_ATOMIC_XOR_FETCH_16)
+/* __sync_fetch_and_or_*, __sync_fetch_and_xor_*, __sync_xor_and_fetch_*  */
+(define_operator_list SYNC_FETCH_OR_XOR_N
+  BUILT_IN_SYNC_FETCH_AND_OR_1 BUILT_IN_SYNC_FETCH_AND_OR_2
+  BUILT_IN_SYNC_FETCH_AND_OR_4 BUILT_IN_SYNC_FETCH_AND_OR_8
+  BUILT_IN_SYNC_FETCH_AND_OR_16
+  BUILT_IN_SYNC_FETCH_AND_XOR_1 BUILT_IN_SYNC_FETCH_AND_XOR_2
+  BUILT_IN_SYNC_FETCH_AND_XOR_4 BUILT_IN_SYNC_FETCH_AND_XOR_8
+  BUILT_IN_SYNC_FETCH_AND_XOR_16
+  BUILT_IN_SYNC_XOR_AND_FETCH_1 BUILT_IN_SYNC_XOR_AND_FETCH_2
+  BUILT_IN_SYNC_XOR_AND_FETCH_4 BUILT_IN_SYNC_XOR_AND_FETCH_8
+  BUILT_IN_SYNC_XOR_AND_FETCH_16)
+/* __atomic_fetch_and_*.  */
+(define_operator_list ATOMIC_FETCH_AND_N
+  BUILT_IN_ATOMIC_FETCH_AND_1 BUILT_IN_ATOMIC_FETCH_AND_2
+  BUILT_IN_ATOMIC_FETCH_AND_4 BUILT_IN_ATOMIC_FETCH_AND_8
+  BUILT_IN_ATOMIC_FETCH_AND_16)
+/* __sync_fetch_and_and_*.  */
+(define_operator_list SYNC_FETCH_AND_AND_N
+  BUILT_IN_SYNC_FETCH_AND_AND_1 BUILT_IN_SYNC_FETCH_AND_AND_2
+  BUILT_IN_SYNC_FETCH_AND_AND_4 BUILT_IN_SYNC_FETCH_AND_AND_8
+  BUILT_IN_SYNC_FETCH_AND_AND_16)
+
 /* With nop_convert? combine convert? and view_convert? in one pattern
    plus conditionalize on tree_nop_conversion_p conversions.  */
 (match (nop_convert @0)
@@ -3976,6 +4009,76 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
   (vec_cond @0 (op! @3 @1) (op! @3 @2))))
 #endif

+#if GIMPLE
+(match (nop_atomic_bit_test_and_p @0 @1 @4)
+ (bit_and (nop_convert?@4 (ATOMIC_FETCH_OR_XOR_N @2 INTEGER_CST@0 @3))
+	   INTEGER_CST@1)
+ (with {
+	 int ibit = tree_log2 (@0);
+	 int ibit2 = tree_log2 (@1);
+       }
+  (if (ibit == ibit2
+      && ibit >= 0))))
+
+(match (nop_atomic_bit_test_and_p @0 @1 @3)
+ (bit_and (nop_convert?@3 (SYNC_FETCH_OR_XOR_N @2 INTEGER_CST@0))
+	  INTEGER_CST@1)
+ (with {
+	 int ibit = tree_log2 (@0);
+	 int ibit2 = tree_log2 (@1);
+       }
+  (if (ibit == ibit2
+      && ibit >= 0))))
+
+(match (nop_atomic_bit_test_and_p @0 @0 @4)
+ (bit_and:c
+  (nop_convert?@4
+   (ATOMIC_FETCH_OR_XOR_N @2 (nop_convert? (lshift@0 integer_onep@5 @6)) @3))
+  @0))
+
+(match (nop_atomic_bit_test_and_p @0 @0 @4)
+ (bit_and:c
+  (nop_convert?@4
+   (SYNC_FETCH_OR_XOR_N @2 (nop_convert? (lshift@0 integer_onep@3 @5))))
+  @0))
+
+(match (nop_atomic_bit_test_and_p @0 @1 @3)
+ (bit_and@4 (nop_convert?@3 (ATOMIC_FETCH_AND_N @2 INTEGER_CST@0 @5))
+	    INTEGER_CST@1)
+ (with {
+	 int ibit = wi::exact_log2 (wi::zext (wi::bit_not (wi::to_wide (@0)),
+					      TYPE_PRECISION(type)));
+	 int ibit2 = tree_log2 (@1);
+       }
+  (if (ibit == ibit2
+      && ibit >= 0))))
+
+(match (nop_atomic_bit_test_and_p @0 @1 @3)
+ (bit_and@4
+  (nop_convert?@3 (SYNC_FETCH_AND_AND_N @2 INTEGER_CST@0))
+  INTEGER_CST@1)
+ (with {
+	 int ibit = wi::exact_log2 (wi::zext (wi::bit_not (wi::to_wide (@0)),
+					      TYPE_PRECISION(type)));
+	 int ibit2 = tree_log2 (@1);
+       }
+  (if (ibit == ibit2
+      && ibit >= 0))))
+
+(match (nop_atomic_bit_test_and_p @0 @0 @3)
+ (bit_and:c
+  (nop_convert?@3
+   (ATOMIC_FETCH_AND_N @2 (nop_convert? (bit_not (lshift@0 integer_onep@6 @7))) @5))
+   @0))
+
+(match (nop_atomic_bit_test_and_p @0 @0 @3)
+ (bit_and:c
+  (nop_convert?@3
+   (SYNC_FETCH_AND_AND_N @2 (nop_convert? (bit_not (lshift@0 integer_onep@6 @7)))))
+   @0))
+
+#endif
+
 /* (v ? w : 0) ? a : b is just (v & w) ? a : b
    Currently disabled after pass lvec because ARM understands
    VEC_COND_EXPR<v==w,-1,0> but not a plain v==w fed to BIT_IOR_EXPR.  */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-1.C b/gcc/testsuite/g++.target/i386/pr102566-1.C
new file mode 100644
index 00000000000..94a66d717cc
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-1.C
@@ -0,0 +1,31 @@
+/* { dg-do compile { target c++11 } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+bool
+tbit0 (std::atomic<int> &i)
+{
+#define BIT (1 << 0)
+  return i.fetch_or(BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit30 (std::atomic<int> &i)
+{
+#define BIT (1 << 30)
+  return i.fetch_or(BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit31 (std::atomic<int> &i)
+{
+#define BIT (1 << 31)
+  return i.fetch_or(BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btsl" 3 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-2.C b/gcc/testsuite/g++.target/i386/pr102566-2.C
new file mode 100644
index 00000000000..4f2aea961c2
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-2.C
@@ -0,0 +1,31 @@
+/* { dg-do compile { target c++11 } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+bool
+tbit0 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 0)
+  return i.fetch_or(BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit30 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 30)
+  return i.fetch_or(BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit31 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 31)
+  return i.fetch_or(BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btsl" 3 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-3.C b/gcc/testsuite/g++.target/i386/pr102566-3.C
new file mode 100644
index 00000000000..e88921dd155
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-3.C
@@ -0,0 +1,31 @@
+/* { dg-do compile { target c++11 } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+bool
+tbit0 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 0)
+  return !(i.fetch_or(BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+bool
+tbit30 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 30)
+  return !(i.fetch_or(BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+bool
+tbit31 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 31)
+  return !(i.fetch_or(BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btsl" 3 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-4.C b/gcc/testsuite/g++.target/i386/pr102566-4.C
new file mode 100644
index 00000000000..44d1362ac2e
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-4.C
@@ -0,0 +1,29 @@
+/* { dg-do compile { target c++11 } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+typedef int __attribute__ ((mode (__word__))) int_type;
+
+#define BIT (1 << 0)
+
+bool
+tbit0 (std::atomic<int_type> &i)
+{
+  return i.fetch_or(BIT, std::memory_order_relaxed) & ~1;
+}
+
+bool
+tbit30 (std::atomic<int_type> &i)
+{
+  return i.fetch_or(BIT, std::memory_order_relaxed) & ~2;
+}
+
+bool
+tbit31 (std::atomic<int_type> &i)
+{
+  return i.fetch_or(BIT, std::memory_order_relaxed) & ~4;
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*cmpxchg" 3 } } */
+/* { dg-final { scan-assembler-not "bts" } } */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-5a.C b/gcc/testsuite/g++.target/i386/pr102566-5a.C
new file mode 100644
index 00000000000..f9595bee2ab
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-5a.C
@@ -0,0 +1,31 @@
+/* { dg-do compile { target c++11 } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+bool
+tbit0 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 0)
+  return i.fetch_and(~BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit30 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 30)
+  return i.fetch_and(~BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit31 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 31)
+  return i.fetch_and(~BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btrl" 3 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-5b.C b/gcc/testsuite/g++.target/i386/pr102566-5b.C
new file mode 100644
index 00000000000..d917b27a918
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-5b.C
@@ -0,0 +1,31 @@
+/* { dg-do compile { target { c++11 && { ! ia32 } } } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+bool
+tbit0 (std::atomic<unsigned long long> &i)
+{
+#define BIT (1ll << 0)
+  return i.fetch_and(~BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit30 (std::atomic<unsigned long long> &i)
+{
+#define BIT (1ll << 30)
+  return i.fetch_and(~BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit31 (std::atomic<unsigned long long> &i)
+{
+#define BIT (1ll << 63)
+  return i.fetch_and(~BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btrq" 3 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-6a.C b/gcc/testsuite/g++.target/i386/pr102566-6a.C
new file mode 100644
index 00000000000..01d495eda23
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-6a.C
@@ -0,0 +1,31 @@
+/* { dg-do compile { target c++11 } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+bool
+tbit0 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 0)
+  return !(i.fetch_and(~BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+bool
+tbit30 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 30)
+  return !(i.fetch_and(~BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+bool
+tbit31 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 31)
+  return !(i.fetch_and(~BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btrl" 3 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-6b.C b/gcc/testsuite/g++.target/i386/pr102566-6b.C
new file mode 100644
index 00000000000..adc11fcbf2d
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-6b.C
@@ -0,0 +1,31 @@
+/* { dg-do compile { target { c++11 && { ! ia32 } } } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+bool
+tbit0 (std::atomic<unsigned long long> &i)
+{
+#define BIT (1ll << 0)
+  return !(i.fetch_and(~BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+bool
+tbit30 (std::atomic<unsigned long long> &i)
+{
+#define BIT (1ll << 30)
+  return !(i.fetch_and(~BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+bool
+tbit31 (std::atomic<unsigned long long> &i)
+{
+#define BIT (1ll << 63)
+  return !(i.fetch_and(~BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btrq" 3 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr102566-10a.c b/gcc/testsuite/gcc.target/i386/pr102566-10a.c
new file mode 100644
index 00000000000..1c1f86a9659
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102566-10a.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <stdatomic.h>
+#include <stdbool.h>
+
+bool
+foo (_Atomic int *v, int bit)
+{
+  int mask = 1 << bit;
+  return atomic_fetch_and_explicit (v, ~mask, memory_order_relaxed) & mask;
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btrl" 1 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr102566-10b.c b/gcc/testsuite/gcc.target/i386/pr102566-10b.c
new file mode 100644
index 00000000000..0bf39824ea6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102566-10b.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2" } */
+
+#include <stdatomic.h>
+#include <stdbool.h>
+
+bool
+foo (_Atomic long long int *v, int bit)
+{
+  long long int mask = 1ll << bit;
+  return atomic_fetch_and_explicit (v, ~mask, memory_order_relaxed) & mask;
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btrq" 1 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr102566-11.c b/gcc/testsuite/gcc.target/i386/pr102566-11.c
new file mode 100644
index 00000000000..2c8f8c4e59a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102566-11.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <stdatomic.h>
+#include <stdbool.h>
+
+#define MASK 0x1234
+
+bool
+foo1 (_Atomic int *v)
+{
+  return atomic_fetch_or_explicit (v, MASK, memory_order_relaxed) & MASK;
+}
+
+bool
+foo2 (_Atomic unsigned int *v, int mask)
+{
+  return atomic_fetch_or_explicit (v, mask, memory_order_relaxed) & mask;
+}
+
+bool
+foo3 (_Atomic unsigned int *v, int mask)
+{
+  return !(atomic_fetch_or_explicit (v, mask, memory_order_relaxed) & mask);
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*cmpxchg" 3 } } */
+/* { dg-final { scan-assembler-not "bts" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr102566-12.c b/gcc/testsuite/gcc.target/i386/pr102566-12.c
new file mode 100644
index 00000000000..4603a77612c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102566-12.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <stdatomic.h>
+#include <stdbool.h>
+
+#define MASK 0x1234
+
+bool
+foo1 (_Atomic long *v)
+{
+  return atomic_fetch_and_explicit (v, ~MASK, memory_order_relaxed) & MASK;
+}
+
+bool
+foo2 (_Atomic long *v, long mask)
+{
+  return atomic_fetch_and_explicit (v, ~mask, memory_order_relaxed) & mask;
+}
+
+bool
+foo3 (_Atomic long *v, long mask)
+{
+  return !(atomic_fetch_and_explicit (v, ~mask, memory_order_relaxed) & mask);
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*cmpxchg" 3 } } */
+/* { dg-final { scan-assembler-not "btr" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr102566-13.c b/gcc/testsuite/gcc.target/i386/pr102566-13.c
new file mode 100644
index 00000000000..2657a2f62ae
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102566-13.c
@@ -0,0 +1,66 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+#include <stdatomic.h>
+#include <stdbool.h>
+
+#define FOO(TYPE,MASK)							\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_fetch_or_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __atomic_fetch_or (a, mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_fetch_xor_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __atomic_fetch_xor (a, mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_xor_fetch_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __atomic_xor_fetch (a, mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_fetch_and_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __atomic_fetch_and (a, ~mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_fetch_and_or_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __sync_fetch_and_or (a, mask) & mask;			\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_fetch_and_xor_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __sync_fetch_and_xor (a, mask) & mask;			\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_xor_and_fetch_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __sync_xor_and_fetch (a, mask) & mask;			\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_fetch_and_and_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __sync_fetch_and_and (a, ~mask) & mask;			\
+  }									\
+
+FOO(short, 0);
+FOO(short, 7);
+FOO(short, 15);
+FOO(int, 0);
+FOO(int, 15);
+FOO(int, 31);
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*bts" 12 } } */
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btc" 24 } } */
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btr" 12 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr102566-14.c b/gcc/testsuite/gcc.target/i386/pr102566-14.c
new file mode 100644
index 00000000000..24681c1da18
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102566-14.c
@@ -0,0 +1,65 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2" } */
+#include <stdatomic.h>
+#include <stdbool.h>
+typedef long long int64;
+
+#define FOO(TYPE,MASK)							\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_fetch_or_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __atomic_fetch_or (a, mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_fetch_xor_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __atomic_fetch_xor (a, mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_xor_fetch_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __atomic_xor_fetch (a, mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_fetch_and_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __atomic_fetch_and (a, ~mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_fetch_and_or_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __sync_fetch_and_or (a, mask) & mask;			\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_fetch_and_xor_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __sync_fetch_and_xor (a, mask) & mask;			\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_xor_and_fetch_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __sync_xor_and_fetch (a, mask) & mask;			\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_fetch_and_and_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __sync_fetch_and_and (a, ~mask) & mask;			\
+  }									\
+
+
+FOO(int64, 0);
+FOO(int64, 32);
+FOO(int64, 63);
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*bts" 6 } } */
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btc" 12 } } */
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btr" 6 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr102566-1a.c b/gcc/testsuite/gcc.target/i386/pr102566-1a.c
new file mode 100644
index 00000000000..a915de354e5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102566-1a.c
@@ -0,0 +1,188 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void bar (void);
+
+__attribute__((noinline, noclone)) int
+f1 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  return (__sync_fetch_and_or (a, mask) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f2 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  int t1 = __atomic_fetch_or (a, mask, __ATOMIC_RELAXED);
+  int t2 = t1 & mask;
+  return t2 != 0;
+}
+
+__attribute__((noinline, noclone)) long int
+f3 (long int *a, int bit)
+{
+  long int mask = 1l << bit;
+  return (__atomic_fetch_or (a, mask, __ATOMIC_SEQ_CST) & mask) == 0;
+}
+
+__attribute__((noinline, noclone)) int
+f4 (int *a)
+{
+  int mask = 1 << 7;
+  return (__sync_fetch_and_or (a, mask) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f5 (int *a)
+{
+  int mask = 1 << 13;
+  return (__atomic_fetch_or (a, mask, __ATOMIC_RELAXED) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f6 (int *a)
+{
+  int mask = 1 << 0;
+  return (__atomic_fetch_or (a, mask, __ATOMIC_SEQ_CST) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) void
+f7 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  if ((__sync_fetch_and_xor (a, mask) & mask) != 0)
+    bar ();
+}
+
+__attribute__((noinline, noclone)) void
+f8 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  if ((__atomic_fetch_xor (a, mask, __ATOMIC_RELAXED) & mask) == 0)
+    bar ();
+}
+
+__attribute__((noinline, noclone)) int
+f9 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  return (__atomic_fetch_xor (a, mask, __ATOMIC_SEQ_CST) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f10 (int *a)
+{
+  int mask = 1 << 7;
+  return (__sync_fetch_and_xor (a, mask) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f11 (int *a)
+{
+  int mask = 1 << 13;
+  return (__atomic_fetch_xor (a, mask, __ATOMIC_RELAXED) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f12 (int *a)
+{
+  int mask = 1 << 0;
+  return (__atomic_fetch_xor (a, mask, __ATOMIC_SEQ_CST) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f13 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  return (__sync_fetch_and_and (a, ~mask) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f14 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  return (__atomic_fetch_and (a, ~mask, __ATOMIC_RELAXED) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f15 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  return (__atomic_fetch_and (a, ~mask, __ATOMIC_SEQ_CST) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f16 (int *a)
+{
+  int mask = 1 << 7;
+  return (__sync_fetch_and_and (a, ~mask) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f17 (int *a)
+{
+  int mask = 1 << 13;
+  return (__atomic_fetch_and (a, ~mask, __ATOMIC_RELAXED) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f18 (int *a)
+{
+  int mask = 1 << 0;
+  return (__atomic_fetch_and (a, ~mask, __ATOMIC_SEQ_CST) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) long int
+f19 (long int *a, int bit)
</cut>
>From ci_notify@linaro.org  Wed Nov 10 16:09:02 2021
Return-Path: <ci_notify@linaro.org>
X-Original-To: gcc-regression@gcc.gnu.org
Delivered-To: gcc-regression@gcc.gnu.org
Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com
 [IPv6:2a00:1450:4864:20::32a])
 by sourceware.org (Postfix) with ESMTPS id 0CCA93857C65
 for <gcc-regression@gcc.gnu.org>; Wed, 10 Nov 2021 16:08:57 +0000 (GMT)
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0CCA93857C65
Received: by mail-wm1-x32a.google.com with SMTP id z200so2693644wmc.1
 for <gcc-regression@gcc.gnu.org>; Wed, 10 Nov 2021 08:08:57 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d\x1e100.net; s 210112;
 h=x-gm-message-state:from:date:to:cc:message-id:subject:mime-version;
 bh=XDeFeavAg/o81PPkkMGPNiAWuCll9+s+5pZJ03SP8PE=;
 b=ihjPoQ+06TZAPVhJt9jybl8G+QFtBJEsXWbFQngW5/rTQ6D+kC0uAo7B49AWnBbwzZ
 Dksm9fDA+Scih/TjPF7WBrxt8+FQyw5hQKsOBMy7m28ibahxetd31hbDjVSRz+I4y5yz
 ffHmvthx8JLzPJjIzLTC7X/CksvaGRbSTXohS+XmEdRhZRn5yZ6m5q9Vph8KE48GYfVf
 UKUcSyAdg65G8jUOaNq8nkeGlrgOL3Txebatgg6ZU0q50mUX3mhN0hksxGfNtxC6tNkR
 1shPFMfvUGSkngwmTo8JYUTVDyFJk0ORzOVkblNVujqjv2AxqSD4dg3YQpIlRTyTUBIq
 1jig=X-Gm-Message-State: AOAM5328tORfO8DbZWftxGnuPvOCR1VMkqzBVEC+lS9iip932Lx8mcs2
 aCzmnU0kbVWc+iCNetJNWLI9ww=X-Google-Smtp-Source: ABdhPJz28OHZMZV4octhLyDBmsUOYzrgwL5ilHp0ei7If04kGTKrAbbniNQj74C157GM0izLErCQoA=X-Received: by 2002:a05:600c:3ba5:: with SMTP id
 n37mr17509694wms.168.1636560535752;
 Wed, 10 Nov 2021 08:08:55 -0800 (PST)
Received: from jenkins.jenkins (ci.linaro.org. [88.99.136.175])
 by smtp.gmail.com with ESMTPSA id d6sm284774wrx.60.2021.11.10.08.08.54
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits\x128/128);
 Wed, 10 Nov 2021 08:08:55 -0800 (PST)
From: ci_notify@linaro.org
X-Google-Original-From: linaro-infrastructure-errors@lists.linaro.org
Date: Wed, 10 Nov 2021 16:08:53 +0000 (UTC)
To: liuhongt <hongtao.liu@intel.com>
Cc: gcc-regression@gcc.gnu.org
Message-ID: <129273368.6511.1636560535186@jenkins.jenkins>
Subject: [TCWG CI] Regression caused by gcc: Improve integer bit test on
 __atomic_fetch_[or|and]_* returns
MIME-Version: 1.0
X-Jenkins-Job: TCWG Bisect tcwg_gnu_cross_build/master-aarch64
X-Jenkins-Result: SUCCESS
X-Spam-Status: No, score=-13.6 required=5.0 testsºYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH,
 KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS,
 TXREP autolearn=ham autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
 server2.sourceware.org
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
X-BeenThere: gcc-regression@gcc.gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Gcc-regression mailing list <gcc-regression.gcc.gnu.org>
List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-regression>,
 <mailto:gcc-regression-request@gcc.gnu.org?subject=unsubscribe>
List-Archive: <https://gcc.gnu.org/pipermail/gcc-regression/>
List-Post: <mailto:gcc-regression@gcc.gnu.org>
List-Help: <mailto:gcc-regression-request@gcc.gnu.org?subject=help>
List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-regression>,
 <mailto:gcc-regression-request@gcc.gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 10 Nov 2021 16:09:02 -0000

[TCWG CI] Regression caused by gcc: Improve integer bit test on __atomic_fetch_[or|and]_* returns:
commit fb161782545224f55ba26ba663889c5e6e9a04d1
Author: liuhongt <hongtao.liu@intel.com>

    Improve integer bit test on __atomic_fetch_[or|and]_* returns

Results regressed to
# reset_artifacts:
-10
# true:
0
# build_abe binutils:
1
# build_abe stage1:
2
# build_abe linux:
3
# First few build errors in logs:
# 00:00:51 pthread_cancel.c:60:1: error: type mismatch in binary expression
# 00:00:51 pthread_cancel.c:60:1: internal compiler error: verify_gimple failed
# 00:00:51 make[2]: *** [../o-iterator.mk:9: /home/tcwg-buildslave/workspace/tcwg_gnu_1/abe/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/glibc-glibc.git~master/nptl/pthread_cancel.o] Error 1
# 00:00:52 make[1]: *** [Makefile:483: nptl/subdir_lib] Error 2
# 00:00:52 make: *** [Makefile:9: all] Error 2

from
# reset_artifacts:
-10
# true:
0
# build_abe binutils:
1
# build_abe stage1:
2
# build_abe linux:
3
# build_abe glibc:
4
# build_abe stage2:
5

THIS IS THE END OF INTERESTING STUFF.  BELOW ARE LINKS TO BUILDS, REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT.

This commit has regressed these CI configurations:
 - tcwg_gnu_cross_build/master-aarch64

First_bad build: https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-aarch64/6/artifact/artifacts/build-fb161782545224f55ba26ba663889c5e6e9a04d1/
Last_good build: https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-aarch64/6/artifact/artifacts/build-f15ad1e3f9488a31abf1c122bd186c1a3d2a5dbc/
Baseline build: https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-aarch64/6/artifact/artifacts/build-baseline/
Even more details: https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-aarch64/6/artifact/artifacts/

Reproduce builds:
<cut>
mkdir investigate-gcc-fb161782545224f55ba26ba663889c5e6e9a04d1
cd investigate-gcc-fb161782545224f55ba26ba663889c5e6e9a04d1

# Fetch scripts
git clone https://git.linaro.org/toolchain/jenkins-scripts

# Fetch manifests and test.sh script
mkdir -p artifacts/manifests
curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-aarch64/6/artifact/artifacts/manifests/build-baseline.sh --fail
curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-aarch64/6/artifact/artifacts/manifests/build-parameters.sh --fail
curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-aarch64/6/artifact/artifacts/test.sh --fail
chmod +x artifacts/test.sh

# Reproduce the baseline build (build all pre-requisites)
./jenkins-scripts/tcwg_gnu-build.sh @@ artifacts/manifests/build-baseline.sh

# Save baseline build state (which is then restored in artifacts/test.sh)
mkdir -p ./bisect
rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /gcc/ ./ ./bisect/baseline/

cd gcc

# Reproduce first_bad build
git checkout --detach fb161782545224f55ba26ba663889c5e6e9a04d1
../artifacts/test.sh

# Reproduce last_good build
git checkout --detach f15ad1e3f9488a31abf1c122bd186c1a3d2a5dbc
../artifacts/test.sh

cd ..
</cut>

Full commit (up to 1000 lines):
<cut>
commit fb161782545224f55ba26ba663889c5e6e9a04d1
Author: liuhongt <hongtao.liu@intel.com>
Date:   Mon Oct 25 13:59:51 2021 +0800

    Improve integer bit test on __atomic_fetch_[or|and]_* returns

    commit adedd5c173388ae505470df152b9cb3947339566
    Author: Jakub Jelinek <jakub@redhat.com>
    Date:   Tue May 3 13:37:25 2016 +0200

        re PR target/49244 (__sync or __atomic builtins will not emit 'lock bts/btr/btc')

    optimized bit test on __atomic_fetch_or_* and __atomic_fetch_and_* returns
    with lock bts/btr/btc by turning

      mask_2 = 1 << cnt_1;
      _4 = __atomic_fetch_or_* (ptr_6, mask_2, _3);
      _5 = _4 & mask_2;

    into

      _4 = ATOMIC_BIT_TEST_AND_SET (ptr_6, cnt_1, 0, _3);
      _5 = _4;

    and

      mask_6 = 1 << bit_5(D);
      _1 = ~mask_6;
      _2 = __atomic_fetch_and_4 (v_8(D), _1, 0);
      _3 = _2 & mask_6;
      _4 = _3 != 0;

    into

      mask_6 = 1 << bit_5(D);
      _1 = ~mask_6;
      _11 = .ATOMIC_BIT_TEST_AND_RESET (v_8(D), bit_5(D), 1, 0);
      _4 = _11 != 0;

    But it failed to optimize many equivalent, but slighly different cases:

    1.
      _1 = __atomic_fetch_or_4 (ptr_6, 1, _3);
      _4 = (_Bool) _1;
    2.
      _1 = __atomic_fetch_and_4 (ptr_6, ~1, _3);
      _4 = (_Bool) _1;
    3.
      _1 = __atomic_fetch_or_4 (ptr_6, 1, _3);
      _7 = ~_1;
      _5 = (_Bool) _7;
    4.
      _1 = __atomic_fetch_and_4 (ptr_6, ~1, _3);
      _7 = ~_1;
      _5 = (_Bool) _7;
    5.
      _1 = __atomic_fetch_or_4 (ptr_6, 1, _3);
      _2 = (int) _1;
      _7 = ~_2;
      _5 = (_Bool) _7;
    6.
      _1 = __atomic_fetch_and_4 (ptr_6, ~1, _3);
      _2 = (int) _1;
      _7 = ~_2;
      _5 = (_Bool) _7;
    7.
      _1 = __atomic_fetch_or_4 (ptr_6, 0x80000000, _3);
      _5 = (signed int) _1;
      _4 = _5 < 0;
    8.
      _1 = __atomic_fetch_and_4 (ptr_6, 0x7fffffff, _3);
      _5 = (signed int) _1;
      _4 = _5 < 0;
    9.
      _1 = 1 << bit_4(D);
      mask_5 = (unsigned int) _1;
      _2 = __atomic_fetch_or_4 (v_7(D), mask_5, 0);
      _3 = _2 & mask_5;
    10.
      mask_7 = 1 << bit_6(D);
      _1 = ~mask_7;
      _2 = (unsigned int) _1;
      _3 = __atomic_fetch_and_4 (v_9(D), _2, 0);
      _4 = (int) _3;
      _5 = _4 & mask_7;

    We make

      mask_2 = 1 << cnt_1;
      _4 = __atomic_fetch_or_* (ptr_6, mask_2, _3);
      _5 = _4 & mask_2;

    and

      mask_6 = 1 << bit_5(D);
      _1 = ~mask_6;
      _2 = __atomic_fetch_and_4 (v_8(D), _1, 0);
      _3 = _2 & mask_6;
      _4 = _3 != 0;

    the canonical forms for this optimization and transform cases 1-9 to the
    equivalent canonical form.  For cases 10 and 11, we simply remove the cast
    before __atomic_fetch_or_4/__atomic_fetch_and_4 with

      _1 = 1 << bit_4(D);
      _2 = __atomic_fetch_or_4 (v_7(D), _1, 0);
      _3 = _2 & _1;

    and

      mask_7 = 1 << bit_6(D);
      _1 = ~mask_7;
      _3 = __atomic_fetch_and_4 (v_9(D), _1, 0);
      _6 = _3 & mask_7;
      _5 = (int) _6;

    2021-11-04  H.J. Lu  <hongjiu.lu@intel.com>
                Hongtao Liu  <hongtao.liu@intel.com>
    gcc/

            PR middle-end/102566
            * match.pd (nop_atomic_bit_test_and_p): New match.
            * tree-ssa-ccp.c (convert_atomic_bit_not): New function.
            (gimple_nop_atomic_bit_test_and_p): New prototype.
            (optimize_atomic_bit_test_and): Transform equivalent, but slighly
            different cases to their canonical forms.

    gcc/testsuite/

            PR middle-end/102566
            * g++.target/i386/pr102566-1.C: New test.
            * g++.target/i386/pr102566-2.C: Likewise.
            * g++.target/i386/pr102566-3.C: Likewise.
            * g++.target/i386/pr102566-4.C: Likewise.
            * g++.target/i386/pr102566-5a.C: Likewise.
            * g++.target/i386/pr102566-5b.C: Likewise.
            * g++.target/i386/pr102566-6a.C: Likewise.
            * g++.target/i386/pr102566-6b.C: Likewise.
            * gcc.target/i386/pr102566-1a.c: Likewise.
            * gcc.target/i386/pr102566-1b.c: Likewise.
            * gcc.target/i386/pr102566-2.c: Likewise.
            * gcc.target/i386/pr102566-3a.c: Likewise.
            * gcc.target/i386/pr102566-3b.c: Likewise.
            * gcc.target/i386/pr102566-4.c: Likewise.
            * gcc.target/i386/pr102566-5.c: Likewise.
            * gcc.target/i386/pr102566-6.c: Likewise.
            * gcc.target/i386/pr102566-7.c: Likewise.
            * gcc.target/i386/pr102566-8a.c: Likewise.
            * gcc.target/i386/pr102566-8b.c: Likewise.
            * gcc.target/i386/pr102566-9a.c: Likewise.
            * gcc.target/i386/pr102566-9b.c: Likewise.
            * gcc.target/i386/pr102566-10a.c: Likewise.
            * gcc.target/i386/pr102566-10b.c: Likewise.
            * gcc.target/i386/pr102566-11.c: Likewise.
            * gcc.target/i386/pr102566-12.c: Likewise.
            * gcc.target/i386/pr102566-13.c: New test.
            * gcc.target/i386/pr102566-14.c: New test.
---
 gcc/match.pd                                 | 103 ++++++
 gcc/testsuite/g++.target/i386/pr102566-1.C   |  31 ++
 gcc/testsuite/g++.target/i386/pr102566-2.C   |  31 ++
 gcc/testsuite/g++.target/i386/pr102566-3.C   |  31 ++
 gcc/testsuite/g++.target/i386/pr102566-4.C   |  29 ++
 gcc/testsuite/g++.target/i386/pr102566-5a.C  |  31 ++
 gcc/testsuite/g++.target/i386/pr102566-5b.C  |  31 ++
 gcc/testsuite/g++.target/i386/pr102566-6a.C  |  31 ++
 gcc/testsuite/g++.target/i386/pr102566-6b.C  |  31 ++
 gcc/testsuite/gcc.target/i386/pr102566-10a.c |  15 +
 gcc/testsuite/gcc.target/i386/pr102566-10b.c |  15 +
 gcc/testsuite/gcc.target/i386/pr102566-11.c  |  28 ++
 gcc/testsuite/gcc.target/i386/pr102566-12.c  |  28 ++
 gcc/testsuite/gcc.target/i386/pr102566-13.c  |  66 ++++
 gcc/testsuite/gcc.target/i386/pr102566-14.c  |  65 ++++
 gcc/testsuite/gcc.target/i386/pr102566-1a.c  | 188 +++++++++++
 gcc/testsuite/gcc.target/i386/pr102566-1b.c  | 107 +++++++
 gcc/testsuite/gcc.target/i386/pr102566-2.c   |  32 ++
 gcc/testsuite/gcc.target/i386/pr102566-3a.c  |  15 +
 gcc/testsuite/gcc.target/i386/pr102566-3b.c  |  15 +
 gcc/testsuite/gcc.target/i386/pr102566-4.c   |  15 +
 gcc/testsuite/gcc.target/i386/pr102566-5.c   |  15 +
 gcc/testsuite/gcc.target/i386/pr102566-6.c   |  32 ++
 gcc/testsuite/gcc.target/i386/pr102566-7.c   |  30 ++
 gcc/testsuite/gcc.target/i386/pr102566-8a.c  |  32 ++
 gcc/testsuite/gcc.target/i386/pr102566-8b.c  |  32 ++
 gcc/testsuite/gcc.target/i386/pr102566-9a.c  |  32 ++
 gcc/testsuite/gcc.target/i386/pr102566-9b.c  |  32 ++
 gcc/tree-ssa-ccp.c                           | 456 ++++++++++++++++++++++++---
 29 files changed, 1557 insertions(+), 42 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 7826af1998a..a319aefa808 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -105,6 +105,39 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 (define_operator_list COND_TERNARY
   IFN_COND_FMA IFN_COND_FMS IFN_COND_FNMA IFN_COND_FNMS)

+/* __atomic_fetch_or_*, __atomic_fetch_xor_*, __atomic_xor_fetch_*  */
+(define_operator_list ATOMIC_FETCH_OR_XOR_N
+  BUILT_IN_ATOMIC_FETCH_OR_1 BUILT_IN_ATOMIC_FETCH_OR_2
+  BUILT_IN_ATOMIC_FETCH_OR_4 BUILT_IN_ATOMIC_FETCH_OR_8
+  BUILT_IN_ATOMIC_FETCH_OR_16
+  BUILT_IN_ATOMIC_FETCH_XOR_1 BUILT_IN_ATOMIC_FETCH_XOR_2
+  BUILT_IN_ATOMIC_FETCH_XOR_4 BUILT_IN_ATOMIC_FETCH_XOR_8
+  BUILT_IN_ATOMIC_FETCH_XOR_16
+  BUILT_IN_ATOMIC_XOR_FETCH_1 BUILT_IN_ATOMIC_XOR_FETCH_2
+  BUILT_IN_ATOMIC_XOR_FETCH_4 BUILT_IN_ATOMIC_XOR_FETCH_8
+  BUILT_IN_ATOMIC_XOR_FETCH_16)
+/* __sync_fetch_and_or_*, __sync_fetch_and_xor_*, __sync_xor_and_fetch_*  */
+(define_operator_list SYNC_FETCH_OR_XOR_N
+  BUILT_IN_SYNC_FETCH_AND_OR_1 BUILT_IN_SYNC_FETCH_AND_OR_2
+  BUILT_IN_SYNC_FETCH_AND_OR_4 BUILT_IN_SYNC_FETCH_AND_OR_8
+  BUILT_IN_SYNC_FETCH_AND_OR_16
+  BUILT_IN_SYNC_FETCH_AND_XOR_1 BUILT_IN_SYNC_FETCH_AND_XOR_2
+  BUILT_IN_SYNC_FETCH_AND_XOR_4 BUILT_IN_SYNC_FETCH_AND_XOR_8
+  BUILT_IN_SYNC_FETCH_AND_XOR_16
+  BUILT_IN_SYNC_XOR_AND_FETCH_1 BUILT_IN_SYNC_XOR_AND_FETCH_2
+  BUILT_IN_SYNC_XOR_AND_FETCH_4 BUILT_IN_SYNC_XOR_AND_FETCH_8
+  BUILT_IN_SYNC_XOR_AND_FETCH_16)
+/* __atomic_fetch_and_*.  */
+(define_operator_list ATOMIC_FETCH_AND_N
+  BUILT_IN_ATOMIC_FETCH_AND_1 BUILT_IN_ATOMIC_FETCH_AND_2
+  BUILT_IN_ATOMIC_FETCH_AND_4 BUILT_IN_ATOMIC_FETCH_AND_8
+  BUILT_IN_ATOMIC_FETCH_AND_16)
+/* __sync_fetch_and_and_*.  */
+(define_operator_list SYNC_FETCH_AND_AND_N
+  BUILT_IN_SYNC_FETCH_AND_AND_1 BUILT_IN_SYNC_FETCH_AND_AND_2
+  BUILT_IN_SYNC_FETCH_AND_AND_4 BUILT_IN_SYNC_FETCH_AND_AND_8
+  BUILT_IN_SYNC_FETCH_AND_AND_16)
+
 /* With nop_convert? combine convert? and view_convert? in one pattern
    plus conditionalize on tree_nop_conversion_p conversions.  */
 (match (nop_convert @0)
@@ -3976,6 +4009,76 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
   (vec_cond @0 (op! @3 @1) (op! @3 @2))))
 #endif

+#if GIMPLE
+(match (nop_atomic_bit_test_and_p @0 @1 @4)
+ (bit_and (nop_convert?@4 (ATOMIC_FETCH_OR_XOR_N @2 INTEGER_CST@0 @3))
+	   INTEGER_CST@1)
+ (with {
+	 int ibit = tree_log2 (@0);
+	 int ibit2 = tree_log2 (@1);
+       }
+  (if (ibit == ibit2
+      && ibit >= 0))))
+
+(match (nop_atomic_bit_test_and_p @0 @1 @3)
+ (bit_and (nop_convert?@3 (SYNC_FETCH_OR_XOR_N @2 INTEGER_CST@0))
+	  INTEGER_CST@1)
+ (with {
+	 int ibit = tree_log2 (@0);
+	 int ibit2 = tree_log2 (@1);
+       }
+  (if (ibit == ibit2
+      && ibit >= 0))))
+
+(match (nop_atomic_bit_test_and_p @0 @0 @4)
+ (bit_and:c
+  (nop_convert?@4
+   (ATOMIC_FETCH_OR_XOR_N @2 (nop_convert? (lshift@0 integer_onep@5 @6)) @3))
+  @0))
+
+(match (nop_atomic_bit_test_and_p @0 @0 @4)
+ (bit_and:c
+  (nop_convert?@4
+   (SYNC_FETCH_OR_XOR_N @2 (nop_convert? (lshift@0 integer_onep@3 @5))))
+  @0))
+
+(match (nop_atomic_bit_test_and_p @0 @1 @3)
+ (bit_and@4 (nop_convert?@3 (ATOMIC_FETCH_AND_N @2 INTEGER_CST@0 @5))
+	    INTEGER_CST@1)
+ (with {
+	 int ibit = wi::exact_log2 (wi::zext (wi::bit_not (wi::to_wide (@0)),
+					      TYPE_PRECISION(type)));
+	 int ibit2 = tree_log2 (@1);
+       }
+  (if (ibit == ibit2
+      && ibit >= 0))))
+
+(match (nop_atomic_bit_test_and_p @0 @1 @3)
+ (bit_and@4
+  (nop_convert?@3 (SYNC_FETCH_AND_AND_N @2 INTEGER_CST@0))
+  INTEGER_CST@1)
+ (with {
+	 int ibit = wi::exact_log2 (wi::zext (wi::bit_not (wi::to_wide (@0)),
+					      TYPE_PRECISION(type)));
+	 int ibit2 = tree_log2 (@1);
+       }
+  (if (ibit == ibit2
+      && ibit >= 0))))
+
+(match (nop_atomic_bit_test_and_p @0 @0 @3)
+ (bit_and:c
+  (nop_convert?@3
+   (ATOMIC_FETCH_AND_N @2 (nop_convert? (bit_not (lshift@0 integer_onep@6 @7))) @5))
+   @0))
+
+(match (nop_atomic_bit_test_and_p @0 @0 @3)
+ (bit_and:c
+  (nop_convert?@3
+   (SYNC_FETCH_AND_AND_N @2 (nop_convert? (bit_not (lshift@0 integer_onep@6 @7)))))
+   @0))
+
+#endif
+
 /* (v ? w : 0) ? a : b is just (v & w) ? a : b
    Currently disabled after pass lvec because ARM understands
    VEC_COND_EXPR<v==w,-1,0> but not a plain v==w fed to BIT_IOR_EXPR.  */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-1.C b/gcc/testsuite/g++.target/i386/pr102566-1.C
new file mode 100644
index 00000000000..94a66d717cc
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-1.C
@@ -0,0 +1,31 @@
+/* { dg-do compile { target c++11 } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+bool
+tbit0 (std::atomic<int> &i)
+{
+#define BIT (1 << 0)
+  return i.fetch_or(BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit30 (std::atomic<int> &i)
+{
+#define BIT (1 << 30)
+  return i.fetch_or(BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit31 (std::atomic<int> &i)
+{
+#define BIT (1 << 31)
+  return i.fetch_or(BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btsl" 3 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-2.C b/gcc/testsuite/g++.target/i386/pr102566-2.C
new file mode 100644
index 00000000000..4f2aea961c2
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-2.C
@@ -0,0 +1,31 @@
+/* { dg-do compile { target c++11 } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+bool
+tbit0 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 0)
+  return i.fetch_or(BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit30 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 30)
+  return i.fetch_or(BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit31 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 31)
+  return i.fetch_or(BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btsl" 3 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-3.C b/gcc/testsuite/g++.target/i386/pr102566-3.C
new file mode 100644
index 00000000000..e88921dd155
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-3.C
@@ -0,0 +1,31 @@
+/* { dg-do compile { target c++11 } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+bool
+tbit0 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 0)
+  return !(i.fetch_or(BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+bool
+tbit30 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 30)
+  return !(i.fetch_or(BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+bool
+tbit31 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 31)
+  return !(i.fetch_or(BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btsl" 3 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-4.C b/gcc/testsuite/g++.target/i386/pr102566-4.C
new file mode 100644
index 00000000000..44d1362ac2e
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-4.C
@@ -0,0 +1,29 @@
+/* { dg-do compile { target c++11 } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+typedef int __attribute__ ((mode (__word__))) int_type;
+
+#define BIT (1 << 0)
+
+bool
+tbit0 (std::atomic<int_type> &i)
+{
+  return i.fetch_or(BIT, std::memory_order_relaxed) & ~1;
+}
+
+bool
+tbit30 (std::atomic<int_type> &i)
+{
+  return i.fetch_or(BIT, std::memory_order_relaxed) & ~2;
+}
+
+bool
+tbit31 (std::atomic<int_type> &i)
+{
+  return i.fetch_or(BIT, std::memory_order_relaxed) & ~4;
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*cmpxchg" 3 } } */
+/* { dg-final { scan-assembler-not "bts" } } */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-5a.C b/gcc/testsuite/g++.target/i386/pr102566-5a.C
new file mode 100644
index 00000000000..f9595bee2ab
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-5a.C
@@ -0,0 +1,31 @@
+/* { dg-do compile { target c++11 } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+bool
+tbit0 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 0)
+  return i.fetch_and(~BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit30 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 30)
+  return i.fetch_and(~BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit31 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 31)
+  return i.fetch_and(~BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btrl" 3 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-5b.C b/gcc/testsuite/g++.target/i386/pr102566-5b.C
new file mode 100644
index 00000000000..d917b27a918
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-5b.C
@@ -0,0 +1,31 @@
+/* { dg-do compile { target { c++11 && { ! ia32 } } } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+bool
+tbit0 (std::atomic<unsigned long long> &i)
+{
+#define BIT (1ll << 0)
+  return i.fetch_and(~BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit30 (std::atomic<unsigned long long> &i)
+{
+#define BIT (1ll << 30)
+  return i.fetch_and(~BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+bool
+tbit31 (std::atomic<unsigned long long> &i)
+{
+#define BIT (1ll << 63)
+  return i.fetch_and(~BIT, std::memory_order_relaxed) & BIT;
+#undef BIT
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btrq" 3 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-6a.C b/gcc/testsuite/g++.target/i386/pr102566-6a.C
new file mode 100644
index 00000000000..01d495eda23
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-6a.C
@@ -0,0 +1,31 @@
+/* { dg-do compile { target c++11 } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+bool
+tbit0 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 0)
+  return !(i.fetch_and(~BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+bool
+tbit30 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 30)
+  return !(i.fetch_and(~BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+bool
+tbit31 (std::atomic<unsigned int> &i)
+{
+#define BIT (1 << 31)
+  return !(i.fetch_and(~BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btrl" 3 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/g++.target/i386/pr102566-6b.C b/gcc/testsuite/g++.target/i386/pr102566-6b.C
new file mode 100644
index 00000000000..adc11fcbf2d
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102566-6b.C
@@ -0,0 +1,31 @@
+/* { dg-do compile { target { c++11 && { ! ia32 } } } } */
+/* { dg-options "-O2" } */
+
+#include <atomic>
+
+bool
+tbit0 (std::atomic<unsigned long long> &i)
+{
+#define BIT (1ll << 0)
+  return !(i.fetch_and(~BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+bool
+tbit30 (std::atomic<unsigned long long> &i)
+{
+#define BIT (1ll << 30)
+  return !(i.fetch_and(~BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+bool
+tbit31 (std::atomic<unsigned long long> &i)
+{
+#define BIT (1ll << 63)
+  return !(i.fetch_and(~BIT, std::memory_order_relaxed) & BIT);
+#undef BIT
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btrq" 3 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr102566-10a.c b/gcc/testsuite/gcc.target/i386/pr102566-10a.c
new file mode 100644
index 00000000000..1c1f86a9659
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102566-10a.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <stdatomic.h>
+#include <stdbool.h>
+
+bool
+foo (_Atomic int *v, int bit)
+{
+  int mask = 1 << bit;
+  return atomic_fetch_and_explicit (v, ~mask, memory_order_relaxed) & mask;
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btrl" 1 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr102566-10b.c b/gcc/testsuite/gcc.target/i386/pr102566-10b.c
new file mode 100644
index 00000000000..0bf39824ea6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102566-10b.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2" } */
+
+#include <stdatomic.h>
+#include <stdbool.h>
+
+bool
+foo (_Atomic long long int *v, int bit)
+{
+  long long int mask = 1ll << bit;
+  return atomic_fetch_and_explicit (v, ~mask, memory_order_relaxed) & mask;
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btrq" 1 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr102566-11.c b/gcc/testsuite/gcc.target/i386/pr102566-11.c
new file mode 100644
index 00000000000..2c8f8c4e59a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102566-11.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <stdatomic.h>
+#include <stdbool.h>
+
+#define MASK 0x1234
+
+bool
+foo1 (_Atomic int *v)
+{
+  return atomic_fetch_or_explicit (v, MASK, memory_order_relaxed) & MASK;
+}
+
+bool
+foo2 (_Atomic unsigned int *v, int mask)
+{
+  return atomic_fetch_or_explicit (v, mask, memory_order_relaxed) & mask;
+}
+
+bool
+foo3 (_Atomic unsigned int *v, int mask)
+{
+  return !(atomic_fetch_or_explicit (v, mask, memory_order_relaxed) & mask);
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*cmpxchg" 3 } } */
+/* { dg-final { scan-assembler-not "bts" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr102566-12.c b/gcc/testsuite/gcc.target/i386/pr102566-12.c
new file mode 100644
index 00000000000..4603a77612c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102566-12.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <stdatomic.h>
+#include <stdbool.h>
+
+#define MASK 0x1234
+
+bool
+foo1 (_Atomic long *v)
+{
+  return atomic_fetch_and_explicit (v, ~MASK, memory_order_relaxed) & MASK;
+}
+
+bool
+foo2 (_Atomic long *v, long mask)
+{
+  return atomic_fetch_and_explicit (v, ~mask, memory_order_relaxed) & mask;
+}
+
+bool
+foo3 (_Atomic long *v, long mask)
+{
+  return !(atomic_fetch_and_explicit (v, ~mask, memory_order_relaxed) & mask);
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*cmpxchg" 3 } } */
+/* { dg-final { scan-assembler-not "btr" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr102566-13.c b/gcc/testsuite/gcc.target/i386/pr102566-13.c
new file mode 100644
index 00000000000..2657a2f62ae
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102566-13.c
@@ -0,0 +1,66 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+#include <stdatomic.h>
+#include <stdbool.h>
+
+#define FOO(TYPE,MASK)							\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_fetch_or_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __atomic_fetch_or (a, mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_fetch_xor_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __atomic_fetch_xor (a, mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_xor_fetch_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __atomic_xor_fetch (a, mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_fetch_and_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __atomic_fetch_and (a, ~mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_fetch_and_or_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __sync_fetch_and_or (a, mask) & mask;			\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_fetch_and_xor_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __sync_fetch_and_xor (a, mask) & mask;			\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_xor_and_fetch_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __sync_xor_and_fetch (a, mask) & mask;			\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_fetch_and_and_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1 << MASK;						\
+    return __sync_fetch_and_and (a, ~mask) & mask;			\
+  }									\
+
+FOO(short, 0);
+FOO(short, 7);
+FOO(short, 15);
+FOO(int, 0);
+FOO(int, 15);
+FOO(int, 31);
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*bts" 12 } } */
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btc" 24 } } */
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btr" 12 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr102566-14.c b/gcc/testsuite/gcc.target/i386/pr102566-14.c
new file mode 100644
index 00000000000..24681c1da18
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102566-14.c
@@ -0,0 +1,65 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2" } */
+#include <stdatomic.h>
+#include <stdbool.h>
+typedef long long int64;
+
+#define FOO(TYPE,MASK)							\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_fetch_or_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __atomic_fetch_or (a, mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_fetch_xor_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __atomic_fetch_xor (a, mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_xor_fetch_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __atomic_xor_fetch (a, mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  atomic_fetch_and_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __atomic_fetch_and (a, ~mask, __ATOMIC_RELAXED) & mask;	\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_fetch_and_or_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __sync_fetch_and_or (a, mask) & mask;			\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_fetch_and_xor_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __sync_fetch_and_xor (a, mask) & mask;			\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_xor_and_fetch_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __sync_xor_and_fetch (a, mask) & mask;			\
+  }									\
+  __attribute__((noinline,noclone)) TYPE				\
+  sync_fetch_and_and_##TYPE##_##MASK (_Atomic TYPE* a)			\
+  {									\
+    TYPE mask = 1ll << MASK;						\
+    return __sync_fetch_and_and (a, ~mask) & mask;			\
+  }									\
+
+
+FOO(int64, 0);
+FOO(int64, 32);
+FOO(int64, 63);
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*bts" 6 } } */
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btc" 12 } } */
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btr" 6 } } */
+/* { dg-final { scan-assembler-not "cmpxchg" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr102566-1a.c b/gcc/testsuite/gcc.target/i386/pr102566-1a.c
new file mode 100644
index 00000000000..a915de354e5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102566-1a.c
@@ -0,0 +1,188 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void bar (void);
+
+__attribute__((noinline, noclone)) int
+f1 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  return (__sync_fetch_and_or (a, mask) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f2 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  int t1 = __atomic_fetch_or (a, mask, __ATOMIC_RELAXED);
+  int t2 = t1 & mask;
+  return t2 != 0;
+}
+
+__attribute__((noinline, noclone)) long int
+f3 (long int *a, int bit)
+{
+  long int mask = 1l << bit;
+  return (__atomic_fetch_or (a, mask, __ATOMIC_SEQ_CST) & mask) == 0;
+}
+
+__attribute__((noinline, noclone)) int
+f4 (int *a)
+{
+  int mask = 1 << 7;
+  return (__sync_fetch_and_or (a, mask) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f5 (int *a)
+{
+  int mask = 1 << 13;
+  return (__atomic_fetch_or (a, mask, __ATOMIC_RELAXED) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f6 (int *a)
+{
+  int mask = 1 << 0;
+  return (__atomic_fetch_or (a, mask, __ATOMIC_SEQ_CST) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) void
+f7 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  if ((__sync_fetch_and_xor (a, mask) & mask) != 0)
+    bar ();
+}
+
+__attribute__((noinline, noclone)) void
+f8 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  if ((__atomic_fetch_xor (a, mask, __ATOMIC_RELAXED) & mask) == 0)
+    bar ();
+}
+
+__attribute__((noinline, noclone)) int
+f9 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  return (__atomic_fetch_xor (a, mask, __ATOMIC_SEQ_CST) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f10 (int *a)
+{
+  int mask = 1 << 7;
+  return (__sync_fetch_and_xor (a, mask) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f11 (int *a)
+{
+  int mask = 1 << 13;
+  return (__atomic_fetch_xor (a, mask, __ATOMIC_RELAXED) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f12 (int *a)
+{
+  int mask = 1 << 0;
+  return (__atomic_fetch_xor (a, mask, __ATOMIC_SEQ_CST) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f13 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  return (__sync_fetch_and_and (a, ~mask) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f14 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  return (__atomic_fetch_and (a, ~mask, __ATOMIC_RELAXED) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f15 (int *a, int bit)
+{
+  int mask = 1 << bit;
+  return (__atomic_fetch_and (a, ~mask, __ATOMIC_SEQ_CST) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f16 (int *a)
+{
+  int mask = 1 << 7;
+  return (__sync_fetch_and_and (a, ~mask) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f17 (int *a)
+{
+  int mask = 1 << 13;
+  return (__atomic_fetch_and (a, ~mask, __ATOMIC_RELAXED) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) int
+f18 (int *a)
+{
+  int mask = 1 << 0;
+  return (__atomic_fetch_and (a, ~mask, __ATOMIC_SEQ_CST) & mask) != 0;
+}
+
+__attribute__((noinline, noclone)) long int
+f19 (long int *a, int bit)
</cut>
>From ci_notify@linaro.org  Wed Nov 10 16:20:14 2021
Return-Path: <ci_notify@linaro.org>
X-Original-To: gcc-regression@gcc.gnu.org
Delivered-To: gcc-regression@gcc.gnu.org
Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com
 [IPv6:2a00:1450:4864:20::429])
 by sourceware.org (Postfix) with ESMTPS id 65CF23858407
 for <gcc-regression@gcc.gnu.org>; Wed, 10 Nov 2021 16:20:10 +0000 (GMT)
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 65CF23858407
Received: by mail-wr1-x429.google.com with SMTP id n29so4943453wra.11
 for <gcc-regression@gcc.gnu.org>; Wed, 10 Nov 2021 08:20:10 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d\x1e100.net; s 210112;
 h=x-gm-message-state:from:date:to:cc:message-id:subject:mime-version;
 bh=TgQKmlL7g2b3WvsmeovqG8UuCR93kubVM3LBcI2M6V4=;
 b=p8/rw0gu7KmM7XpKaXLui2fXXIN+/xQk+ERwJPkxJun1RZwdnRpqV+XdA9tQw/jI+R
 uD7Uyw6vRjIHfwfxJIqOIBL7KM3q4v8zJq1tFbkRyLtbo7waY4fEgvCiiKDGnGa6b9bU
 5aN7s3dDtidJUykRY6v72CWwZ772MB34yvtMnvUxEjrQ52bqcYHac1Tzmh+vPW+J8Ehd
 cKgyIl2HS18Lul2C1y6Bj6VVnnN+hkI9bp5R4KIvVw7WIkVAt35pbWUBKG2eHEu6n8/G
 0zcOzJAYj2EKSrYqjb+x23VWvV2sU+2NuJWNLZ5RCBv+BJpLJAPYuFAd6iqDPwtj/rhw
 uCzw=X-Gm-Message-State: AOAM533KkZT+QA2NPegWmU1wxy8dMoNsRi2LSDlX1m4f+hVwWifwzGbx
 lC2kAjYPSS+wdGHbitAVeAitkQ=X-Google-Smtp-Source: ABdhPJyxyVEiK/+hFc63qk0N72pptpPlAI9qcXBlkWnglUsGbbKOPBTyOqFRYLZyqVYNLqS/uVVCdw=X-Received: by 2002:a05:6000:188b:: with SMTP id
 a11mr276518wri.326.1636561208650;
 Wed, 10 Nov 2021 08:20:08 -0800 (PST)
Received: from jenkins.jenkins (ci.linaro.org. [88.99.136.175])
 by smtp.gmail.com with ESMTPSA id f7sm4915411wmg.6.2021.11.10.08.20.07
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits\x128/128);
 Wed, 10 Nov 2021 08:20:08 -0800 (PST)
From: ci_notify@linaro.org
X-Google-Original-From: linaro-infrastructure-errors@lists.linaro.org
Date: Wed, 10 Nov 2021 16:20:06 +0000 (UTC)
To: =?UTF-8?Q?Clément_Chigot?= <clement.chigot@atos.net>
Cc: gcc-regression@gcc.gnu.org
Message-ID: <654665479.6516.1636561208248@jenkins.jenkins>
Subject: [TCWG CI] Regression caused by gdb: PR 28447: implement multiple
 parameters for .file on XCOFF
MIME-Version: 1.0
X-Jenkins-Job: TCWG Bisect tcwg_gnu_native_build/master-aarch64
X-Jenkins-Result: SUCCESS
X-Spam-Status: No, score=-13.6 required=5.0 testsºYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH,
 RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS,
 TXREP autolearn=ham autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
 server2.sourceware.org
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
X-BeenThere: gcc-regression@gcc.gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Gcc-regression mailing list <gcc-regression.gcc.gnu.org>
List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-regression>,
 <mailto:gcc-regression-request@gcc.gnu.org?subject=unsubscribe>
List-Archive: <https://gcc.gnu.org/pipermail/gcc-regression/>
List-Post: <mailto:gcc-regression@gcc.gnu.org>
List-Help: <mailto:gcc-regression-request@gcc.gnu.org?subject=help>
List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-regression>,
 <mailto:gcc-regression-request@gcc.gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 10 Nov 2021 16:20:14 -0000

[TCWG CI] Regression caused by gdb: PR 28447: implement multiple parameters for .file on XCOFF:
commit e86fc4a5bc3747a6b811d93648a2afa4c1c74217
Author: Clément Chigot <clement.chigot@atos.net>

    PR 28447: implement multiple parameters for .file on XCOFF

Results regressed to
# reset_artifacts:
-10
# true:
0
# build_abe binutils:
1
# build_abe gcc:
2
# build_abe linux:
4
# build_abe glibc:
5
# First few build errors in logs:
# 00:01:57 ../../../../../../gdb/gdb/coffread.c:1343:29: error: ‘union internal_auxent::<unnamed struct>::<unnamed>’ has no member named ‘x_zeroes’
# 00:01:57 ../../../../../../gdb/gdb/coffread.c:1345:53: error: ‘union internal_auxent::<unnamed struct>::<unnamed>’ has no member named ‘x_offset’
# 00:01:57 ../../../../../../gdb/gdb/coffread.c:1347:57: error: ‘union internal_auxent::<unnamed struct>::<unnamed>’ has no member named ‘x_offset’
# 00:01:57 ../../../../../../gdb/gdb/coffread.c:1351:42: error: ‘struct internal_auxent::<unnamed>’ has no member named ‘x_fname’
# 00:01:57 make[1]: *** [Makefile:1655: coffread.o] Error 1
# 00:01:57 make: *** [Makefile:10770: all-gdb] Error 2

from
# reset_artifacts:
-10
# true:
0
# build_abe binutils:
1
# build_abe gcc:
2
# build_abe linux:
4
# build_abe glibc:
5
# build_abe gdb:
6

THIS IS THE END OF INTERESTING STUFF.  BELOW ARE LINKS TO BUILDS, REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT.

This commit has regressed these CI configurations:
 - tcwg_gnu_native_build/master-aarch64

First_bad build: https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-aarch64/6/artifact/artifacts/build-e86fc4a5bc3747a6b811d93648a2afa4c1c74217/
Last_good build: https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-aarch64/6/artifact/artifacts/build-f493b71179ab70d5e278234cb763eede55d44e61/
Baseline build: https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-aarch64/6/artifact/artifacts/build-baseline/
Even more details: https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-aarch64/6/artifact/artifacts/

Reproduce builds:
<cut>
mkdir investigate-gdb-e86fc4a5bc3747a6b811d93648a2afa4c1c74217
cd investigate-gdb-e86fc4a5bc3747a6b811d93648a2afa4c1c74217

# Fetch scripts
git clone https://git.linaro.org/toolchain/jenkins-scripts

# Fetch manifests and test.sh script
mkdir -p artifacts/manifests
curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-aarch64/6/artifact/artifacts/manifests/build-baseline.sh --fail
curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-aarch64/6/artifact/artifacts/manifests/build-parameters.sh --fail
curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-aarch64/6/artifact/artifacts/test.sh --fail
chmod +x artifacts/test.sh

# Reproduce the baseline build (build all pre-requisites)
./jenkins-scripts/tcwg_gnu-build.sh @@ artifacts/manifests/build-baseline.sh

# Save baseline build state (which is then restored in artifacts/test.sh)
mkdir -p ./bisect
rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /gdb/ ./ ./bisect/baseline/

cd gdb

# Reproduce first_bad build
git checkout --detach e86fc4a5bc3747a6b811d93648a2afa4c1c74217
../artifacts/test.sh

# Reproduce last_good build
git checkout --detach f493b71179ab70d5e278234cb763eede55d44e61
../artifacts/test.sh

cd ..
</cut>

Full commit (up to 1000 lines):
<cut>
commit e86fc4a5bc3747a6b811d93648a2afa4c1c74217
Author: Clément Chigot <clement.chigot@atos.net>
Date:   Fri Oct 15 16:12:39 2021 +0200

    PR 28447: implement multiple parameters for .file on XCOFF
    
    On XCOFF, ".file" pseudo-op allows 3 extras parameters to provide
    additional information to AIX linker, or its debugger. These are
    stored in auxiliary entries of the C_FILE symbol.
    
    bfd/
            PR 28447
            * coffcode.h (combined_entry_type): Add extrap field.
            (coff_bigobj_swap_aux_in): Adjust names of x_file fields.
            (coff_bigobj_swap_aux_out): Likewise.
            * coffgen.c (coff_write_auxent_fname): New function.
            (coff_fix_symbol_name): Write x_file using
             coff_write_auxent_fname.
            (coff_write_symbol): Likewise.
            (coff_write_symbols): Add C_FILE auxiliary entries to
            string table if needed.
            (coff_get_normalized_symtab): Adjust names of x_file fields.
            Normalize C_FILE auxiliary entries.
            (coff_print_symbol): Print C_FILE auxiliary entries.
            * coff-rs6000.c (_bfd_xcoff_swap_aux_in): Adjust names of
            x_file fields.
            (_bfd_xcoff_swap_aux_out): Likewise.
            * coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Likewise.
            (_bfd_xcoff64_swap_aux_out): Likewise.
            * cofflink.c (_bfd_coff_final_link): Likewise.
            (_bfd_coff_link_input_bfd): Likewise.
            * coffswap.h (coff_swap_aux_in): Likewise.
            * peXXigen.c (_bfd_XXi_swap_aux_in): Likewise.
            (_bfd_XXi_swap_aux_out): Likewise.
            * xcofflink.c (xcoff_link_input_bfd): Likewise.
            * libcoff.h: Regenerate.
    gas/
            * config/tc-ppc.c (ppc_file): New function.
            * config/tc-ppc.h (OBJ_COFF_MAX_AUXENTRIES): Change to 4.
            * testsuite/gas/ppc/aix.exp: Add tests.
            * testsuite/gas/ppc/xcoff-file-32.d: New test.
            * testsuite/gas/ppc/xcoff-file-64.d: New test.
            * testsuite/gas/ppc/xcoff-file.s: New test.
    include/
            * coff/internal.h (union internal_auxent): Change x_file to be a
              struct instead of a union. Add x_ftype field.
            * coff/rs6000.h (union external_auxent): Add x_resv field.
            * coff/xcoff.h (XFT_FN): New define.
            (XFT_CT): Likewise.
            (XFT_CV): Likewise.
            (XFT_CD): Likewise.
---
 bfd/coff-rs6000.c                     |  14 ++--
 bfd/coff64-rs6000.c                   |  14 ++--
 bfd/coffcode.h                        |  10 ++-
 bfd/coffgen.c                         | 134 ++++++++++++++++++++++++++--------
 bfd/cofflink.c                        |  14 ++--
 bfd/coffswap.h                        |  14 ++--
 bfd/libcoff.h                         |   4 +
 bfd/peXXigen.c                        |  12 +--
 bfd/xcofflink.c                       |  12 +--
 gas/config/tc-ppc.c                   |  63 ++++++++++++++++
 gas/config/tc-ppc.h                   |   2 +-
 gas/testsuite/gas/ppc/aix.exp         |   3 +
 gas/testsuite/gas/ppc/xcoff-file-32.d |  13 ++++
 gas/testsuite/gas/ppc/xcoff-file-64.d |  13 ++++
 gas/testsuite/gas/ppc/xcoff-file.s    |   1 +
 include/coff/internal.h               |  25 ++++---
 include/coff/rs6000.h                 |   1 +
 include/coff/xcoff.h                  |   6 ++
 18 files changed, 273 insertions(+), 82 deletions(-)

diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 31d91190103..1cc2162e7d8 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -489,12 +489,13 @@ _bfd_xcoff_swap_aux_in (bfd *abfd, void * ext1, int type ATTRIBUTE_UNUSED,
     case C_FILE:
       if (ext->x_file.x_n.x_fname[0] == 0)
 	{
-	  in->x_file.x_n.x_zeroes = 0;
-	  in->x_file.x_n.x_offset =
+	  in->x_file.x_n.x_n.x_zeroes = 0;
+	  in->x_file.x_n.x_n.x_offset =
 	    H_GET_32 (abfd, ext->x_file.x_n.x_n.x_offset);
 	}
       else
-	memcpy (in->x_file.x_fname, ext->x_file.x_n.x_fname, FILNMLEN);
+	memcpy (in->x_file.x_n.x_fname, ext->x_file.x_n.x_fname, FILNMLEN);
+      in->x_file.x_ftype = H_GET_8 (abfd, ext->x_file.x_ftype);
       break;
 
       /* RS/6000 "csect" auxents.
@@ -573,14 +574,15 @@ _bfd_xcoff_swap_aux_out (bfd *abfd, void * inp, int type ATTRIBUTE_UNUSED,
       break;
 
     case C_FILE:
-      if (in->x_file.x_fname[0] == 0)
+      if (in->x_file.x_n.x_fname[0] == 0)
 	{
 	  H_PUT_32 (abfd, 0, ext->x_file.x_n.x_n.x_zeroes);
-	  H_PUT_32 (abfd, in->x_file.x_n.x_offset,
+	  H_PUT_32 (abfd, in->x_file.x_n.x_n.x_offset,
 		    ext->x_file.x_n.x_n.x_offset);
 	}
       else
-	memcpy (ext->x_file.x_n.x_fname, in->x_file.x_fname, FILNMLEN);
+	memcpy (ext->x_file.x_n.x_fname, in->x_file.x_n.x_fname, FILNMLEN);
+      H_PUT_8 (abfd, in->x_file.x_ftype, ext->x_file.x_ftype);
       break;
 
       /* RS/6000 "csect" auxents */
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index 8c206959fd3..95a31b606c8 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -386,12 +386,13 @@ _bfd_xcoff64_swap_aux_in (bfd *abfd, void *ext1, int type ATTRIBUTE_UNUSED,
 
       if (ext->x_file.x_n.x_n.x_zeroes[0] == 0)
 	{
-	  in->x_file.x_n.x_zeroes = 0;
-	  in->x_file.x_n.x_offset =
+	  in->x_file.x_n.x_n.x_zeroes = 0;
+	  in->x_file.x_n.x_n.x_offset =
 	    H_GET_32 (abfd, ext->x_file.x_n.x_n.x_offset);
 	}
       else
-	memcpy (in->x_file.x_fname, ext->x_file.x_n.x_fname, FILNMLEN);
+	memcpy (in->x_file.x_n.x_fname, ext->x_file.x_n.x_fname, FILNMLEN);
+      in->x_file.x_ftype = H_GET_8 (abfd, ext->x_file.x_ftype);
       break;
 
       /* RS/6000 "csect" auxents.
@@ -499,14 +500,15 @@ _bfd_xcoff64_swap_aux_out (bfd *abfd, void *inp, int type ATTRIBUTE_UNUSED,
       break;
 
     case C_FILE:
-      if (in->x_file.x_n.x_zeroes == 0)
+      if (in->x_file.x_n.x_n.x_zeroes == 0)
 	{
 	  H_PUT_32 (abfd, 0, ext->x_file.x_n.x_n.x_zeroes);
-	  H_PUT_32 (abfd, in->x_file.x_n.x_offset,
+	  H_PUT_32 (abfd, in->x_file.x_n.x_n.x_offset,
 		    ext->x_file.x_n.x_n.x_offset);
 	}
       else
-	memcpy (ext->x_file.x_n.x_fname, in->x_file.x_fname, FILNMLEN);
+	memcpy (ext->x_file.x_n.x_fname, in->x_file.x_n.x_fname, FILNMLEN);
+      H_PUT_8 (abfd, in->x_file.x_ftype, ext->x_file.x_ftype);
       H_PUT_8 (abfd, _AUX_FILE, ext->x_file.x_auxtype);
       break;
 
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 7967cedf918..f0b73a98881 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -326,6 +326,10 @@ CODE_FRAGMENT
 .
 . {* Selector for the union above.  *}
 . bool is_sym;
+.
+. {* An extra pointer which can used by format based on COFF (like XCOFF)
+.    to provide extra information to their backend.  *}
+. void *extrap;
 .} combined_entry_type;
 .
 .
@@ -5663,11 +5667,11 @@ coff_bigobj_swap_aux_in (bfd *abfd,
       if (numaux > 1)
 	{
 	  if (indx == 0)
-	    memcpy (in->x_file.x_fname, ext->File.Name,
+	    memcpy (in->x_file.x_n.x_fname, ext->File.Name,
 		    numaux * sizeof (AUXENT_BIGOBJ));
 	}
       else
-	memcpy (in->x_file.x_fname, ext->File.Name, sizeof (ext->File.Name));
+	memcpy (in->x_file.x_n.x_fname, ext->File.Name, sizeof (ext->File.Name));
       break;
 
     case C_STAT:
@@ -5712,7 +5716,7 @@ coff_bigobj_swap_aux_out (bfd * abfd,
   switch (in_class)
     {
     case C_FILE:
-      memcpy (ext->File.Name, in->x_file.x_fname, sizeof (ext->File.Name));
+      memcpy (ext->File.Name, in->x_file.x_n.x_fname, sizeof (ext->File.Name));
 
       return AUXESZ;
 
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 6627a9af4b6..40f1ac718e4 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -847,6 +847,34 @@ coff_mangle_symbols (bfd *bfd_ptr)
     }
 }
 
+static void
+coff_write_auxent_fname (bfd *abfd,
+			 char *str,
+			 union internal_auxent *auxent,
+			 bfd_size_type *string_size_p)
+{
+  unsigned int str_length = strlen (str);
+  unsigned int filnmlen = bfd_coff_filnmlen (abfd);
+
+  if (bfd_coff_long_filenames (abfd))
+    {
+      if (str_length <= filnmlen)
+	strncpy (auxent->x_file.x_n.x_fname, str, filnmlen);
+      else
+	{
+	  auxent->x_file.x_n.x_n.x_offset = *string_size_p + STRING_SIZE_SIZE;
+	  auxent->x_file.x_n.x_n.x_zeroes = 0;
+	  *string_size_p += str_length + 1;
+	}
+    }
+  else
+    {
+      strncpy (auxent->x_file.x_n.x_fname, str, filnmlen);
+      if (str_length > filnmlen)
+	str[filnmlen] = '\0';
+    }
+}
+
 static void
 coff_fix_symbol_name (bfd *abfd,
 		      asymbol *symbol,
@@ -856,7 +884,6 @@ coff_fix_symbol_name (bfd *abfd,
 		      bfd_size_type *debug_string_size_p)
 {
   unsigned int name_length;
-  union internal_auxent *auxent;
   char *name = (char *) (symbol->name);
 
   if (name == NULL)
@@ -871,8 +898,6 @@ coff_fix_symbol_name (bfd *abfd,
   if (native->u.syment.n_sclass == C_FILE
       && native->u.syment.n_numaux > 0)
     {
-      unsigned int filnmlen;
-
       if (bfd_coff_force_symnames_in_strings (abfd))
 	{
 	  native->u.syment._n._n_n._n_offset =
@@ -884,27 +909,8 @@ coff_fix_symbol_name (bfd *abfd,
 	strncpy (native->u.syment._n._n_name, ".file", SYMNMLEN);
 
       BFD_ASSERT (! (native + 1)->is_sym);
-      auxent = &(native + 1)->u.auxent;
-
-      filnmlen = bfd_coff_filnmlen (abfd);
-
-      if (bfd_coff_long_filenames (abfd))
-	{
-	  if (name_length <= filnmlen)
-	    strncpy (auxent->x_file.x_fname, name, filnmlen);
-	  else
-	    {
-	      auxent->x_file.x_n.x_offset = *string_size_p + STRING_SIZE_SIZE;
-	      auxent->x_file.x_n.x_zeroes = 0;
-	      *string_size_p += name_length + 1;
-	    }
-	}
-      else
-	{
-	  strncpy (auxent->x_file.x_fname, name, filnmlen);
-	  if (name_length > filnmlen)
-	    name[filnmlen] = '\0';
-	}
+      coff_write_auxent_fname (abfd, name, &(native + 1)->u.auxent,
+			       string_size_p);
     }
   else
     {
@@ -1029,6 +1035,11 @@ coff_write_symbol (bfd *abfd,
       for (j = 0; j < native->u.syment.n_numaux; j++)
 	{
 	  BFD_ASSERT (! (native + j + 1)->is_sym);
+
+	  if (native->u.syment.n_sclass == C_FILE && j > 0)
+	    coff_write_auxent_fname (abfd, (char *) (native + j + 1)->extrap,
+				     &(native + j + 1)->u.auxent, string_size_p);
+
 	  bfd_coff_swap_aux_out (abfd,
 				 &((native + j + 1)->u.auxent),
 				 type, n_sclass, (int) j,
@@ -1358,6 +1369,7 @@ coff_write_symbols (bfd *abfd)
 	  size_t name_length = strlen (q->name);
 	  coff_symbol_type *c_symbol = coff_symbol_from (q);
 	  size_t maxlen;
+	  bool is_c_file = false;
 
 	  /* Figure out whether the symbol name should go in the string
 	     table.  Symbol names that are short enough are stored
@@ -1384,6 +1396,7 @@ coff_write_symbols (bfd *abfd)
 	  else if (c_symbol->native->u.syment.n_sclass == C_FILE
 		   && c_symbol->native->u.syment.n_numaux > 0)
 	    {
+	      is_c_file=true;
 	      if (bfd_coff_force_symnames_in_strings (abfd))
 		{
 		  if (bfd_bwrite (".file", (bfd_size_type) 6, abfd) != 6)
@@ -1400,6 +1413,30 @@ coff_write_symbols (bfd *abfd)
 			     abfd) != name_length + 1)
 		return false;
 	    }
+
+	  /* Add strings for C_FILE aux entries. */
+	  if (is_c_file
+	      && c_symbol->native->u.syment.n_numaux > 1)
+	    {
+	      for (int j = 1; j < c_symbol->native->u.syment.n_numaux; j++)
+		{
+		  char *str;
+		  size_t str_length;
+
+		  if (c_symbol->native[j + 1].u.auxent.x_file.x_n.x_fname[0] != 0)
+		    continue;
+
+		  str = (char *) c_symbol->native[j + 1].extrap;
+		  str_length = strlen (str);
+		  if (str_length > maxlen)
+		    {
+		      if (bfd_bwrite ((void *) (str), (bfd_size_type) str_length + 1,
+				      abfd) != str_length + 1)
+			return false;
+		    }
+
+		}
+	    }
 	}
     }
   else
@@ -1872,7 +1909,7 @@ coff_get_normalized_symtab (bfd *abfd)
 	     the text ".file" is redundant.  */
 	  BFD_ASSERT (! aux->is_sym);
 
-	  if (aux->u.auxent.x_file.x_n.x_zeroes == 0)
+	  if (aux->u.auxent.x_file.x_n.x_n.x_zeroes == 0)
 	    {
 	      /* The filename is a long one, point into the string table.  */
 	      if (string_table == NULL)
@@ -1882,12 +1919,12 @@ coff_get_normalized_symtab (bfd *abfd)
 		    return NULL;
 		}
 
-	      if ((bfd_size_type)(aux->u.auxent.x_file.x_n.x_offset)
+	      if ((bfd_size_type)(aux->u.auxent.x_file.x_n.x_n.x_offset)
 		  >= obj_coff_strings_len (abfd))
 		internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) _("<corrupt>");
 	      else
 		internal_ptr->u.syment._n._n_n._n_offset =
-		  (bfd_hostptr_t) (string_table + (aux->u.auxent.x_file.x_n.x_offset));
+		  (bfd_hostptr_t) (string_table + (aux->u.auxent.x_file.x_n.x_n.x_offset));
 	    }
 	  else
 	    {
@@ -1899,15 +1936,48 @@ coff_get_normalized_symtab (bfd *abfd)
 		internal_ptr->u.syment._n._n_n._n_offset =
 		  (bfd_hostptr_t)
 		  copy_name (abfd,
-			     aux->u.auxent.x_file.x_fname,
+			     aux->u.auxent.x_file.x_n.x_fname,
 			     internal_ptr->u.syment.n_numaux * symesz);
 	      else
 		internal_ptr->u.syment._n._n_n._n_offset =
 		  ((bfd_hostptr_t)
 		   copy_name (abfd,
-			      aux->u.auxent.x_file.x_fname,
+			      aux->u.auxent.x_file.x_n.x_fname,
 			      (size_t) bfd_coff_filnmlen (abfd)));
 	    }
+
+	  /* Normalize other strings available in C_FILE aux entries.  */
+	  if (!coff_data (abfd)->pe)
+	    for (int numaux = 1; numaux < internal_ptr->u.syment.n_numaux; numaux++)
+	      {
+		aux = internal_ptr + numaux + 1;
+		BFD_ASSERT (! aux->is_sym);
+
+		if (aux->u.auxent.x_file.x_n.x_n.x_zeroes == 0)
+		  {
+		    /* The string information is a long one, point into the string table.  */
+		    if (string_table == NULL)
+		      {
+			string_table = _bfd_coff_read_string_table (abfd);
+			if (string_table == NULL)
+			  return NULL;
+		      }
+
+		    if ((bfd_size_type)(aux->u.auxent.x_file.x_n.x_n.x_offset)
+			>= obj_coff_strings_len (abfd))
+		      aux->u.auxent.x_file.x_n.x_n.x_offset = (bfd_hostptr_t) _("<corrupt>");
+		    else
+		      aux->u.auxent.x_file.x_n.x_n.x_offset =
+			(bfd_hostptr_t) (string_table + (aux->u.auxent.x_file.x_n.x_n.x_offset));
+		  }
+		else
+		  aux->u.auxent.x_file.x_n.x_n.x_offset =
+		    ((bfd_hostptr_t)
+		     copy_name (abfd,
+				aux->u.auxent.x_file.x_n.x_fname,
+				(size_t) bfd_coff_filnmlen (abfd)));
+	      }
+
 	}
       else
 	{
@@ -2135,6 +2205,12 @@ coff_print_symbol (bfd *abfd,
 		{
 		case C_FILE:
 		  fprintf (file, "File ");
+		  /* Add additional information if this isn't the filename
+		     auxiliary entry.  */
+		  if (aux)
+		    fprintf (file, "ftype %d fname \"%s\"",
+			     auxp->u.auxent.x_file.x_ftype,
+			     (char *) auxp->u.auxent.x_file.x_n.x_n.x_offset);
 		  break;
 
 		case C_DWARF:
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index b8a370933be..67d9c62b0b4 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -963,7 +963,7 @@ _bfd_coff_final_link (bfd *abfd,
 		  else
 		    {
 		      BFD_ASSERT (isym.n_numaux == 1);
-		      iaux.x_file.x_n.x_offset = STRING_SIZE_SIZE + indx;
+		      iaux.x_file.x_n.x_n.x_offset = STRING_SIZE_SIZE + indx;
 		      bfd_coff_swap_aux_out (abfd, &iaux, isym.n_type, C_FILE,
 					     0, 1, flaginfo.outsyms + symesz);
 		      if (bfd_seek (abfd, pos + symesz, SEEK_SET) != 0
@@ -2006,13 +2006,13 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
 		{
 		  /* If this is a long filename, we must put it in the
 		     string table.  */
-		  if (auxp->x_file.x_n.x_zeroes == 0
-		      && auxp->x_file.x_n.x_offset != 0)
+		  if (auxp->x_file.x_n.x_n.x_zeroes == 0
+		      && auxp->x_file.x_n.x_n.x_offset != 0)
 		    {
 		      const char *filename;
 		      bfd_size_type indx;
 
-		      BFD_ASSERT (auxp->x_file.x_n.x_offset
+		      BFD_ASSERT (auxp->x_file.x_n.x_n.x_offset
 				  >= STRING_SIZE_SIZE);
 		      if (strings == NULL)
 			{
@@ -2020,15 +2020,15 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
 			  if (strings == NULL)
 			    return false;
 			}
-		      if ((bfd_size_type) auxp->x_file.x_n.x_offset >= obj_coff_strings_len (input_bfd))
+		      if ((bfd_size_type) auxp->x_file.x_n.x_n.x_offset >= obj_coff_strings_len (input_bfd))
 			filename = _("<corrupt>");
 		      else
-			filename = strings + auxp->x_file.x_n.x_offset;
+			filename = strings + auxp->x_file.x_n.x_n.x_offset;
 		      indx = _bfd_stringtab_add (flaginfo->strtab, filename,
 						 hash, copy);
 		      if (indx == (bfd_size_type) -1)
 			return false;
-		      auxp->x_file.x_n.x_offset = STRING_SIZE_SIZE + indx;
+		      auxp->x_file.x_n.x_n.x_offset = STRING_SIZE_SIZE + indx;
 		    }
 		}
 	      else if ((isymp->n_sclass != C_STAT || isymp->n_type != T_NULL)
diff --git a/bfd/coffswap.h b/bfd/coffswap.h
index e0dbd04f399..a8bd932daf7 100644
--- a/bfd/coffswap.h
+++ b/bfd/coffswap.h
@@ -418,8 +418,8 @@ coff_swap_aux_in (bfd *abfd,
     case C_FILE:
       if (ext->x_file.x_fname[0] == 0)
 	{
-	  in->x_file.x_n.x_zeroes = 0;
-	  in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
+	  in->x_file.x_n.x_n.x_zeroes = 0;
+	  in->x_file.x_n.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
 	}
       else
 	{
@@ -429,11 +429,11 @@ coff_swap_aux_in (bfd *abfd,
 	  if (numaux > 1 && coff_data (abfd)->pe)
 	    {
 	      if (indx == 0)
-		memcpy (in->x_file.x_fname, ext->x_file.x_fname,
+		memcpy (in->x_file.x_n.x_fname, ext->x_file.x_fname,
 			numaux * sizeof (AUXENT));
 	    }
 	  else
-	    memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
+	    memcpy (in->x_file.x_n.x_fname, ext->x_file.x_fname, FILNMLEN);
 #endif
 	}
       goto end;
@@ -522,17 +522,17 @@ coff_swap_aux_out (bfd * abfd,
   switch (in_class)
     {
     case C_FILE:
-      if (in->x_file.x_fname[0] == 0)
+      if (in->x_file.x_n.x_fname[0] == 0)
 	{
 	  H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes);
-	  H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
+	  H_PUT_32 (abfd, in->x_file.x_n.x_n.x_offset, ext->x_file.x_n.x_offset);
 	}
       else
 	{
 #if FILNMLEN != E_FILNMLEN
 #error we need to cope with truncating or extending FILNMLEN
 #else
-	  memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
+	  memcpy (ext->x_file.x_fname, in->x_file.x_n.x_fname, FILNMLEN);
 #endif
 	}
       goto end;
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index 6dc68d1a398..1b4f988bb0b 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -658,6 +658,10 @@ typedef struct coff_ptr_struct
 
  /* Selector for the union above.  */
  bool is_sym;
+
+ /* An extra pointer which can used by format based on COFF (like XCOFF)
+    to provide extra information to their backend.  */
+ void *extrap;
 } combined_entry_type;
 
 
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index c41c3299277..e2a9cbb65c1 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -298,11 +298,11 @@ _bfd_XXi_swap_aux_in (bfd *	abfd,
     case C_FILE:
       if (ext->x_file.x_fname[0] == 0)
 	{
-	  in->x_file.x_n.x_zeroes = 0;
-	  in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
+	  in->x_file.x_n.x_n.x_zeroes = 0;
+	  in->x_file.x_n.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
 	}
       else
-	memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
+	memcpy (in->x_file.x_n.x_fname, ext->x_file.x_fname, FILNMLEN);
       return;
 
     case C_STAT:
@@ -370,13 +370,13 @@ _bfd_XXi_swap_aux_out (bfd *  abfd,
   switch (in_class)
     {
     case C_FILE:
-      if (in->x_file.x_fname[0] == 0)
+      if (in->x_file.x_n.x_fname[0] == 0)
 	{
 	  H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes);
-	  H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
+	  H_PUT_32 (abfd, in->x_file.x_n.x_n.x_offset, ext->x_file.x_n.x_offset);
 	}
       else
-	memcpy (ext->x_file.x_fname, in->x_file.x_fname, sizeof (ext->x_file.x_fname));
+	memcpy (ext->x_file.x_fname, in->x_file.x_n.x_fname, sizeof (ext->x_file.x_fname));
 
       return AUXESZ;
 
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index 3ca74ce0277..e87ed0e683b 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -4550,13 +4550,13 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo,
 		  /* This is the file name (or some comment put in by
 		     the compiler).  If it is long, we must put it in
 		     the string table.  */
-		  if (aux.x_file.x_n.x_zeroes == 0
-		      && aux.x_file.x_n.x_offset != 0)
+		  if (aux.x_file.x_n.x_n.x_zeroes == 0
+		      && aux.x_file.x_n.x_n.x_offset != 0)
 		    {
 		      const char *filename;
 		      bfd_size_type indx;
 
-		      BFD_ASSERT (aux.x_file.x_n.x_offset
+		      BFD_ASSERT (aux.x_file.x_n.x_n.x_offset
 				  >= STRING_SIZE_SIZE);
 		      if (strings == NULL)
 			{
@@ -4564,15 +4564,15 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo,
 			  if (strings == NULL)
 			    return false;
 			}
-		      if ((bfd_size_type) aux.x_file.x_n.x_offset >= obj_coff_strings_len (input_bfd))
+		      if ((bfd_size_type) aux.x_file.x_n.x_n.x_offset >= obj_coff_strings_len (input_bfd))
 			filename = _("<corrupt>");
 		      else
-			filename = strings + aux.x_file.x_n.x_offset;
+			filename = strings + aux.x_file.x_n.x_n.x_offset;
 		      indx = _bfd_stringtab_add (flinfo->strtab, filename,
 						 hash, copy);
 		      if (indx == (bfd_size_type) -1)
 			return false;
-		      aux.x_file.x_n.x_offset = STRING_SIZE_SIZE + indx;
+		      aux.x_file.x_n.x_n.x_offset = STRING_SIZE_SIZE + indx;
 		    }
 		}
 	      else if (CSECT_SYM_P (isymp->n_sclass)
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index af025af32ff..8750e379158 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -107,6 +107,7 @@ static void ppc_es (int);
 static void ppc_csect (int);
 static void ppc_dwsect (int);
 static void ppc_change_csect (symbolS *, offsetT);
+static void ppc_file (int);
 static void ppc_function (int);
 static void ppc_extern (int);
 static void ppc_lglobl (int);
@@ -227,6 +228,7 @@ const pseudo_typeS md_pseudo_table[] =
   { "ei",	ppc_biei,	1 },
   { "es",	ppc_es,		0 },
   { "extern",	ppc_extern,	0 },
+  { "file",	ppc_file,	0 },
   { "function",	ppc_function,	0 },
   { "lglobl",	ppc_lglobl,	0 },
   { "ref",	ppc_ref,	0 },
@@ -5073,6 +5075,67 @@ ppc_stabx (int ignore ATTRIBUTE_UNUSED)
   demand_empty_rest_of_line ();
 }
 
+/* The .file pseudo-op. On XCOFF, .file can have several parameters
+   which are being added to the symbol table to provide additional
+   information.  */
+
+static void
+ppc_file (int ignore ATTRIBUTE_UNUSED)
+{
+  char *sfname, *s1 = NULL, *s2 = NULL, *s3 = NULL;
+  int length, auxnb = 1;
+
+  /* Some assemblers tolerate immediately following '"'.  */
+  if ((sfname = demand_copy_string (&length)) != 0)
+    {
+      coff_symbol_type *coffsym;
+      if (*input_line_pointer == ',')
+	{
+	  ++input_line_pointer;
+	  s1 = demand_copy_string (&length);
+	  auxnb++;
+
+	  if (*input_line_pointer == ',')
+	    {
+	      ++input_line_pointer;
+	      s2 = demand_copy_string (&length);
+	      auxnb++;
+
+	      if (*input_line_pointer == ',')
+		{
+		  ++input_line_pointer;
+		  s3 = demand_copy_string (&length);
+		  auxnb++;
+		}
+	    }
+	}
+
+      /* Use coff dot_file creation and adjust auxiliary entries.  */
+      c_dot_file_symbol (sfname, 0);
+      S_SET_NUMBER_AUXILIARY (symbol_rootP, auxnb);
+      coffsym = coffsymbol (symbol_get_bfdsym (symbol_rootP));
+      coffsym->native[1].u.auxent.x_file.x_ftype = XFT_FN;
+
+      if (s1)
+	{
+	  coffsym->native[2].u.auxent.x_file.x_ftype = XFT_CT;
+	  coffsym->native[2].extrap = s1;
+	}
+      if (s2)
+	{
+	  coffsym->native[3].u.auxent.x_file.x_ftype = XFT_CV;
+	  coffsym->native[3].extrap = s2;
+	}
+      if (s3)
+	{
+	  coffsym->native[4].u.auxent.x_file.x_ftype = XFT_CD;
+	  coffsym->native[4].extrap = s3;
+	}
+
+      demand_empty_rest_of_line ();
+    }
+}
+
 /* The .function pseudo-op.  This takes several arguments.  The first
    argument seems to be the external name of the symbol.  The second
    argument seems to be the label for the start of the function.  gcc
diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h
index fb18730db3c..2d0a8865d98 100644
--- a/gas/config/tc-ppc.h
+++ b/gas/config/tc-ppc.h
@@ -146,7 +146,7 @@ struct ppc_tc_sy
 #define TC_SYMFIELD_TYPE struct ppc_tc_sy
 
 /* We need an additional auxent for function symbols.  */
-#define OBJ_COFF_MAX_AUXENTRIES 2
+#define OBJ_COFF_MAX_AUXENTRIES 4
 
 /* Square and curly brackets are permitted in symbol names.  */
 #define LEX_BR 3
diff --git a/gas/testsuite/gas/ppc/aix.exp b/gas/testsuite/gas/ppc/aix.exp
index aef295bc3b9..c6d10d5fb84 100644
--- a/gas/testsuite/gas/ppc/aix.exp
+++ b/gas/testsuite/gas/ppc/aix.exp
@@ -84,4 +84,7 @@ if { [istarget "powerpc*-*-aix*"] || [istarget "rs6000-*-aix*"] } then {
 
     run_dump_test "xcoff-stsym-32"
     run_dump_test "xcoff-stsym-64"
+
+    run_dump_test "xcoff-file-32"
+    run_dump_test "xcoff-file-64"
 }
diff --git a/gas/testsuite/gas/ppc/xcoff-file-32.d b/gas/testsuite/gas/ppc/xcoff-file-32.d
new file mode 100644
index 00000000000..a831b3b4587
--- /dev/null
+++ b/gas/testsuite/gas/ppc/xcoff-file-32.d
@@ -0,0 +1,13 @@
+#as: -a32
+#source: xcoff-file.s
+#objdump: -t
+#name: XCOFF file test (32-bit)
+
+.*
+
+SYMBOL TABLE:
+\[  0\].*\(scl 103\) \(nx 4\) .* file.s
+File 
+File ftype 1 fname "A long string"
+File ftype 2 fname "short"
+File ftype 128 fname "Another long string inside the strign table."
diff --git a/gas/testsuite/gas/ppc/xcoff-file-64.d b/gas/testsuite/gas/ppc/xcoff-file-64.d
new file mode 100644
index 00000000000..12bb6efc93b
--- /dev/null
+++ b/gas/testsuite/gas/ppc/xcoff-file-64.d
@@ -0,0 +1,13 @@
+#as: -a64
+#source: xcoff-file.s
+#objdump: -t
+#name: XCOFF file test (64-bit)
+
+.*
+
+SYMBOL TABLE:
+\[  0\].*\(scl 103\) \(nx 4\) .* file.s
+File 
+File ftype 1 fname "A long string"
+File ftype 2 fname "short"
+File ftype 128 fname "Another long string inside the strign table."
diff --git a/gas/testsuite/gas/ppc/xcoff-file.s b/gas/testsuite/gas/ppc/xcoff-file.s
new file mode 100644
index 00000000000..229ab889f49
--- /dev/null
+++ b/gas/testsuite/gas/ppc/xcoff-file.s
@@ -0,0 +1 @@
+.file "file.s", "A long string", "short", "Another long string inside the strign table."
diff --git a/include/coff/internal.h b/include/coff/internal.h
index 8d757acb333..d01af7380c8 100644
--- a/include/coff/internal.h
+++ b/include/coff/internal.h
@@ -578,18 +578,21 @@ union internal_auxent
     unsigned short x_tvndx;	/* tv index */
   }      x_sym;
 
-  union
+  struct
   {
-    /* PR 17754: We use to FILNMLEN for the size of the x_fname
-       array, but that causes problems as PE targets use a larger
-       value.  We cannot use their definition of E_FILNMLEN as this
-       header can be used without including any PE headers.  */
-    char x_fname[20];
-    struct
-    {
-      long x_zeroes;
-      long x_offset;
-    }      x_n;
+    union {
+      /* PR 17754: We use to FILNMLEN for the size of the x_fname
+	 array, but that causes problems as PE targets use a larger
+	 value.  We cannot use their definition of E_FILNMLEN as this
+	 header can be used without including any PE headers.  */
+      char x_fname[20];
+      struct
+      {
+	long x_zeroes;
+	long x_offset;
+      }      x_n;
+    } x_n;
+    unsigned char x_ftype;
   }     x_file;
 
   struct
diff --git a/include/coff/rs6000.h b/include/coff/rs6000.h
index e60efff23b6..fd3f01dccbc 100644
--- a/include/coff/rs6000.h
+++ b/include/coff/rs6000.h
@@ -176,6 +176,7 @@ union external_auxent {
       } x_n;
     } x_n;
     char x_ftype[1];
+    char x_resv[3];
   } x_file;
 
   struct {
diff --git a/include/coff/xcoff.h b/include/coff/xcoff.h
index 2b61545d611..1cff7dc30d5 100644
--- a/include/coff/xcoff.h
+++ b/include/coff/xcoff.h
@@ -190,6 +190,12 @@
 #define XMC_UL     21          /* Read-write uninitialized TLS data */
 #define XMC_TE     22          /* Same as XMC_TC but mapped after it */
 
+/* x_ftype values:  */
+#define XFT_FN 0    /* Specifies the source-file name */
+#define XFT_CT 1    /* Specifies the compiler time stamp */
+#define XFT_CV 2    /* Specifies the compiler version number */
+#define XFT_CD 128  /*Specifies compiler-defined information */
+
 /* The ldhdr structure.  This appears at the start of the .loader
    section.  */
 
</cut>
>From hjl@sc.intel.com  Wed Nov 10 16:45:00 2021
Return-Path: <hjl@sc.intel.com>
X-Original-To: gcc-regression@gcc.gnu.org
Delivered-To: gcc-regression@gcc.gnu.org
Received: from mga06.intel.com (mga06.intel.com [134.134.136.31])
 by sourceware.org (Postfix) with ESMTPS id 10F3C3858407
 for <gcc-regression@gcc.gnu.org>; Wed, 10 Nov 2021 16:44:57 +0000 (GMT)
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 10F3C3858407
X-IronPort-AV: E=McAfee;i="6200,9189,10164"; a="293541428"
X-IronPort-AV: E=Sophos;i="5.87,224,1631602800"; d="scan'208";a="293541428"
Received: from orsmga002.jf.intel.com ([10.7.209.21])
 by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 10 Nov 2021 08:44:56 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.87,224,1631602800"; d="scan'208";a="470446372"
Received: from scymds01.sc.intel.com ([10.148.94.138])
 by orsmga002.jf.intel.com with ESMTP; 10 Nov 2021 08:44:56 -0800
Received: from gnu-clx-1.sc.intel.com (gnu-clx-1.sc.intel.com [172.25.70.216])
 by scymds01.sc.intel.com with ESMTP id 1AAGiubG008032;
 Wed, 10 Nov 2021 08:44:56 -0800
Received: by gnu-clx-1.sc.intel.com (Postfix, from userid 1000)
 id 7B17F3E001E; Wed, 10 Nov 2021 08:44:56 -0800 (PST)
Date: Wed, 10 Nov 2021 08:44:56 -0800
To: skpgkp2@gmail.com, hjl.tools@gmail.com, gcc-regression@gcc.gnu.org
Subject: Regressions on native/master at commit r12-5124 vs commit
 r12-5075 on Linux/x86_64
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20211110164456.7B17F3E001E@gnu-clx-1.sc.intel.com>
From: "H. J. Lu" <hjl@sc.intel.com>
X-Spam-Status: No, score=-3470.0 required=5.0 testsºYES_00, KAM_DMARC_STATUS,
 KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,
 SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
 server2.sourceware.org
X-BeenThere: gcc-regression@gcc.gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Gcc-regression mailing list <gcc-regression.gcc.gnu.org>
List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-regression>,
 <mailto:gcc-regression-request@gcc.gnu.org?subject=unsubscribe>
List-Archive: <https://gcc.gnu.org/pipermail/gcc-regression/>
List-Post: <mailto:gcc-regression@gcc.gnu.org>
List-Help: <mailto:gcc-regression-request@gcc.gnu.org?subject=help>
List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-regression>,
 <mailto:gcc-regression-request@gcc.gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 10 Nov 2021 16:45:00 -0000

New failures:
FAIL: 18_support/nested_exception/rethrow_if_nested.cc (test for excess errors)
FAIL: 18_support/nested_exception/rethrow_if_nested.cc (test for excess errors)
FAIL: 18_support/nested_exception/rethrow_if_nested.cc (test for excess errors)
FAIL: gfortran.dg/inline_matmul_17.f90   -O   scan-tree-dump-times optimized "matmul_r4" 2
FAIL: gfortran.dg/inline_matmul_17.f90   -O   scan-tree-dump-times optimized "matmul_r4" 2
FAIL: gfortran.dg/inline_matmul_17.f90   -O   scan-tree-dump-times optimized "matmul_r4" 2

New passes:
FAIL: 17_intro/headers/c++1998/49745.cc (test for excess errors)
FAIL: 17_intro/headers/c++1998/49745.cc (test for excess errors)
FAIL: 17_intro/headers/c++1998/49745.cc (test for excess errors)
FAIL: 30_threads/jthread/95989.cc execution test
FAIL: 30_threads/jthread/95989.cc execution test
FAIL: 30_threads/jthread/95989.cc execution test
FAIL: gcc.dg/signbit-2.c scan-tree-dump-not optimized "\\s+>>\\s+31"
FAIL: gcc.dg/signbit-2.c scan-tree-dump-not optimized "\\s+>>\\s+31"
FAIL: gcc.dg/signbit-2.c scan-tree-dump-not optimized "\\s+>>\\s+31"
FAIL: gcc.dg/signbit-2.c scan-tree-dump-times optimized "\\s+>\\s+{ 0, 0, 0, 0 }" 1
FAIL: gcc.dg/signbit-2.c scan-tree-dump-times optimized "\\s+>\\s+{ 0, 0, 0, 0 }" 1
FAIL: gcc.dg/signbit-2.c scan-tree-dump-times optimized "\\s+>\\s+{ 0, 0, 0, 0 }" 1
FAIL: gcc.dg/signbit-5.c execution test
FAIL: gcc.dg/signbit-5.c execution test
FAIL: gcc.dg/signbit-5.c execution test
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++14  scan-tree-dump-not optimized "goto"
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++14  scan-tree-dump-not optimized "goto"
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++14  scan-tree-dump-not optimized "goto"
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++17  scan-tree-dump-not optimized "goto"
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++17  scan-tree-dump-not optimized "goto"
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++17  scan-tree-dump-not optimized "goto"
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++17 (test for excess errors)
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++17 (test for excess errors)
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++17 (test for excess errors)
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++2a  scan-tree-dump-not optimized "goto"
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++2a  scan-tree-dump-not optimized "goto"
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++2a  scan-tree-dump-not optimized "goto"
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++2a (test for excess errors)
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++2a (test for excess errors)
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++2a (test for excess errors)
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++98  scan-tree-dump-not optimized "goto"
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++98  scan-tree-dump-not optimized "goto"
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++98  scan-tree-dump-not optimized "goto"
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++98 (test for excess errors)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-10 10:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 10:15 [TCWG CI] Regression caused by gdb: PR 28447: implement multiple parameters for .file on XCOFF ci_notify

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).