https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122172

            Bug ID: 122172
           Summary: [16 Regression] 1571 regressions due to
                    std::make_unsigned<_Atomic_word>
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hp at gcc dot gnu.org
                CC: redi at gcc dot gnu.org
  Target Milestone: ---
            Target: cris-elf

r16-3810-g6456da6bab8a2c caused 1582-11 (1571) regressions in the
metric of contrib/regression/btest-gcc.sh.

That commit adds std::make_unsigned<_Atomic_word> where CRIS'
_Atomic_word is "typedef int _Atomic_word __attribute__ ((__aligned__
(4)));" and a known issue is ran into, as seen in the testsuite logs
(here for the semi-randomly chosen g++.old-deja/g++.warn/iomanip.C in
g++.log):

FAIL: g++.old-deja/g++.warn/iomanip.C  -std=gnu++26 (test for excess errors)
Excess errors:
/x/gccobj/cris-elf/libstdc++-v3/include/ext/atomicity.h:100:36: warning:
ignoring attributes on template argument '_Atomic_word' {aka 'int'}
[-Wignored-attributes]
/x/gccobj/cris-elf/libstdc++-v3/include/ext/atomicity.h:118:36: warning:
ignoring attributes on template argument '_Atomic_word' {aka 'int'}
[-Wignored-attributes]

While applying make_unsigned to _Atomic_word is IMO overly
presumptious of what it's definition is (basically, "int" or "long
int") i.e. it must not have any attribute attached, that may very well
be intended, and that the target should perhaps instead override the
default libstdc++-v3/include/ext/atomicity.h.  It used to be like
that, but that doesn't seem to work since some time.  Although
there's: 185 if test -f
${glibcxx_srcdir}/config/${cpu_include_dir}/atomicity.h ; then 186
atomicity_dir=$cpu_include_dir 187 fi

...that file is later lost, as a well-placed #error shows:
----
diff --git a/libstdc++-v3/config/cpu/cris/atomicity.h
b/libstdc++-v3/config/cpu/cris/atomicity.h
index 9d3cec403a14..bd0350b187db 100644
--- a/libstdc++-v3/config/cpu/cris/atomicity.h
+++ b/libstdc++-v3/config/cpu/cris/atomicity.h
@@ -22,6 +22,8 @@
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.

+#error unused file
+
 #include <ext/atomicity.h>

 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
----
The above probing patch applied to r16-3809-g46028a2f40329b shows no
regressions.  (Seemed easier that manually tracking the configury
bits.)

In conclusion, I think the primary bug is that
libstdc++-v3/include/ext/atomicity.h isn't overridden (or perhaps just
__gnu_cxx::__exchange_and_add_single?) and in any case that the
atomicity.h target-machinery appears to have rotten.  The secondary
bug is the assumption that _Atomic_word is an undecorated integer
type where std::make_unsigned<_Atomic_word> can be applied (and tertiary that
it *can't* be applied, but that's a known issue).

Reply via email to