New Georgian PO file for 'cpplib' (version 12.1-b20220213)

2023-01-14 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

A revised PO file for textual domain 'cpplib' has been submitted
by the Georgian team of translators.  The file is available at:

https://translationproject.org/latest/cpplib/ka.po

(This file, 'cpplib-12.1-b20220213.ka.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

https://translationproject.org/latest/cpplib/

Please consider including all of these in your next release, whether
official or a pretest.

Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below.  The tarball may be just a pretest or a
snapshot, it does not even have to compile.  It is just used by the
translators when they need some extra translation context.

The following HTML page has been updated:

https://translationproject.org/domain/cpplib.html

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.




Contents of PO file 'cpplib-12.1-b20220213.ka.po'

2023-01-14 Thread Translation Project Robot


cpplib-12.1-b20220213.ka.po.gz
Description: Binary data
The Translation Project robot, in the
name of your translation coordinator.



[PATCH] configure: Only create serdep.tmp if needed

2023-01-14 Thread Peter Foley
There's no reason to create this file if none of the serial configure
options are passed.

ChangeLog:

* configure: Regenerate.
* configure.ac: Only create serdep.tmp if needed

Signed-off-by: Peter Foley 
---
 configure| 2 ++
 configure.ac | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/configure b/configure
index 85883099410..47caaeb23fe 100755
--- a/configure
+++ b/configure
@@ -9918,7 +9918,9 @@ esac
 # These force 'configure's to be done one at a time, to avoid problems
 # with contention over a shared config.cache.
 rm -f serdep.tmp
+if  "x${enable_serial_build_configure}" = xyes || 
"x${enable_serial_host_configure}" = xyes || 
"x${enable_serial_target_configure}" = xyes ; then
 echo '# serdep.tmp' > serdep.tmp
+fi
 olditem=
 test "x${enable_serial_build_configure}" = xyes &&
 for item in ${build_configdirs} ; do
diff --git a/configure.ac b/configure.ac
index 2b612dce6e9..847df0c99b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3071,7 +3071,9 @@ esac
 # These force 'configure's to be done one at a time, to avoid problems
 # with contention over a shared config.cache.
 rm -f serdep.tmp
+if [ "x${enable_serial_build_configure}" = xyes || 
"x${enable_serial_host_configure}" = xyes || 
"x${enable_serial_target_configure}" = xyes ]; then
 echo '# serdep.tmp' > serdep.tmp
+fi
 olditem=
 test "x${enable_serial_build_configure}" = xyes &&
 for item in ${build_configdirs} ; do
-- 
2.39.0



[COMMITTED] C-SKY: Support --with-float=softfp in configuration.

2023-01-14 Thread Xianmiao Qu via Gcc-patches
Missed it before, it needs to be used when compiling non-multilib.

gcc/
* config.gcc (csky-*-*): Support --with-float=softfp.
---
 gcc/config.gcc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index c4633e869ac..f89a071b495 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1616,7 +1616,7 @@ csky-*-*)
fi
if test x${with_float} != x; then
case ${with_float} in
-   soft | hard) ;;
+   soft | hard | softfp) ;;
*) echo
"Unknown floating point type used in 
--with-float=$with_float"
exit 1
-- 
2.32.1 (Apple Git-133)



Re: [PATCH] libstdc++: enable on windows

2023-01-14 Thread Jonathan Wakely via Gcc-patches
On Mon, 12 Dec 2022 at 17:28, Björn Schäpers  wrote:
>
> From: Björn Schäpers 
>
> libstdc++-v3/Changelog
> * acinclude.m4: Add check for windows.h.
> * acinclude.m4: Add pecoff as FORMAT_FILE.
> * config.h.in: Regenerate.
> * configure: Regenerate.
> * src/libbacktrace/Makefile.am: Regenerate.
> * src/libbacktrace/Makefile.in: Add pecoff.c as FORMAT_FILE.

Thanks, I've pushed this one too.


>
> Signed-off-by: Björn Schäpers 
> ---
>  libstdc++-v3/acinclude.m4 | 2 ++
>  libstdc++-v3/src/libbacktrace/Makefile.am | 1 +
>  2 files changed, 3 insertions(+)
>
> diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
> index b957c728ba1..1cfe704e637 100644
> --- a/libstdc++-v3/acinclude.m4
> +++ b/libstdc++-v3/acinclude.m4
> @@ -4981,6 +4981,7 @@ AC_DEFUN([GLIBCXX_ENABLE_BACKTRACE], [
>if test "$have_dl_iterate_phdr" = "yes"; then
>  BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS -DHAVE_DL_ITERATE_PHDR=1"
>fi
> +  AC_CHECK_HEADERS(windows.h)
>
># Check for the fcntl function.
>if test -n "${with_target_subdir}"; then
> @@ -5026,6 +5027,7 @@ glibcxx_cv_sys_filetype=$filetype])
>  FORMAT_FILE=
>  case "$glibcxx_cv_sys_filetype" in
>  elf*) FORMAT_FILE="elf.lo" ;;
> +pecoff*) FORMAT_FILE="pecoff.lo" ;;
>  *) AC_MSG_WARN([could not determine output file type])
> FORMAT_FILE="unknown.lo"
> enable_libstdcxx_backtrace=no
> diff --git a/libstdc++-v3/src/libbacktrace/Makefile.am 
> b/libstdc++-v3/src/libbacktrace/Makefile.am
> index 52d8f81b97b..b34a429a21d 100644
> --- a/libstdc++-v3/src/libbacktrace/Makefile.am
> +++ b/libstdc++-v3/src/libbacktrace/Makefile.am
> @@ -71,6 +71,7 @@ libstdc___libbacktrace_la_SOURCES = \
>
>  FORMAT_FILES = \
> elf.c \
> +   pecoff.c \
> unknown.c
>
>  VIEW_FILES = \
> --
> 2.38.1
>



[committed] libstdc++: Implement std::chrono::current_zone() for AIX [PR108409]

2023-01-14 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux and powerpc-aix. Pushed to trunk.

-- >8 --

libstdc++-v3/ChangeLog:

PR libstdc++/108409
* src/c++20/tzdb.cc (current_zone()) [_AIX]: Use TZ environment
variable.
---
 libstdc++-v3/src/c++20/tzdb.cc | 23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/src/c++20/tzdb.cc b/libstdc++-v3/src/c++20/tzdb.cc
index a37859dffdb..eaaea367f4f 100644
--- a/libstdc++-v3/src/c++20/tzdb.cc
+++ b/libstdc++-v3/src/c++20/tzdb.cc
@@ -34,6 +34,10 @@
 #include   // mutex
 #include  // filesystem::read_symlink
 
+#ifndef _AIX
+# include// getenv
+#endif
+
 #ifndef __GTHREADS
 # define USE_ATOMIC_SHARED_PTR 0
 #elif _WIN32
@@ -1625,6 +1629,7 @@ namespace std::chrono
   {
 // TODO cache this function's result?
 
+#ifndef _AIX
 error_code ec;
 // This should be a symlink to e.g. /usr/share/zoneinfo/Europe/London
 auto path = filesystem::read_symlink("/etc/localtime", ec);
@@ -1655,11 +1660,25 @@ namespace std::chrono
  if (auto tz = do_locate_zone(this->zones, this->links, name))
return tz;
   }
-
-// TODO AIX stores current zone in $TZ in /etc/environment but the value
+#else
+// AIX stores current zone in $TZ in /etc/environment but the value
 // is typically a POSIX time zone name, not IANA zone.
 // https://developer.ibm.com/articles/au-aix-posix/
 // https://www.ibm.com/support/pages/managing-time-zone-variable-posix
+if (const char* env = std::getenv("TZ"))
+  {
+   string_view s(env);
+   if (s == "GMT0")
+ s = "Etc/GMT";
+   else if (s.size() == 4 && s[3] == '0')
+ s = "Etc/UTC";
+
+   // This will fail unless TZ contains an IANA time zone name,
+   // or one of the special cases above.
+   if (auto tz = do_locate_zone(this->zones, this->links, s))
+ return tz;
+  }
+#endif
 
 __throw_runtime_error("tzdb: cannot determine current zone");
   }
-- 
2.39.0



Re: [wwwdocs] gcc-13/changes.html + projects/gomp/: OpenMP update

2023-01-14 Thread Gerald Pfeifer
Hi Tobias,

On Fri, 2 Sep 2022, Tobias Burnus wrote:
> Update the OpenMP status for features that were added in the last months.

I made a couple of incremental edits. See below for what I just pushed
(and please speak up if you see any issues).

Gerald


commit 2f870cba58c81449beb618a9030824360a25
Author: Gerald Pfeifer 
Date:   Sat Jan 14 22:44:49 2023 +0100

gcc-13: Various editorial changes around OMP entries

diff --git a/htdocs/gcc-13/changes.html b/htdocs/gcc-13/changes.html
index 96d47903..08e36fb3 100644
--- a/htdocs/gcc-13/changes.html
+++ b/htdocs/gcc-13/changes.html
@@ -54,10 +54,10 @@ a work-in-progress.
   
 
   Reverse offload is now supported and the all clauses to the
-  requires directive are now accepted; however, the
+  requires directive are now accepted. However, the
   requires_offload, unified_address
-  and unified_shared_memory clauses cause that the
-  only available device is the initial device (the host). Fortran now
+  and unified_shared_memory clauses imply the initial
+  device (= the host) as the only available device. Fortran now
   supports non-rectangular loop nests, which were added for C/C++ in GCC 
11.
 
 
@@ -72,27 +72,27 @@ a work-in-progress.
   syntax in C/C++ and device-specific ICV settings with environment 
variables
   are now supported.
 
-  Initial support for OpenMP 5.2 features have been added: Support for
+  Initial support for OpenMP 5.2 features has been added:
   firstprivate and allocate clauses on the
-  scope construct and the OpenMP 5.2 syntax of the
-  linear clause; the new enum/constants
+  scope construct; the OpenMP 5.2 syntax of the
+  linear clause; new enum/constants
   omp_initial_device and omp_invalid_device; and
   optionally omitting the map-type in target enter/exit data.
   The enter clause (as alias for to) has been 
added
-  to the declare target directive. Also added has been the
+  to the declare target directive. Also added have been the
   omp_in_explicit_task routine and the doacross
   clause as alias for depend with
   source/sink modifier.
 
 
-  The _ALL suffix to the device-scope environment variables,
+  The _ALL suffix to the device-scope environment variables
   added in Technical Report (TR11) is already handled.
 
 
   For user defined allocators requesting high bandwidth or large capacity
   memspaces or interleaved partitioning, the http://memkind.github.io/memkind/;>memkind library is used,
-  if available at runtime.
+  if available at run time.
 
   
   


Re: [PATCH] IPA: do not release body if still needed

2023-01-14 Thread Jan Hubicka via Gcc-patches
> Hi.
> 
> Noticed during building of libbackend.a with the LTO partial linking.
> 
> The function release_body is called even if clone_of is a clone
> of a another function and thus it shares tree declaration. We should
> preserve it in that situation.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> Ready to be installed?
> Thanks,
> Martin
> 
>   PR ipa/107944
> 
> gcc/ChangeLog:
> 
>   * cgraph.cc (cgraph_node::remove): Do not release body
>   if a node is clone of another node.
> ---
>  gcc/cgraph.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
> index f15cb47c8b8..2e7d77ffd6c 100644
> --- a/gcc/cgraph.cc
> +++ b/gcc/cgraph.cc
> @@ -1893,7 +1893,7 @@ cgraph_node::remove (void)
>else if (clone_of)
>  {
>clone_of->clones = next_sibling_clone;
> -  if (!clone_of->analyzed && !clone_of->clones && !clones)
> +  if (!clone_of->analyzed && !clone_of->clones && !clones && 
> !clone_of->clone_of)
>   clone_of->release_body ();

It is interesting that the problem reproduced only after almost 20
years.  But I suppose it is because we materialize clones in parituclar
order.

I think there are two ways to fix it.  Either declare release_body to be
applicable only to the master clone and avoid calling it here (as you
do) or make release_body do nothing when called on a clone.
I guess it makes sense to keep your approach but please add sanity check
to release_body that clone_of == NULL with a comment.

OK with that change.
Honza
>  }
>if (next_sibling_clone)
> -- 
> 2.38.1
> 


[PATCH] libatomic: Use config/mingw/lock.c for --enable-threads=single

2023-01-14 Thread Jonathan Wakely via Gcc-patches
OK for trunk?

-- >8--

Without this change bootstrap fails for x86_64-w64-mingw32 with
--disable-threads=single because there is no lock.c file chosen by
libatomic's configure.

libatomic/ChangeLog:

* configure.tgt (config_path) [target_thread_file=single]:
Use 'mingw' config.
---
 libatomic/configure.tgt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index 57f093603bb..641dc834abc 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -160,7 +160,7 @@ case "${target}" in
   *-*-mingw*)
# OS support for atomic primitives.
 case ${target_thread_file} in
-  win32 | mcf)
+  win32 | mcf | single)
 config_path="${config_path} mingw"
 ;;
   posix)
-- 
2.39.0



Re: [PATCH] libstdc++: Deliver names of C functions in

2023-01-14 Thread Jonathan Wakely via Gcc-patches
On Tue, 13 Dec 2022 at 21:03, Björn Schäpers  wrote:
>
> From: Björn Schäpers 
>
> One could add (), these are not part of __name. One could also try to
> check upfront if __cxa_demangle should be called at all.


Thanks for the patch, I'll push this.

I think we do want to check whether to call __cxa_demangle, because
otherwise an extern "C" function called simply "g" will get demangled
to "__float128" and that's not right!

So I think we should check whether the function name starts with "_Z"
which indicates a C++ function name. That can be improved later
though.



>
> -- >8 --
>
> Tested on i686-w64-mingw32.
>
> __cxa_demangle is only to demangle C++ names, for all C functions,
> extern "C" functions, and including main it returns -2, in that case
> just adapt the given name. Otherwise it's kept empty, which doesn't look
> nice in the stacktrace.
>
> libstdc++-v3/ChangeLog:
>
> * include/std/stacktrace (stacktrace_entry::_S_demangle): Use
> raw __name if __cxa_demangle could not demangle it.
>
> Signed-off-by: Björn Schäpers 
> ---
>  libstdc++-v3/include/std/stacktrace | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libstdc++-v3/include/std/stacktrace 
> b/libstdc++-v3/include/std/stacktrace
> index 83c6463b0d8..5baf2dcdaca 100644
> --- a/libstdc++-v3/include/std/stacktrace
> +++ b/libstdc++-v3/include/std/stacktrace
> @@ -219,6 +219,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>&__status);
>if (__status == 0)
> __s = __str;
> +  else
> +   __s = __name;
>__builtin_free(__str);
>return __s;
>  }
> --
> 2.38.1
>



[PATCH] libcpp: Fix ICE on directive inside _Pragma() operator [PR67046]

2023-01-14 Thread Lewis Hyatt via Gcc-patches
get__Pragma_string() in directives.cc is responsible for lexing the parens
and the string argument from a _Pragma("...") operator. This function does
not handle the case when the closing paren is not on the same line as the
string; in that case, libcpp will by default reuse the token buffer it
previously used for the string, so that the string token returned by
get__Pragma_string() may be corrupted, as shown in the testcase. Fix using
the existing keep_tokens mechanism that temporarily disables the reuse of
token buffers.

libcpp/ChangeLog:

PR preprocessor/67046
* directives.cc (_cpp_do__Pragma): Increment pfile->keep_tokens to
ensure the returned string token is valid.

gcc/testsuite/ChangeLog:

PR preprocessor/67046
* c-c++-common/cpp/pr67046.c: New test.
---

Notes:
Hello-

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

This fixes an old ICE in libcpp that can happen when lexing the tokens from 
a
_Pragma operator. Bootstrapped+tested on x86-64 Linux with no
regressions. Please let me know if it's OK? Thanks...

-Lewis

 gcc/testsuite/c-c++-common/cpp/pr67046.c | 10 ++
 libcpp/directives.cc |  5 +
 2 files changed, 15 insertions(+)
 create mode 100644 gcc/testsuite/c-c++-common/cpp/pr67046.c

diff --git a/gcc/testsuite/c-c++-common/cpp/pr67046.c 
b/gcc/testsuite/c-c++-common/cpp/pr67046.c
new file mode 100644
index 000..f37f20c624e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/pr67046.c
@@ -0,0 +1,10 @@
+/* { dg-do preprocess } */
+
+_Pragma(
+"message(\"msg\")"
+)
+
+_Pragma(
+"message(\"msg\")"
+#
+)
diff --git a/libcpp/directives.cc b/libcpp/directives.cc
index 9dc4363c65a..ffd262bce7d 100644
--- a/libcpp/directives.cc
+++ b/libcpp/directives.cc
@@ -1996,7 +1996,12 @@ destringize_and_run (cpp_reader *pfile, const cpp_string 
*in,
 int
 _cpp_do__Pragma (cpp_reader *pfile, location_t expansion_loc)
 {
+  /* Make sure we don't invalidate the string token, if the closing parenthesis
+   ended up on a different line.  */
+  ++pfile->keep_tokens;
   const cpp_token *string = get__Pragma_string (pfile);
+  --pfile->keep_tokens;
+
   pfile->directive_result.type = CPP_PADDING;
 
   if (string)


Re: [PATCH] libstdc++, configure: Fix GLIBCXX_ZONEINFO_DIR configuration macro.

2023-01-14 Thread Jonathan Wakely via Gcc-patches

On 14/01/23 18:24 +, Jonathan Wakely wrote:

On 23/12/22 17:06 +, Iain Sandoe wrote:

This is a patch for comment on the approach - tested on x86_64-darwi21
thoughts?
Iain

--- 8< ---

Testing on Darwin revealed that the GLIBCXX_ZONEINFO_DIR was not doing quite
the right thing (we ended up with ${withval} in the config.h file).

This patch proposes revising the behaviour of the configure flag thus:

--with-libstdcxx-zoneinfo-dir=
unspecified : Set _GLIBCXX_ZONEINFO_DIR to a default suitable for $host
   yes : Set _GLIBCXX_ZONEINFO_DIR to a default suitable for $host
   no  : Do not set _GLIBCXX_ZONEINFO_DIR
/some/path  : set _GLIBCXX_ZONEINFO_DIR = "/some/path"


Here's what I've pushed to trunk now, after discussion with Iain.


This is a small follow-up to elide most of the code in
src/c++20/tzdb.cc when the library is configured with
--with-libstdcxx-zoneinfo=no

Tested x86_64-linux and powerpc64le-linux. Pushed to trunk.

-- >8 --

commit c47dcb95666ce0b48f0ff09aa99483fd12df8714
Author: Jonathan Wakely 
Date:   Sat Jan 14 13:39:48 2023

libstdc++: Disable unwanted code for --with-libstdcxx-zoneinfo=no

This allows most of the tzdb functionality to be disabled by

configuring with --with-libstdcxx-zoneinfo=no. This might be desirable
for small targets that don't need the time zone support.

libstdc++-v3/ChangeLog:

* src/c++20/tzdb.cc (TZDB_DISABLED): Disable all code for

loading tzdb.
* testsuite/std/time/tzdb/leap_seconds.cc: Require tzdb
effective target.
* testsuite/std/time/tzdb_list/1.cc: Likewise.

diff --git a/libstdc++-v3/src/c++20/tzdb.cc b/libstdc++-v3/src/c++20/tzdb.cc
index 94fb0436091..a37859dffdb 100644
--- a/libstdc++-v3/src/c++20/tzdb.cc
+++ b/libstdc++-v3/src/c++20/tzdb.cc
@@ -82,6 +82,14 @@ namespace __gnu_cxx
 #endif
 }
 
+#if ! defined _GLIBCXX_ZONEINFO_DIR && ! defined _GLIBCXX_STATIC_TZDATA

+# define TZDB_DISABLED
+  [[noreturn]] void __throw_disabled()
+  {
+std::__throw_runtime_error("tzdb: support for loading tzdata is disabled");
+  }
+#endif
+
 namespace std::chrono
 {
   namespace
@@ -105,7 +113,9 @@ namespace std::chrono
   {
 shared_ptr<_Node> next;
 tzdb db;
+#ifndef TZDB_DISABLED
 vector rules;
+#endif
 
 // The following static members are here because making them members

 // of this type gives them access to the private members of time_zone
@@ -175,6 +185,7 @@ namespace std::chrono
   // assume that setting failbit will throw an exception, so individual
   // input operations are not always checked for success.
 
+#ifndef TZDB_DISABLED

   namespace
   {
 // Used for reading a possibly-quoted string from a stream.
@@ -582,6 +593,7 @@ namespace std::chrono
 #endif
 };
   } // namespace
+#endif // TZDB_DISABLED
 
   // Private constructor used by reload_tzdb() to create time_zone objects.

   time_zone::time_zone(unique_ptr<_Impl> __p) : _M_impl(std::move(__p)) { }
@@ -591,6 +603,7 @@ namespace std::chrono
   // The opaque pimpl class stored in a time_zone object.
   struct time_zone::_Impl
   {
+#ifndef TZDB_DISABLED
 explicit
 _Impl(weak_ptr node) : node(std::move(node)) { }
 
@@ -677,11 +690,19 @@ namespace std::chrono

  }
}
   };
-#endif
+#endif // __GTHREADS && __cpp_lib_atomic_wait
 
 RulesCounter rules_counter;

+#else // TZDB_DISABLED
+_Impl(weak_ptr) { }
+struct {
+  sys_info info;
+  void push_back(sys_info i) { info = std::move(i); }
+} infos;
+#endif // TZDB_DISABLED
   };
 
+#ifndef TZDB_DISABLED

   namespace
   {
 bool
@@ -731,11 +752,13 @@ namespace std::chrono
select_std_or_dst_abbrev(info.abbrev, info.save);
 }
   }
+#endif // TZDB_DISABLED
 
   // Implementation of std::chrono::time_zone::get_info(const sys_time&)

   sys_info
   time_zone::_M_get_sys_info(sys_seconds tp) const
   {
+#ifndef TZDB_DISABLED
 // This gives us access to the node->rules vector, but also ensures
 // that the tzdb node won't get erased while we're still using it.
 const auto node = _M_impl->node.lock();
@@ -934,17 +957,20 @@ namespace std::chrono
// Decrement count of rule-based infos (might also release lock).
_M_impl->rules_counter.decrement();
   }
-
 return info;
+#else
+return _M_impl->infos.info;
+#endif // TZDB_DISABLED
   }
 
   // Implementation of std::chrono::time_zone::get_info(const local_time&)

   local_info
   time_zone::_M_get_local_info(local_seconds tp) const
   {
+local_info info{};
+#ifndef TZDB_DISABLED
 const auto node = _M_impl->node.lock();
 
-local_info info{};

 // Get sys_info assuming no offset between local time and UTC:
 info.first = _M_get_sys_info(sys_seconds(tp.time_since_epoch()));
 
@@ -1007,9 +1033,13 @@ namespace std::chrono

  }
// else tp is a unique local time, info.first is the correct sys_info.
   }
+#else
+info.first = _M_impl->infos.info;

Re: [PATCH] libstdc++, configure: Fix GLIBCXX_ZONEINFO_DIR configuration macro.

2023-01-14 Thread Jonathan Wakely via Gcc-patches

On 23/12/22 17:06 +, Iain Sandoe wrote:

This is a patch for comment on the approach - tested on x86_64-darwi21
thoughts?
Iain

--- 8< ---

Testing on Darwin revealed that the GLIBCXX_ZONEINFO_DIR was not doing quite
the right thing (we ended up with ${withval} in the config.h file).

This patch proposes revising the behaviour of the configure flag thus:

--with-libstdcxx-zoneinfo-dir=
unspecified : Set _GLIBCXX_ZONEINFO_DIR to a default suitable for $host
yes : Set _GLIBCXX_ZONEINFO_DIR to a default suitable for $host
no  : Do not set _GLIBCXX_ZONEINFO_DIR
/some/path  : set _GLIBCXX_ZONEINFO_DIR = "/some/path"


Here's what I've pushed to trunk now, after discussion with Iain.

This bundles a copy of the tzdata.zi file with the libstdc++ sources.
This means we can provide fully functional std::chrono time zone
support on all targets (except freestanding). The only thing that
doesn't work now is the std::chrono::current_zone() function on AIX,
which cannot determine the current time zone, because AIX uses POSIX
time zone names in the $TZ env var, rather than an IANA name like
"Europe/London".

The bundles tzdata.zi file was include in this commit, but isn't
included in the patch below, because it's 105kB of boring data. If you
want to see it, it's in the repo now. The version committed is the
latest one from upstream, included in the tarball at
https://data.iana.org/time-zones/releases/tzdb-2022g.tar.lz
I will sync the copy in the libstdc++ sources with upstream as needed.
That should be done before a release from relevant branches (gcc-13
and later).

Packagers for Linux distros that ship the tzdata.zi and leapseconds
files might want to configure their gcc packages with
--with-libstdcxx-zoneinfo=/usr/share/zoneinfo (or similar path). This
applies to (at least) Debian, RHEL, Fedora, and their derivatives.
That will avoid bundling the 105kB file in the libstdc++.so.6 and
libstdc++.a libs on systems where the OS already provides the file
(and presumably already keeps it up to date when upstream release a
new version of the data).

Tested x86_64-linux, power-aix, sparc-solaris2.11. Iain has also
tested on darwin.

Pushed to trunk.

-- >8 --

commit 559993b85744ae09d33eedb1cb062392ac482f94
Author: Jonathan Wakely 
Date:   Sat Jan 14 13:33:58 2023

libstdc++: Embed a static copy of tzdata.zi

This adds a copy of the tzdata.zi file to the library, and allows

configuring to use it instead of a copy read from disk at runtime.
The content of the file is in the public domain, but will need to be
updated to the latest upstream file before making GCC releases.

libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_ZONEINFO_DIR): Replace the

--with-libstdcxx-zoneinfo-dir configure option with
--with-libstdcxx-zoneinfo with yes/no/static choices as well as
a directory.
* config.h.in: Regenerate.
* configure: Regenerate.
* doc/xml/manual/configure.xml: Document configure option.
* doc/html/manual/configure.html: Regenerate.
* src/c++20/Makefile.am: Generate tzdata.zi.h header.
* src/c++20/Makefile.in: Regenerate.
* src/c++20/tzdb.cc (__gnu_cxx::zoneinfo_dir_override): Return a
null pointer if no directory is configured.
(zoneinfo_dir): Replace with ...
(zoneinfo_file): New function.
(tzdata_stream): New istream class.
(remote_version, reload_tzdb): Use tzdata_stream.
* testsuite/lib/libstdc++.exp (check_effective_target_tzdb):
Check new _GLIBCXX_STATIC_TZDATA macro and ignore presence of
tzdata.zi file in default location.
* src/c++20/tzdata.zi: New file.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 51c3c510364..3840a9d761a 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -5157,28 +5157,87 @@ AC_DEFUN([GLIBCXX_EMERGENCY_EH_ALLOC], [
 dnl
 dnl Allow the location of tzdata files to be configured.
 dnl
-dnl --with-libstdcxx-zoneinfo-dir=PATH will set the directory to PATH.
+dnl --with-libstdcxx-zoneinfo=ARG where ARG can be:
+dnl   DIR - use DIR/tzdata.zi and DIR/leapseconds files.
+dnl   static - use static copy of tzdata.zi embedded in the library.
+dnl   DIR,static - use DIR, but use embedded static copy as fallback.
+dnl   yes - equivalent to DIR,static with a system-specific value for DIR.
+dnl   no - disable most tzdb functionality.
 dnl
 dnl Defines:
-dnl  _GLIBCXX_ZONEINFO_DIR if std::chrono::tzdb should use a non-default
+dnl  _GLIBCXX_ZONEINFO_DIR if std::chrono::tzdb should use the specified
 dnldirectory for the tzdata.zi and leapseconds files.
+dnl  _GLIBCXX_STATIC_TZDATA if std::chrono::tzdb should use an embedded
+dnlstatic copy of the tzdata.zi file.
 dnl
 AC_DEFUN([GLIBCXX_ZONEINFO_DIR], [
-  AC_ARG_WITH([libstdcxx-zoneinfo-dir],
-

Re: [PATCH] xtensa: Remove old broken tweak for leaf function

2023-01-14 Thread Max Filippov via Gcc-patches
On Fri, Jan 13, 2023 at 9:03 PM Takayuki 'January June' Suwa
 wrote:
>
> In the before-IRA era, ORDER_REGS_FOR_LOCAL_ALLOC was called for each
> function in Xtensa, and there was register allocation table reordering
> for leaf functions to compensate for the poor performance of local-alloc.
>
> Today the adjustment hook is still called via its alternative
> ADJUST_REG_ALLOC_ORDER, but it is only called once at the start of the IRA,
> and leaf_function_p() erroneously returns true and also gives no argument
> count.
>
> That straightforwardly misleads register allocation that all functions are
> always leaves with no arguments, which leads to inefficiencies in allocation
> results.
>
> Fortunately, IRA is smart enough than local-alloc to not need such assistance.
>
> This patch does away with the antiquated by removing the wreckage that no
> longer works.
>
> gcc/ChangeLog:
>
> * config/xtensa/xtensa-protos.h (order_regs_for_local_alloc):
>   Rename to xtensa_adjust_reg_alloc_order.
> * config/xtensa/xtensa.cc (xtensa_adjust_reg_alloc_order):
>   Ditto.  And also remove code to reorder register numbers for
>   leaf functions, rename the tables, and adjust the allocation
>   order for the call0 ABI to use register A0 more.
>   (xtensa_leaf_regs): Remove.
> * config/xtensa/xtensa.h (REG_ALLOC_ORDER): Cosmetics.
>   (order_regs_for_local_alloc): Rename as the above.
>   (LEAF_REGISTERS, LEAF_REG_REMAP, leaf_function): Remove.
> ---
>  gcc/config/xtensa/xtensa-protos.h |  2 +-
>  gcc/config/xtensa/xtensa.cc   | 77 +++
>  gcc/config/xtensa/xtensa.h| 51 ++--
>  3 files changed, 31 insertions(+), 99 deletions(-)

Regtested for target=xtensa-linux-uclibc, no new regressions.
Committed to master.

-- 
Thanks.
-- Max


Re: Missed lowering to ld1rq from svld1rq for memory operand

2023-01-14 Thread Prathamesh Kulkarni via Gcc-patches
On Thu, 12 Jan 2023 at 21:02, Richard Sandiford
 wrote:
>
> Prathamesh Kulkarni  writes:
> > On Fri, 5 Aug 2022 at 17:49, Richard Sandiford
> >  wrote:
> >>
> >> Prathamesh Kulkarni  writes:
> >> > Hi Richard,
> >> > Following from off-list discussion, in the attached patch, I wrote 
> >> > pattern
> >> > similar to vec_duplicate_reg, which seems to work for the svld1rq 
> >> > tests.
> >> > Does it look OK ?
> >> >
> >> > Sorry, I didn't fully understand your suggestion on integrating with
> >> > vec_duplicate_reg
> >> > pattern. For vec_duplicate_reg, the operand to vec_duplicate 
> >> > expects
> >> > mode to be , while the pattern in patch expects operand of
> >> > vec_duplicate to have mode .
> >> > How do we write a pattern so an operand can accept either of the 2 modes 
> >> > ?
> >>
> >> I quoted the wrong one, sorry, should have been
> >> aarch64_vec_duplicate_vq_le.
> >>
> >> > Also it seems  cannot be used with SVE_ALL ?
> >>
> >> Yeah, these would be SVE_FULL only.
> > Hi Richard,
> > Sorry for the very late reply. I have attached patch, to integrate
> > with vec_duplicate_vq_le.
> > Bootstrapped+tested on aarch64-linux-gnu.
> > OK to commit ?
> >
> > Thanks,
> > Prathamesh
> >>
> >> Richard
> >>
> >
> > gcc/
> >   * config/aarch64/aarch64-sve.md (aarch64_vec_duplicate_vq_le):
> >   Change to define_insn_and_split to fold ldr+dup to ld1rq.
> >   * config/aarch64/predicates.md (aarch64_sve_dup_ld1rq_operand): New.
> >
> > testsuite/
> >   * gcc.target/aarch64/sve/acle/general/pr96463-2.c: Adjust.
> >
> > diff --git a/gcc/config/aarch64/aarch64-sve.md 
> > b/gcc/config/aarch64/aarch64-sve.md
> > index b8cc47ef5fc..4548375b8d6 100644
> > --- a/gcc/config/aarch64/aarch64-sve.md
> > +++ b/gcc/config/aarch64/aarch64-sve.md
> > @@ -2533,14 +2533,34 @@
> >  )
> >
> >  ;; Duplicate an Advanced SIMD vector to fill an SVE vector (LE version).
> > -(define_insn "@aarch64_vec_duplicate_vq_le"
> > -  [(set (match_operand:SVE_FULL 0 "register_operand" "=w")
> > +
> > +(define_insn_and_split "@aarch64_vec_duplicate_vq_le"
> > +  [(set (match_operand:SVE_FULL 0 "register_operand" "=w, w")
> >   (vec_duplicate:SVE_FULL
> > -   (match_operand: 1 "register_operand" "w")))]
> > +   (match_operand: 1 "aarch64_sve_dup_ld1rq_operand" "w, UtQ")))
> > +   (clobber (match_scratch:VNx16BI 2 "=X, Upl"))]
> >"TARGET_SVE && !BYTES_BIG_ENDIAN"
> >{
> > -operands[1] = gen_rtx_REG (mode, REGNO (operands[1]));
> > -return "dup\t%0.q, %1.q[0]";
> > +switch (which_alternative)
> > +  {
> > + case 0:
> > +   operands[1] = gen_rtx_REG (mode, REGNO (operands[1]));
> > +   return "dup\t%0.q, %1.q[0]";
> > + case 1:
> > +   return "#";
> > + default:
> > +   gcc_unreachable ();
> > +  }
> > +  }
> > +  "&& MEM_P (operands[1])"
> > +  [(const_int 0)]
> > +  {
> > +if (GET_CODE (operands[2]) == SCRATCH)
> > +  operands[2] = gen_reg_rtx (VNx16BImode);
> > +emit_move_insn (operands[2], CONSTM1_RTX (VNx16BImode));
> > +rtx gp = gen_lowpart (mode, operands[2]);
> > +emit_insn (gen_aarch64_sve_ld1rq (operands[0], operands[1], gp));
> > +DONE;
> >}
> >  )
> >
> > diff --git a/gcc/config/aarch64/predicates.md 
> > b/gcc/config/aarch64/predicates.md
> > index ff7f73d3f30..6062f37025e 100644
> > --- a/gcc/config/aarch64/predicates.md
> > +++ b/gcc/config/aarch64/predicates.md
> > @@ -676,6 +676,10 @@
> >(ior (match_operand 0 "register_operand")
> > (match_operand 0 "aarch64_sve_ld1r_operand")))
> >
> > +(define_predicate "aarch64_sve_dup_ld1rq_operand"
> > +  (ior (match_operand 0 "register_operand")
> > +   (match_operand 0 "aarch64_sve_ld1rq_operand")))
> > +
> >  (define_predicate "aarch64_sve_ptrue_svpattern_immediate"
> >(and (match_code "const")
> > (match_test "aarch64_sve_ptrue_svpattern_p (op, NULL)")))
> > diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr96463-2.c 
> > b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr96463-2.c
> > index 196de3f5e0a..c38204e6874 100644
> > --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr96463-2.c
> > +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr96463-2.c
> > @@ -26,4 +26,4 @@ TEST(svfloat64_t, float64_t, f64)
> >
> >  TEST(svbfloat16_t, bfloat16_t, bf16)
> >
> > -/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.q, z[0-9]+\.q\[0\]} 
> > 12 { target aarch64_little_endian } } } */
> > +/* { dg-final { scan-assembler-not {\tdup\t} } } */
>
> It would be good to add something like:
>
> /* { dg-final { scan-assembler-times {\tld1rq\t} 12 } } */
>
> (I assume it'll pass for both endiannesses, but please check!),
> in addition to the scan-assembler-not.
>
> OK with that change, thanks.
Thanks, committed the patch in
a3b99b84609af310c72b4d6221621f5b63a3c169 after adjusting the
test-case,
and verifying that we generate ld1rq for big endian targets, and
bootstrap+test on aarch64-linux-gnu.

Thanks,
Prathamesh
>
> Richard


[committed] libstdc++: Fix ostream insertion operators for calendar types

2023-01-14 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk.

-- >8 --

libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h (operator<<): Fix syntax errors.
* testsuite/std/time/month_day/io.cc: New test.
* testsuite/std/time/month_day_last/io.cc: New test.
* testsuite/std/time/month_weekday/io.cc: New test.
* testsuite/std/time/month_weekday_last/io.cc: New test.
* testsuite/std/time/weekday_indexed/io.cc: New test.
* testsuite/std/time/weekday_last/io.cc: New test.
* testsuite/std/time/year_month/io.cc: New test.
* testsuite/std/time/year_month_day_last/io.cc: New test.
* testsuite/std/time/year_month_weekday/io.cc: New test.
* testsuite/std/time/year_month_weekday_last/io.cc: New test.
---
 libstdc++-v3/include/bits/chrono_io.h | 20 -
 .../testsuite/std/time/month_day/io.cc| 30 +
 .../testsuite/std/time/month_day_last/io.cc   | 30 +
 .../testsuite/std/time/month_weekday/io.cc| 31 ++
 .../std/time/month_weekday_last/io.cc | 31 ++
 .../testsuite/std/time/weekday_indexed/io.cc  | 30 +
 .../testsuite/std/time/weekday_last/io.cc | 30 +
 .../testsuite/std/time/year_month/io.cc   | 30 +
 .../std/time/year_month_day_last/io.cc| 30 +
 .../std/time/year_month_weekday/io.cc | 42 +++
 .../std/time/year_month_weekday_last/io.cc| 38 +
 11 files changed, 332 insertions(+), 10 deletions(-)
 create mode 100644 libstdc++-v3/testsuite/std/time/month_day/io.cc
 create mode 100644 libstdc++-v3/testsuite/std/time/month_day_last/io.cc
 create mode 100644 libstdc++-v3/testsuite/std/time/month_weekday/io.cc
 create mode 100644 libstdc++-v3/testsuite/std/time/month_weekday_last/io.cc
 create mode 100644 libstdc++-v3/testsuite/std/time/weekday_indexed/io.cc
 create mode 100644 libstdc++-v3/testsuite/std/time/weekday_last/io.cc
 create mode 100644 libstdc++-v3/testsuite/std/time/year_month/io.cc
 create mode 100644 libstdc++-v3/testsuite/std/time/year_month_day_last/io.cc
 create mode 100644 libstdc++-v3/testsuite/std/time/year_month_weekday/io.cc
 create mode 100644 
libstdc++-v3/testsuite/std/time/year_month_weekday_last/io.cc

diff --git a/libstdc++-v3/include/bits/chrono_io.h 
b/libstdc++-v3/include/bits/chrono_io.h
index 4e53cd4aa2e..87caa30b83a 100644
--- a/libstdc++-v3/include/bits/chrono_io.h
+++ b/libstdc++-v3/include/bits/chrono_io.h
@@ -2134,7 +2134,7 @@ namespace chrono
   // either "{:L}[{}]" or "{:L}[{} is not a valid index]". The {:L} spec
   // means to format the weekday using ostringstream, so just do that.
   basic_stringstream<_CharT> __os2;
-  __os2.imbue(__os.getloc);
+  __os2.imbue(__os.getloc());
   __os2 << __wdi.weekday();
   const auto __i = __wdi.index();
   if constexpr (is_same_v<_CharT, char>)
@@ -2157,7 +2157,7 @@ namespace chrono
 {
   // As above, just write straight to a stringstream, as if by "{:L}[last]"
   basic_stringstream<_CharT> __os2;
-  __os2.imbue(__os.getloc);
+  __os2.imbue(__os.getloc());
   __os2 << __wdl.weekday() << _GLIBCXX_WIDEN("[last]");
   __os << __os2.view();
   return __os;
@@ -2169,7 +2169,7 @@ namespace chrono
 {
   // As above, just write straight to a stringstream, as if by "{:L}/{}"
   basic_stringstream<_CharT> __os2;
-  __os2.imbue(__os.getloc);
+  __os2.imbue(__os.getloc());
   __os2 << __md.month();
   if constexpr (is_same_v<_CharT, char>)
__os2 << '/';
@@ -2189,7 +2189,7 @@ namespace chrono
 {
   // As above, just write straight to a stringstream, as if by "{:L}/last"
   basic_stringstream<_CharT> __os2;
-  __os2.imbue(__os.getloc);
+  __os2.imbue(__os.getloc());
   __os2 << __mdl.month();
   if constexpr (is_same_v<_CharT, char>)
__os2 << "/last";
@@ -2206,7 +2206,7 @@ namespace chrono
 {
   // As above, just write straight to a stringstream, as if by "{:L}/{:L}"
   basic_stringstream<_CharT> __os2;
-  __os2.imbue(__os.getloc);
+  __os2.imbue(__os.getloc());
   __os2 << __mwd.month();
   if constexpr (is_same_v<_CharT, char>)
__os2 << '/';
@@ -2224,7 +2224,7 @@ namespace chrono
 {
   // As above, just write straight to a stringstream, as if by "{:L}/{:L}"
   basic_stringstream<_CharT> __os2;
-  __os2.imbue(__os.getloc);
+  __os2.imbue(__os.getloc());
   __os2 << __mwdl.month();
   if constexpr (is_same_v<_CharT, char>)
__os2 << '/';
@@ -2241,7 +2241,7 @@ namespace chrono
 {
   // As above, just write straight to a stringstream, as if by "{}/{:L}"
   basic_stringstream<_CharT> __os2;
-  __os2.imbue(__os.getloc);
+  __os2.imbue(__os.getloc());
   __os2 << __ym.year();
   if constexpr (is_same_v<_CharT, char>)
__os2 << '/';
@@ -2277,7 +2277,7 @@ namespace chrono
 {
   

Re: [PATCH 2/3] rs6000: Delete PRE_GCC3_DWARF_FRAME_REGISTERS

2023-01-14 Thread Jakub Jelinek via Gcc-patches
On Sat, Jan 14, 2023 at 07:38:37AM -0600, Segher Boessenkool wrote:
> Hi!
> 
> On Fri, Jan 13, 2023 at 07:05:34PM +0100, Jakub Jelinek wrote:
> > On Mon, May 06, 2019 at 09:55:50PM +, Segher Boessenkool wrote:
> > > We don't need this.
> > > 
> > > 
> > > Segher
> > > 
> > > 
> > > 2019-05-06  Segher Boessenkool  
> > > 
> > >   * config/rs6000/rs6000.h (PRE_GCC3_DWARF_FRAME_REGISTERS): Delete.
> > 
> > Why do you think so?
> 
> First off, this was three years ago, and no problems have shown up.

It is true that there aren't that many users of GCC 2.x compiled binaries
around.

> > This seems to be a clear ABI break to me in the __frame_state_for
> > API.
> > So, if a __frame_state_for caller calls the function, it will overflow
> > the buffer passed by the caller.
> 
> 77 <= 111 so how can this overflow where it didn't before?

typedef struct frame_state
{
  void *cfa;
  void *eh_ptr;
  long cfa_offset;
  long args_size;
  long reg_or_offset[PRE_GCC3_DWARF_FRAME_REGISTERS+1];
  unsigned short cfa_reg;
  unsigned short retaddr_column;
  char saved[PRE_GCC3_DWARF_FRAME_REGISTERS+1];
} frame_state;

struct frame_state * __frame_state_for (void *, struct frame_state *);

Unlike the new unwinder stuff, __frame_state_for can be called from other
objects, it is exported from both libgcc (on some architectures, including
ppc, ppc64 and ppc64le) and from glibc (on some architectures, including ppc
and i386, but not ppc64 nor ppc64le).
PRE_GCC3_DWARF_FRAME_REGISTERS defaults to __LIBGCC_DWARF_FRAME_REGISTERS__,
which is initialized to DWARF_FRAME_REGISTERS (if not defined, it is
FIRST_PSEUDO_REGISTER).
So, if PRE_GCC3_DWARF_FRAME_REGISTERS was previously defined to 77 and
now is not, the layout of the above structure changed, and if something
calls __frame_state_for with the layout of the structure with 77
registers, then it will not work properly if you get 111 instead.

In the GCC 2.x code, __frame_state_for was defined in gcc/frame.c
(libgcc.a(frame.o), while it was used in libgcc2.c if L_eh was defined
(so libgcc.a(_eh.o)) and the libgcc.a vs. libgcc_eh.a split wasn't present
yet, so parts of the unwinder could be exported from one shared library and
consumed by another one etc.  Depending on what is picked for
__frame_state_for, this can lead to ABI issues (in particular if the
libgcc_s.so.1 version is).
New code doesn't call __frame_state_for, it is there solely for
backwards compatibility.  So, even when GCC 10/11/12 had it broken,
there is no reason not to fix it in 13 and perhaps backport to all release
branches.

glibc sources have:
./sysdeps/sh/gccframe.h:#define DWARF_FRAME_REGISTERS 49
./sysdeps/i386/gccframe.h:#define DWARF_FRAME_REGISTERS 17
./sysdeps/powerpc/gccframe.h:#define DWARF_FRAME_REGISTERS 77
./sysdeps/hppa/gccframe.h:#define DWARF_FRAME_REGISTERS 89
On the GCC side compared to the above:
gcc/config/sh/sh.h:#define DWARF_FRAME_REGISTERS (153)
gcc/config/i386/i386.h:#define DWARF_FRAME_REGISTERS 17
gcc/config/rs6000/rs6000.h:#define FIRST_PSEUDO_REGISTER 111
gcc/config/pa/pa.h:#define DWARF_FRAME_REGISTERS (FIRST_PSEUDO_REGISTER - 1)
gcc/config/pa/pa32-regs.h:#define FIRST_PSEUDO_REGISTER 90  /* 32 general regs 
+ 56 fp regs +
gcc/config/pa/pa64-regs.h:#define FIRST_PSEUDO_REGISTER 62  /* 32 general regs 
+ 28 fp regs +

So, when PRE_GCC3_DWARF_FRAME_REGISTERS was defined on rs6000, it matched
glibc on all arches but sh (I have no idea about sh and don't really care).
I assume for 64-bit pa __frame_state_for isn't exported from glibc.

Jakub



Re: [PATCH 2/3] rs6000: Delete PRE_GCC3_DWARF_FRAME_REGISTERS

2023-01-14 Thread Segher Boessenkool
Hi!

On Fri, Jan 13, 2023 at 07:05:34PM +0100, Jakub Jelinek wrote:
> On Mon, May 06, 2019 at 09:55:50PM +, Segher Boessenkool wrote:
> > We don't need this.
> > 
> > 
> > Segher
> > 
> > 
> > 2019-05-06  Segher Boessenkool  
> > 
> > * config/rs6000/rs6000.h (PRE_GCC3_DWARF_FRAME_REGISTERS): Delete.
> 
> Why do you think so?

First off, this was three years ago, and no problems have shown up.

> This seems to be a clear ABI break to me in the __frame_state_for
> API.
> So, if a __frame_state_for caller calls the function, it will overflow
> the buffer passed by the caller.

77 <= 111 so how can this overflow where it didn't before?

> > -/* This must be included for pre gcc 3.0 glibc compatibility.  */
> > -#define PRE_GCC3_DWARF_FRAME_REGISTERS 77

=== unwind-dw2.c
/* Dwarf frame registers used for pre gcc 3.0 compiled glibc.  */
#ifndef PRE_GCC3_DWARF_FRAME_REGISTERS
#define PRE_GCC3_DWARF_FRAME_REGISTERS __LIBGCC_DWARF_FRAME_REGISTERS__
#endif

=== c-family/c-cppbuiltin.cc
  builtin_define_with_int_value ("__LIBGCC_DWARF_FRAME_REGISTERS__",
 DWARF_FRAME_REGISTERS);


(Btw, we used many dwarf reg numbers > 1000 for a long time.)


Segher


[PR106746] drop cselib addr lookup in debug insn mem

2023-01-14 Thread Alexandre Oliva via Gcc-patches


The testcase used to get scheduled differently depending on the
presence of debug insns with MEMs.  It's not clear to me why those
MEMs affected scheduling, but the cselib pre-canonicalization of the
MEM address is not used at all when analyzing debug insns, so the
memory allocation and lookup are pure waste.  Somehow, avoiding that
waste fixes the problem, or makes it go latent.

Regstrapped on x86_64-linux-gnu.  Ok to install?


for  gcc/ChangeLog

PR debug/106746
* sched-deps.cc (sched_analyze_2): Skip cselib address lookup
within debug insns.

for  gcc/testsuite/ChangeLog

PR debug/106746
* gcc.dg/target/i386/pr106746.c: New.
---
 gcc/sched-deps.cc|   36 +++---
 gcc/testsuite/gcc.target/i386/pr106746.c |   29 
 2 files changed, 47 insertions(+), 18 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr106746.c

diff --git a/gcc/sched-deps.cc b/gcc/sched-deps.cc
index f9371b81fb41e..a9214f674329a 100644
--- a/gcc/sched-deps.cc
+++ b/gcc/sched-deps.cc
@@ -2605,26 +2605,26 @@ sched_analyze_2 (class deps_desc *deps, rtx x, rtx_insn 
*insn)
 
 case MEM:
   {
-   /* Reading memory.  */
-   rtx_insn_list *u;
-   rtx_insn_list *pending;
-   rtx_expr_list *pending_mem;
-   rtx t = x;
-
-   if (sched_deps_info->use_cselib)
- {
-   machine_mode address_mode = get_address_mode (t);
-
-   t = shallow_copy_rtx (t);
-   cselib_lookup_from_insn (XEXP (t, 0), address_mode, 1,
-GET_MODE (t), insn);
-   XEXP (t, 0)
- = cselib_subst_to_values_from_insn (XEXP (t, 0), GET_MODE (t),
- insn);
- }
-
if (!DEBUG_INSN_P (insn))
  {
+   /* Reading memory.  */
+   rtx_insn_list *u;
+   rtx_insn_list *pending;
+   rtx_expr_list *pending_mem;
+   rtx t = x;
+
+   if (sched_deps_info->use_cselib)
+ {
+   machine_mode address_mode = get_address_mode (t);
+
+   t = shallow_copy_rtx (t);
+   cselib_lookup_from_insn (XEXP (t, 0), address_mode, 1,
+GET_MODE (t), insn);
+   XEXP (t, 0)
+ = cselib_subst_to_values_from_insn (XEXP (t, 0), GET_MODE (t),
+ insn);
+ }
+
t = canon_rtx (t);
pending = deps->pending_read_insns;
pending_mem = deps->pending_read_mems;
diff --git a/gcc/testsuite/gcc.target/i386/pr106746.c 
b/gcc/testsuite/gcc.target/i386/pr106746.c
new file mode 100644
index 0..14f7dab71d691
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr106746.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fsched2-use-superblocks -fcompare-debug -Wno-psabi" } */
+
+typedef char __attribute__((__vector_size__ (64))) U;
+typedef short __attribute__((__vector_size__ (64))) V;
+typedef int __attribute__((__vector_size__ (64))) W;
+
+char c;
+U a;
+U *r;
+W foo0_v512u32_0;
+
+void
+foo (W)
+{
+  U u;
+  V v;
+  W w = __builtin_shuffle (foo0_v512u32_0, foo0_v512u32_0);
+  u =
+__builtin_shufflevector (a, u, 3, 0, 4, 9, 9, 6, 7, 8, 5,
+0, 6, 1, 8, 1, 2, 8, 6,
+1, 8, 4, 9, 3, 8, 4, 6, 0, 9, 0, 1, 8, 2, 3, 3,
+0, 4, 9, 9, 6, 7, 8, 5,
+0, 6, 1, 8, 1, 2, 8, 6,
+1, 8, 4, 9, 3, 8, 4, 6, 0, 9, 0, 1, 8, 2, 3);
+  v *= c;
+  w &= c;
+  *r = (U) v + (U) w;
+}


-- 
Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/
   Free Software Activist   GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about 


[PATCH] modula-2: Fix stack size request in initPreemptive [PR108405]

2023-01-14 Thread Iain Sandoe via Gcc-patches
Given that, currently, this value is not configurable per target the
short-term solution is to avoid a bad request.

Tested on x86_64-darwin21, OK for trunk?
thanks
Iain

--- 8< ---

As noted in the PR, the problem is that we make a request for additional
stack that violates the constraints on some systems.

This patch chooses a value that is divisible by common OS page sizes.

TODO: the user value should be checked and then an exception thrown if it
is not suitable.

Signed-off-by: Iain Sandoe 

PR modula2/108405

gcc/m2/ChangeLog:

* gm2-libs-iso/Preemptive.mod (initPreemptive): Use a value for
extra space that is divisible by common OS pagesizes.
---
 gcc/m2/gm2-libs-iso/Preemptive.mod | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/m2/gm2-libs-iso/Preemptive.mod 
b/gcc/m2/gm2-libs-iso/Preemptive.mod
index 59940b6bae8..e747028d5be 100644
--- a/gcc/m2/gm2-libs-iso/Preemptive.mod
+++ b/gcc/m2/gm2-libs-iso/Preemptive.mod
@@ -33,6 +33,9 @@ FROM libc IMPORT printf ;
 
 CONST
debugging = FALSE ;
+   (* The space we request becomes part of a stack request, which generally
+  has constraints on size and alignment.  *)
+   extraWorkSpace = 10 * 1024 * 1024 ;
 
 (*
timer - the timer process which runs at maximum scheduling priority with
@@ -107,7 +110,7 @@ BEGIN
IF NOT init
THEN
   init := TRUE ;
-  Create (timer, 1000, MAX (Urgency), NIL, timerId) ;
+  Create (timer, extraWorkSpace, MAX (Urgency), NIL, timerId) ;
   Activate (timerId)
END
 END initPreemptive ;
-- 
2.37.1 (Apple Git-137.1)