[PATCH] libstdc++: Update Solaris baselines for GCC 14.0

2024-04-29 Thread Rainer Orth
This patch updates the Solaris baselines for the GLIBCXX_3.4.33 version
added in GCC 14.0.

Tested on i386-pc-solaris2.11 and sparc-sun-solaris2.11 (32 and 64-bit
each), together with the GLIBCXX_3.4.32 update, on both gcc-14 branch
and trunk.

Ok for and gcc-14 branch and trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-04-28  Rainer Orth  

libstdc++-v3:
* config/abi/post/i386-solaris/baseline_symbols.txt: Regenerate.
* config/abi/post/i386-solaris/amd64/baseline_symbols.txt:
Likewise.
* config/abi/post/sparc-solaris/baseline_symbols.txt: Likewise.
* config/abi/post/sparc-solaris/sparcv9/baseline_symbols.txt:
Likewise.

# HG changeset patch
# Parent  4232f168006d992630395835612adee6a8a72636
libstdc++: Update Solaris baselines for GCC 14.0

diff --git a/libstdc++-v3/config/abi/post/i386-solaris/amd64/baseline_symbols.txt b/libstdc++-v3/config/abi/post/i386-solaris/amd64/baseline_symbols.txt
--- a/libstdc++-v3/config/abi/post/i386-solaris/amd64/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/i386-solaris/amd64/baseline_symbols.txt
@@ -488,6 +488,7 @@ FUNC:_ZNKSt11__timepunctIwE7_M_daysEPPKw
 FUNC:_ZNKSt11__timepunctIwE8_M_am_pmEPPKw@@GLIBCXX_3.4
 FUNC:_ZNKSt11__timepunctIwE9_M_monthsEPPKw@@GLIBCXX_3.4
 FUNC:_ZNKSt11logic_error4whatEv@@GLIBCXX_3.4
+FUNC:_ZNKSt12__basic_fileIcE13native_handleEv@@GLIBCXX_3.4.33
 FUNC:_ZNKSt12__basic_fileIcE7is_openEv@@GLIBCXX_3.4
 FUNC:_ZNKSt12__shared_ptrINSt10filesystem28recursive_directory_iterator10_Dir_stackELN9__gnu_cxx12_Lock_policyE2EEcvbEv@@GLIBCXX_3.4.31
 FUNC:_ZNKSt12__shared_ptrINSt10filesystem4_DirELN9__gnu_cxx12_Lock_policyE2EEcvbEv@@GLIBCXX_3.4.31
@@ -4487,6 +4488,7 @@ FUNC:__cxa_allocate_exception@@CXXABI_1.
 FUNC:__cxa_bad_cast@@CXXABI_1.3
 FUNC:__cxa_bad_typeid@@CXXABI_1.3
 FUNC:__cxa_begin_catch@@CXXABI_1.3
+FUNC:__cxa_call_terminate@@CXXABI_1.3.15
 FUNC:__cxa_call_unexpected@@CXXABI_1.3
 FUNC:__cxa_current_exception_type@@CXXABI_1.3
 FUNC:__cxa_deleted_virtual@@CXXABI_1.3.6
@@ -4530,6 +4532,7 @@ OBJECT:0:CXXABI_1.3.11
 OBJECT:0:CXXABI_1.3.12
 OBJECT:0:CXXABI_1.3.13
 OBJECT:0:CXXABI_1.3.14
+OBJECT:0:CXXABI_1.3.15
 OBJECT:0:CXXABI_1.3.2
 OBJECT:0:CXXABI_1.3.3
 OBJECT:0:CXXABI_1.3.4
@@ -4567,6 +4570,7 @@ OBJECT:0:GLIBCXX_3.4.3
 OBJECT:0:GLIBCXX_3.4.30
 OBJECT:0:GLIBCXX_3.4.31
 OBJECT:0:GLIBCXX_3.4.32
+OBJECT:0:GLIBCXX_3.4.33
 OBJECT:0:GLIBCXX_3.4.4
 OBJECT:0:GLIBCXX_3.4.5
 OBJECT:0:GLIBCXX_3.4.6
diff --git a/libstdc++-v3/config/abi/post/i386-solaris/baseline_symbols.txt b/libstdc++-v3/config/abi/post/i386-solaris/baseline_symbols.txt
--- a/libstdc++-v3/config/abi/post/i386-solaris/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/i386-solaris/baseline_symbols.txt
@@ -488,6 +488,7 @@ FUNC:_ZNKSt11__timepunctIwE7_M_daysEPPKw
 FUNC:_ZNKSt11__timepunctIwE8_M_am_pmEPPKw@@GLIBCXX_3.4
 FUNC:_ZNKSt11__timepunctIwE9_M_monthsEPPKw@@GLIBCXX_3.4
 FUNC:_ZNKSt11logic_error4whatEv@@GLIBCXX_3.4
+FUNC:_ZNKSt12__basic_fileIcE13native_handleEv@@GLIBCXX_3.4.33
 FUNC:_ZNKSt12__basic_fileIcE7is_openEv@@GLIBCXX_3.4
 FUNC:_ZNKSt12__shared_ptrINSt10filesystem28recursive_directory_iterator10_Dir_stackELN9__gnu_cxx12_Lock_policyE2EEcvbEv@@GLIBCXX_3.4.31
 FUNC:_ZNKSt12__shared_ptrINSt10filesystem4_DirELN9__gnu_cxx12_Lock_policyE2EEcvbEv@@GLIBCXX_3.4.31
@@ -4487,6 +4488,7 @@ FUNC:__cxa_allocate_exception@@CXXABI_1.
 FUNC:__cxa_bad_cast@@CXXABI_1.3
 FUNC:__cxa_bad_typeid@@CXXABI_1.3
 FUNC:__cxa_begin_catch@@CXXABI_1.3
+FUNC:__cxa_call_terminate@@CXXABI_1.3.15
 FUNC:__cxa_call_unexpected@@CXXABI_1.3
 FUNC:__cxa_current_exception_type@@CXXABI_1.3
 FUNC:__cxa_deleted_virtual@@CXXABI_1.3.6
@@ -4530,6 +4532,7 @@ OBJECT:0:CXXABI_1.3.11
 OBJECT:0:CXXABI_1.3.12
 OBJECT:0:CXXABI_1.3.13
 OBJECT:0:CXXABI_1.3.14
+OBJECT:0:CXXABI_1.3.15
 OBJECT:0:CXXABI_1.3.2
 OBJECT:0:CXXABI_1.3.3
 OBJECT:0:CXXABI_1.3.4
@@ -4567,6 +4570,7 @@ OBJECT:0:GLIBCXX_3.4.3
 OBJECT:0:GLIBCXX_3.4.30
 OBJECT:0:GLIBCXX_3.4.31
 OBJECT:0:GLIBCXX_3.4.32
+OBJECT:0:GLIBCXX_3.4.33
 OBJECT:0:GLIBCXX_3.4.4
 OBJECT:0:GLIBCXX_3.4.5
 OBJECT:0:GLIBCXX_3.4.6
diff --git a/libstdc++-v3/config/abi/post/sparc-solaris/baseline_symbols.txt b/libstdc++-v3/config/abi/post/sparc-solaris/baseline_symbols.txt
--- a/libstdc++-v3/config/abi/post/sparc-solaris/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/sparc-solaris/baseline_symbols.txt
@@ -488,6 +488,7 @@ FUNC:_ZNKSt11__timepunctIwE7_M_daysEPPKw
 FUNC:_ZNKSt11__timepunctIwE8_M_am_pmEPPKw@@GLIBCXX_3.4
 FUNC:_ZNKSt11__timepunctIwE9_M_monthsEPPKw@@GLIBCXX_3.4
 FUNC:_ZNKSt11logic_error4whatEv@@GLIBCXX_3.4
+FUNC:_ZNKSt12__basic_fileIcE13native_handleEv@@GLIBCXX_3.4.33
 FUNC:_ZNKSt12__basic_fileIcE7is_openEv@@GLIBCXX_3.4
 FUNC:_ZNKSt12__shared_ptrINSt10filesystem28recursive_directory_iterator10_Dir_stackELN9__gnu_cxx12_Lock_policyE2EEcvbEv@@GLIBCXX_3.4.31
 FUNC

[PATCH] libstdc++: Update Solaris baselines for GCC 13.2

2024-04-29 Thread Rainer Orth
This patch updates the Solaris baselines for the GLIBCXX_3.4.32 version
added in GCC 13.2.

Tested on i386-pc-solaris2.11 and sparc-sun-solaris2.11 (32 and 64-bit
each) on the gcc-13 branch and (together with the GLIBCXX_3.4.33 update)
on both gcc-14 branch and trunk.

Ok for all of gcc-13 and gcc-14 branches and trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-04-28  Rainer Orth  

libstdc++-v3:
* config/abi/post/i386-solaris/baseline_symbols.txt: Regenerate.
* config/abi/post/i386-solaris/amd64/baseline_symbols.txt:
Likewise.
* config/abi/post/sparc-solaris/baseline_symbols.txt: Likewise.
* config/abi/post/sparc-solaris/sparcv9/baseline_symbols.txt:
Likewise.

# HG changeset patch
# Parent  dd18a74d3c5f8539cec05a9394d14e209474ab64
libstdc++: Update Solaris baselines for GCC 13.2

diff --git a/libstdc++-v3/config/abi/post/i386-solaris/amd64/baseline_symbols.txt b/libstdc++-v3/config/abi/post/i386-solaris/amd64/baseline_symbols.txt
--- a/libstdc++-v3/config/abi/post/i386-solaris/amd64/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/i386-solaris/amd64/baseline_symbols.txt
@@ -3175,6 +3175,7 @@ FUNC:_ZNSt7__cxx1112basic_stringIcSt11ch
 FUNC:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm@@GLIBCXX_3.4.21
 FUNC:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_S_compareEmm@@GLIBCXX_3.4.21
 FUNC:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_capacityEm@@GLIBCXX_3.4.21
+FUNC:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_S_allocateERS3_m@@GLIBCXX_3.4.32
 FUNC:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderC1EPcOS3_@@GLIBCXX_3.4.23
 FUNC:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderC1EPcRKS3_@@GLIBCXX_3.4.21
 FUNC:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderC2EPcOS3_@@GLIBCXX_3.4.23
@@ -3327,6 +3328,7 @@ FUNC:_ZNSt7__cxx1112basic_stringIwSt11ch
 FUNC:_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE10_M_replaceEmmPKwm@@GLIBCXX_3.4.21
 FUNC:_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE10_S_compareEmm@@GLIBCXX_3.4.21
 FUNC:_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE11_M_capacityEm@@GLIBCXX_3.4.21
+FUNC:_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE11_S_allocateERS3_m@@GLIBCXX_3.4.32
 FUNC:_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE12_Alloc_hiderC1EPwOS3_@@GLIBCXX_3.4.23
 FUNC:_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE12_Alloc_hiderC1EPwRKS3_@@GLIBCXX_3.4.21
 FUNC:_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE12_Alloc_hiderC2EPwOS3_@@GLIBCXX_3.4.23
@@ -4564,6 +4566,7 @@ OBJECT:0:GLIBCXX_3.4.29
 OBJECT:0:GLIBCXX_3.4.3
 OBJECT:0:GLIBCXX_3.4.30
 OBJECT:0:GLIBCXX_3.4.31
+OBJECT:0:GLIBCXX_3.4.32
 OBJECT:0:GLIBCXX_3.4.4
 OBJECT:0:GLIBCXX_3.4.5
 OBJECT:0:GLIBCXX_3.4.6
diff --git a/libstdc++-v3/config/abi/post/i386-solaris/baseline_symbols.txt b/libstdc++-v3/config/abi/post/i386-solaris/baseline_symbols.txt
--- a/libstdc++-v3/config/abi/post/i386-solaris/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/i386-solaris/baseline_symbols.txt
@@ -3175,6 +3175,7 @@ FUNC:_ZNSt7__cxx1112basic_stringIcSt11ch
 FUNC:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEjjPKcj@@GLIBCXX_3.4.21
 FUNC:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_S_compareEjj@@GLIBCXX_3.4.21
 FUNC:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_capacityEj@@GLIBCXX_3.4.21
+FUNC:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_S_allocateERS3_j@@GLIBCXX_3.4.32
 FUNC:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderC1EPcOS3_@@GLIBCXX_3.4.23
 FUNC:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderC1EPcRKS3_@@GLIBCXX_3.4.21
 FUNC:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderC2EPcOS3_@@GLIBCXX_3.4.23
@@ -3327,6 +3328,7 @@ FUNC:_ZNSt7__cxx1112basic_stringIwSt11ch
 FUNC:_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE10_M_replaceEjjPKwj@@GLIBCXX_3.4.21
 FUNC:_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE10_S_compareEjj@@GLIBCXX_3.4.21
 FUNC:_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE11_M_capacityEj@@GLIBCXX_3.4.21
+FUNC:_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE11_S_allocateERS3_j@@GLIBCXX_3.4.32
 FUNC:_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE12_Alloc_hiderC1EPwOS3_@@GLIBCXX_3.4.23
 FUNC:_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE12_Alloc_hiderC1EPwRKS3_@@GLIBCXX_3.4.21
 FUNC:_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE12_Alloc_hiderC2EPwOS3_@@GLIBCXX_3.4.23
@@ -4564,6 +4566,7 @@ OBJECT:0:GLIBCXX_3.4.29
 OBJECT:0:GLIBCXX_3.4.3
 OBJECT:0:GLIBCXX_3.4.30
 OBJECT:0:GLIBCXX_3.4.31
+OBJECT:0:GLIBCXX_3.4.32
 OBJECT:0:GLIBCXX_3.4.4
 OBJECT:0:GLIBCXX_3.4.5
 OBJECT:0:GLIBCXX_3.4.6
diff --git a/libstdc++-v3/config/abi/post/sparc-solaris/baseline_symbols.txt

[PATCH] libbacktrace: Avoid GNU ld --compress-debug-sections=zlib-gabi

2024-04-23 Thread Rainer Orth
I noticed that libbacktrace make check FAILs on Solaris with the native
ld already when building the tests:

libtool: link: /var/gcc/regression/master/11.4-gcc/build/./gcc/xgcc -B/var/gcc/r
egression/master/11.4-gcc/build/./gcc/ -B/vol/gcc/sparc-sun-solaris2.11/bin/ -B/
vol/gcc/sparc-sun-solaris2.11/lib/ -isystem /vol/gcc/sparc-sun-solaris2.11/inclu
de -isystem /vol/gcc/sparc-sun-solaris2.11/sys-include -fchecking=1 -funwind-tab
les -frandom-seed=ctesta_alloc -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmi
ssing-prototypes -Wold-style-definition -Wmissing-format-attribute -Wcast-qual -
Werror -g -g -O2 -Wl,--compress-debug-sections=zlib-gabi -o ctesta_alloc ctesta_
alloc-btest.o ctesta_alloc-testlib.o  ./.libs/libbacktrace_alloc.a
ld: fatal: unrecognized '--compress-debug-sections' cmp-type: zlib-gabi
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:1379: ctesta_alloc] Error 1

Solaris ld only supports --compress-debug-sections=zlib, while GNU ld
allows zlib-gabi as an alias for zlib.  gold is the same, it seems,
while lld doesn't support zlib-gabi at all.

Therefore the patch uses zlib instead.

Tested on i386-pc-solaris2.11 with ld and gld and x86_64-pc-linux-gnu
with gld.

With this patch, libbacktrace make check PASSes on Solaris.
Unfortunately, this is quite easy to miss since the make check output
isn't in DejaGnu summary format, thus not picked up by make
mail-report.log.  I mean to adapt the libgo support to produce that
output format for libbacktrace to fix this.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-04-05  Rainer Orth  

libbacktrace:
* Makefile.am (ctestg_LDFLAGS): Use
-Wl,--compress-debug-sections=zlib instead of zlib-gabi.
(ctesta_LDFLAGS): Likewise.
* Makefile.in: Regenerate.

# HG changeset patch
# Parent  3f974c85f19c90c967e272a1ca6523b897cc175f
libbacktrace: Avoid GNU ld --compress-debug-sections=zlib-gabi

diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am
--- a/libbacktrace/Makefile.am
+++ b/libbacktrace/Makefile.am
@@ -497,12 +497,12 @@ if HAVE_COMPRESSED_DEBUG
 
 ctestg_SOURCES = btest.c testlib.c
 ctestg_CFLAGS = $(libbacktrace_TEST_CFLAGS)
-ctestg_LDFLAGS = -Wl,--compress-debug-sections=zlib-gnu $(libbacktrace_testing_ldflags)
+ctestg_LDFLAGS = -Wl,--compress-debug-sections=zlib $(libbacktrace_testing_ldflags)
 ctestg_LDADD = libbacktrace.la
 
 ctesta_SOURCES = btest.c testlib.c
 ctesta_CFLAGS = $(libbacktrace_TEST_CFLAGS)
-ctesta_LDFLAGS = -Wl,--compress-debug-sections=zlib-gabi $(libbacktrace_testing_ldflags)
+ctesta_LDFLAGS = -Wl,--compress-debug-sections=zlib $(libbacktrace_testing_ldflags)
 ctesta_LDADD = libbacktrace.la
 
 BUILDTESTS += ctestg ctesta
diff --git a/libbacktrace/Makefile.in b/libbacktrace/Makefile.in
--- a/libbacktrace/Makefile.in
+++ b/libbacktrace/Makefile.in
@@ -1177,11 +1177,11 @@ libbacktrace_testing_ldflags = -no-insta
 @HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ttest_alloc_LDADD = libbacktrace_alloc.la
 @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctestg_SOURCES = btest.c testlib.c
 @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctestg_CFLAGS = $(libbacktrace_TEST_CFLAGS)
-@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctestg_LDFLAGS = -Wl,--compress-debug-sections=zlib-gnu $(libbacktrace_testing_ldflags)
+@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctestg_LDFLAGS = -Wl,--compress-debug-sections=zlib $(libbacktrace_testing_ldflags)
 @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctestg_LDADD = libbacktrace.la
 @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctesta_SOURCES = btest.c testlib.c
 @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctesta_CFLAGS = $(libbacktrace_TEST_CFLAGS)
-@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctesta_LDFLAGS = -Wl,--compress-debug-sections=zlib-gabi $(libbacktrace_testing_ldflags)
+@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctesta_LDFLAGS = -Wl,--compress-debug-sections=zlib $(libbacktrace_testing_ldflags)
 @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctesta_LDADD = libbacktrace.la
 @HAVE_COMPRESSED_DEBUG_TRUE@@HAVE_COMPRESSED_DEBUG_ZSTD_TRUE@@NATIVE_TRUE@ctestzstd_SOURCES = btest.c testlib.c
 @HAVE_COMPRESSED_DEBUG_TRUE@@HAVE_COMPRESSED_DEBUG_ZSTD_TRUE@@NATIVE_TRUE@ctestzstd_CFLAGS = $(libbacktrace_TEST_CFLAGS)


Re: [PATCH] build: Check for cargo when building rust language

2024-04-23 Thread Rainer Orth
Hi Arthur,

> On 4/17/24 10:13, Rainer Orth wrote:
>> Andrew Pinski  writes:
>> 
>>> On Mon, Apr 8, 2024 at 9:39 AM  wrote:
>>>>
>>>> From: Pierre-Emmanuel Patry 
>>>>
>>>> Hello,
>>>>
>>>> The rust frontend requires cargo to build some of it's components,
>>>> it's presence was not checked during configuration.
>>>
>>> WHY did this go in right before the release of GCC 14?
>>> I don't get why this is considered temporary and it goes in right
>>> before a release.
>>> That seems broken to me.
>> two more questions about this:
>> Right now, the new cargo configure test disable rust on all of my
>> targets (Solaris, Linux, Darwin) which didn't have it installed.  Before
>> (as recent as last Friday), I could successfully build and test
>> crab1/rust on all of them without cargo in sight.  So I wonder if the
>> patch isn't premature.
>
> We already have components depending on Rust libraries in our development
> repository, so this patch is important to ensure errors are emitted early
> during the configure phase rather than later at build time. I don't think
> this is premature, considering that your targets would fail to build the
> Rust frontend next time we upstream commits, which should happen this week
> or early next week.

it would have been very helpful to state this up front: introducing a
dependency that's never used outside of a configure test right night is
still damn confusing.  An alternative might have been to commit this
patch shortly before it's actually used.

>> Besides, while there are packaged versions of cargo for Solaris 11.4 and
>> Linux, Darwin hasn't anything (not checked Homebrew or similar yet).
>> What's worse, rustup only supports macOS 10.12 and up, while I'm still
>> regularly testing 10.7 and 10.11.  I don't really feel like building
>> rust from source here (if it works at all).  This hasn't been an issue
>> for any other languages that require additional tools for bootstrapping
>> (like Ada or D): there are versions of GNAT around that still support
>> those old Darwin releases, and I could use the C++ version of GDC in GCC
>> 11.
>
> Sorry, I'm not too familiar with the Rust situation on macOS. I am reading
> that starting from Rust version 1.74, the minimum macOS version required is
> indeed 10.12, released in 2016 I believe?
>
> We currently depend on Rust version 1.72, so you should be able to install
> it on macOS 10.11. Maybe with rustup? You can try something like the
> following:
>
> curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
> --default-toolchain=1.72.0;

I tried this with mixed success: while the part of the installation that
goes into $RUSTUP_HOME at least can run cargo --version on both 10.7
and 10.11, the other one (for $CARGO_HOME) dies with SIGILL on 10.7
trying the same.

However, when I ignore most of what's installed by rustup and point
$PATH at .../toolchains/1.72.0-x86_64-apple-darwin/bin, I can run the
cargo in there with --version even on 10.7.  For the moment, that's good
enough to get a trunk build/test with rust including working again, but
of course this doesn't prove that this will remain so once cargo is
actually used.

> which is the default installation method for Rustup, with version 1.72 of
> the language specified. I'm not able to test this, sorry, but I'm very
> interested in knowing if it works. I think you can also install Rust using
> Homebrew, but again I am not able to test this and apologize.

I'll go down this route (or try installing rust from source) only if
need be.

> The goal is to reduce that Rust version further soon anyway - we are going
> to target Rust version 1.49, released 3 years ago, as that is the version
> that gccrs aims to compile. This will bring us closer to compiling our
> dependencies with our own frontend.

Good.  At least knowing this it's easier to check what macOS versions
are supported by e.g. 1.49.

>> At the very least, the Rust situation needs to be documented clearly.
>
> I'd love to work on this - what sort of documentation do you have in mind?
> Do you mean something like the online GCC documentation or an in-tree file?
> Let me know what you'd like me to add and I'll be happy to do so.

I think this should go into gcc/doc/install.texi, as for all other
languages and targets.  This way you have all the necessary information
in one place, while some in-tree file is almost guaranteed to be
overlooked.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: Request for testing on non-Linux targets; remove special casing of /usr/lib and /lib from the driver

2024-04-17 Thread Rainer Orth
Hi Andrew,

>   The driver currently will remove "/lib" and "/usr/lib" from the library
> path that gets passed to the linker because it considers them as paths that
> the linker will already known to search. But this is not true for newer
> linkers, mold and lld for an example don't have a default search path.
> This patch removes the special casing to fix FreeBSD building where lld is
> used by default and also fix riscv-linux-gnu when used in combination with
> mold.
> I have tested it on x86_64-linux-gnu and it works there but since the code
> in the driver has been around since 1992, I request some folks to test it
> on AIX, Mac OS (Darwin) and solaris where the ld is not GNU bfd ld as I
> don't have access to those targets currently.

actually, you do: all of those are availble inside the cfarm.

I've also tested the patch on i386-pc-solaris2.11 and
sparc-sun-solaris2.11 with the native ld: no regressions in either case.

>From what I can see, the handling of -Y P,* in gcc/config/sol2.h
(LINK_ARCH{32,64}_SPEC_BASE) can go as well.  I'll test this, but this
is almost certainly GCC 15 material.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH] build: Check for cargo when building rust language

2024-04-17 Thread Rainer Orth
Andrew Pinski  writes:

> On Mon, Apr 8, 2024 at 9:39 AM  wrote:
>>
>> From: Pierre-Emmanuel Patry 
>>
>> Hello,
>>
>> The rust frontend requires cargo to build some of it's components,
>> it's presence was not checked during configuration.
>
> WHY did this go in right before the release of GCC 14?
> I don't get why this is considered temporary and it goes in right
> before a release.
> That seems broken to me.

two more questions about this:

Right now, the new cargo configure test disable rust on all of my
targets (Solaris, Linux, Darwin) which didn't have it installed.  Before
(as recent as last Friday), I could successfully build and test
crab1/rust on all of them without cargo in sight.  So I wonder if the
patch isn't premature.

Besides, while there are packaged versions of cargo for Solaris 11.4 and
Linux, Darwin hasn't anything (not checked Homebrew or similar yet).
What's worse, rustup only supports macOS 10.12 and up, while I'm still
regularly testing 10.7 and 10.11.  I don't really feel like building
rust from source here (if it works at all).  This hasn't been an issue
for any other languages that require additional tools for bootstrapping
(like Ada or D): there are versions of GNAT around that still support
those old Darwin releases, and I could use the C++ version of GDC in GCC
11.

At the very least, the Rust situation needs to be documented clearly.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH v10 1/2] Add condition coverage (MC/DC)

2024-04-15 Thread Rainer Orth
Hi Jørgen,

>> the new gcc.misc-tests/gcov-22.c test loops on SPARC (both Solaris and
>> Linux).  I've filed PR gcov-profile/114720 for this, but couldn't find
>> any bugzilla account of yours to Cc:
>>  Rainer
>> 
>
> Rainer,
>
> Could you please try this patch? I don't have a sparc nor non-glibc build
> (and getting a virtual one up will take a while). I suppose the problem is

given that the test also FAILs on Linux/sparc64, it's not a
glibc-vs-non-glibc issue.

FWIW, there are both Solaris/SPARC and Linux/sparc64 systems available
in the cfarm; no need to build one yourself.  But fully agreed, running
a full bootstrap to verify a single testcase is a bit much if it can be
done more easily ;-)

> that after longjmp the return address is to the call to setdest(), not
> jump() (like is assumed), which creates the loop. If so, just guarding the
> longjmp should be fine, the point of the test is to make sure that both
> branches can be taken and recorded when the cond is a setjmp. If it works I
> will document it and post the patch.

I've just tried the patch on both sparc-sun-solaris2.11 and
i386-pc-solaris2.11 and the test now PASSes on both.

Thanks.
Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


[COMMITTED] testsuite: i386: Restrict gcc.target/i386/fhardened-1.c etc. to Linux/GNU

2024-04-15 Thread Rainer Orth
The new gcc.target/i386/fhardened-1.c etc. tests FAIL on Solaris/x86 and
Darwin/x86:

FAIL: gcc.target/i386/fhardened-1.c (test for excess errors)
FAIL: gcc.target/i386/fhardened-2.c (test for excess errors)

Excess errors: 
cc1: warning: '-fhardened' not supported for this target

Support for -fhardened is restricted to HAVE_FHARDENED_SUPPORT in
toplev.cc (process_options) which again is only defined for linux*|gnu*
targets in gcc/configure.ac.

Accordingly, this patch restricts the tests to those two, as is already
done in gcc.target/i386/cf_check-6.c.

Tested on i386-pc-solaris2.11 and x86_64-pc-linux-gnu.  Committed to
trunk.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-04-15  Rainer Orth  

gcc/testsuite:
* gcc.target/i386/fhardened-1.c: Restrict to Linux/GNU.
* gcc.target/i386/fhardened-2.c: Likewise.

# HG changeset patch
# Parent  270ceb327b3c4010c7f88cc77b599ddb43896640
testsuite: i386: Restrict gcc.target/i386/fhardened-1.c etc. to Linux/GNU

diff --git a/gcc/testsuite/gcc.target/i386/fhardened-1.c b/gcc/testsuite/gcc.target/i386/fhardened-1.c
--- a/gcc/testsuite/gcc.target/i386/fhardened-1.c
+++ b/gcc/testsuite/gcc.target/i386/fhardened-1.c
@@ -1,4 +1,5 @@
 /* PR target/114606 */
+/* { dg-do compile { target *-*-linux* *-*-gnu* } } */
 /* { dg-options "-fhardened -O2 -fcf-protection=none" } */
 
 #ifdef __CET__
diff --git a/gcc/testsuite/gcc.target/i386/fhardened-2.c b/gcc/testsuite/gcc.target/i386/fhardened-2.c
--- a/gcc/testsuite/gcc.target/i386/fhardened-2.c
+++ b/gcc/testsuite/gcc.target/i386/fhardened-2.c
@@ -1,4 +1,5 @@
 /* PR target/114606 */
+/* { dg-do compile { target *-*-linux* *-*-gnu* } } */
 /* { dg-options "-fhardened -O2" } */
 
 #if __CET__ != 3


Re: [PATCH 1/2] Remove unecessary and broken MC/DC compile test

2024-04-15 Thread Rainer Orth
Hi Jørgen,

> The __sigsetjmp test was added as a regression test, which an early
> iteration of the MC/DC support caused an internal compiler error,
> triggered by a code path which did not make it through to the final
> revision.  Since this test really only worked on linux and does not
> serve a purpose any more it can be removed.
>
> gcc/testsuite/ChangeLog:
>
>   * gcc.misc-tests/gcov-19.c: Remove test.

just a nit (and too late since it's already checked in): the ChangeLog
entry should specify *which test* was removed.  As is, it reads like the
whole file has been removed.  Something like

* gcc.misc-tests/gcov-19.c (__sigsetjmp, mcdc021c): Remove.

Rainer

-- 
---------
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH v10 1/2] Add condition coverage (MC/DC)

2024-04-15 Thread Rainer Orth
sc-tests/gcov-22.c: New test.
>>> * gcc.misc-tests/gcov-23.c: New test.
>>> ---
>>>   gcc/builtins.cc|2 +-
>>>   gcc/collect2.cc|7 +-
>>>   gcc/common.opt |9 +
>>>   gcc/doc/gcov.texi  |   38 +
>>>   gcc/doc/invoke.texi|   21 +
>>>   gcc/function.cc|1 +
>>>   gcc/function.h |4 +
>>>   gcc/gcc.cc |4 +-
>>>   gcc/gcov-counter.def   |3 +
>>>   gcc/gcov-dump.cc   |   24 +
>>>   gcc/gcov-io.h  |3 +
>>>   gcc/gcov.cc|  209 ++-
>>>   gcc/gimplify.cc|  123 +-
>>>   gcc/ipa-inline.cc  |2 +-
>>>   gcc/ipa-split.cc   |2 +-
>>>   gcc/passes.cc  |3 +-
>>>   gcc/profile.cc |   76 +-
>>>   gcc/testsuite/g++.dg/gcov/gcov-18.C|  282 
>>>   gcc/testsuite/gcc.misc-tests/gcov-19.c | 1737 
>>>   gcc/testsuite/gcc.misc-tests/gcov-20.c |   22 +
>>>   gcc/testsuite/gcc.misc-tests/gcov-21.c |   16 +
>>>   gcc/testsuite/gcc.misc-tests/gcov-22.c |  103 ++
>>>   gcc/testsuite/gcc.misc-tests/gcov-23.c |  361 +
>>>   gcc/testsuite/lib/gcov.exp |  259 +++-
>>>   gcc/tree-core.h|3 +
>>>   gcc/tree-profile.cc| 1058 ++-
>>>   gcc/tree.h |4 +
>>>   libgcc/libgcov-merge.c |5 +
>>>   28 files changed, 4339 insertions(+), 42 deletions(-)
>>>   create mode 100644 gcc/testsuite/g++.dg/gcov/gcov-18.C
>>>   create mode 100644 gcc/testsuite/gcc.misc-tests/gcov-19.c
>>>   create mode 100644 gcc/testsuite/gcc.misc-tests/gcov-20.c
>>>   create mode 100644 gcc/testsuite/gcc.misc-tests/gcov-21.c
>>>   create mode 100644 gcc/testsuite/gcc.misc-tests/gcov-22.c
>>>   create mode 100644 gcc/testsuite/gcc.misc-tests/gcov-23.c
>>>
>>> ---
>>> Changes since v9:
>>>
>>> * function->cond_uid is no longer in ggc memory
>>> * function->cond_uid and condition annotation is only done when coverage
>>>is requested
>>> * A few new test cases, notably interactions with C++ constexpr
>>> * Updated comments based on review feedback
>>> ---
>>>
>> 
>>> diff --git a/gcc/ipa-inline.cc b/gcc/ipa-inline.cc
>>> index dc120e6da5a..9502a21c741 100644
>>> --- a/gcc/ipa-inline.cc
>>> +++ b/gcc/ipa-inline.cc
>>> @@ -682,7 +682,7 @@ can_early_inline_edge_p (struct cgraph_edge *e)
>>>   }
>>> gcc_assert (gimple_in_ssa_p (DECL_STRUCT_FUNCTION (e->caller->decl))
>>>   && gimple_in_ssa_p (DECL_STRUCT_FUNCTION (callee->decl)));
>>> -  if (profile_arc_flag
>>> +  if ((profile_arc_flag || condition_coverage_flag)
>>> && ((lookup_attribute ("no_profile_instrument_function",
>>> DECL_ATTRIBUTES (caller->decl)) == NULL_TREE)
>>>   != (lookup_attribute ("no_profile_instrument_function",
>> tree-inline should also copy the cond tags, since always_inline
>> functions are inlined even at -O0.  But I think this can be done
>> incrementally.
>> Patch is OK.
>> Thanks a lot and sorry for taking so long on this one.
>> Honza
>
> I guess you mean that since tree-inlining happen after gimplification (does
> it?) that the basic condition -> condition expression association should
> also fold in the now-inlined conditions?
>
> Thanks for the review - I'll do a final test run and install the patch.

the new gcc.misc-tests/gcov-22.c test loops on SPARC (both Solaris and
Linux).  I've filed PR gcov-profile/114720 for this, but couldn't find
any bugzilla account of yours to Cc:

Rainer


-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH v10 1/2] Add condition coverage (MC/DC)

2024-04-05 Thread Rainer Orth
sc-tests/gcov-22.c: New test.
>>> * gcc.misc-tests/gcov-23.c: New test.
>>> ---
>>>   gcc/builtins.cc|2 +-
>>>   gcc/collect2.cc|7 +-
>>>   gcc/common.opt |9 +
>>>   gcc/doc/gcov.texi  |   38 +
>>>   gcc/doc/invoke.texi|   21 +
>>>   gcc/function.cc|1 +
>>>   gcc/function.h |4 +
>>>   gcc/gcc.cc |4 +-
>>>   gcc/gcov-counter.def   |3 +
>>>   gcc/gcov-dump.cc   |   24 +
>>>   gcc/gcov-io.h  |3 +
>>>   gcc/gcov.cc|  209 ++-
>>>   gcc/gimplify.cc|  123 +-
>>>   gcc/ipa-inline.cc  |2 +-
>>>   gcc/ipa-split.cc   |2 +-
>>>   gcc/passes.cc  |3 +-
>>>   gcc/profile.cc |   76 +-
>>>   gcc/testsuite/g++.dg/gcov/gcov-18.C|  282 
>>>   gcc/testsuite/gcc.misc-tests/gcov-19.c | 1737 
>>>   gcc/testsuite/gcc.misc-tests/gcov-20.c |   22 +
>>>   gcc/testsuite/gcc.misc-tests/gcov-21.c |   16 +
>>>   gcc/testsuite/gcc.misc-tests/gcov-22.c |  103 ++
>>>   gcc/testsuite/gcc.misc-tests/gcov-23.c |  361 +
>>>   gcc/testsuite/lib/gcov.exp |  259 +++-
>>>   gcc/tree-core.h|3 +
>>>   gcc/tree-profile.cc| 1058 ++-
>>>   gcc/tree.h |4 +
>>>   libgcc/libgcov-merge.c |5 +
>>>   28 files changed, 4339 insertions(+), 42 deletions(-)
>>>   create mode 100644 gcc/testsuite/g++.dg/gcov/gcov-18.C
>>>   create mode 100644 gcc/testsuite/gcc.misc-tests/gcov-19.c
>>>   create mode 100644 gcc/testsuite/gcc.misc-tests/gcov-20.c
>>>   create mode 100644 gcc/testsuite/gcc.misc-tests/gcov-21.c
>>>   create mode 100644 gcc/testsuite/gcc.misc-tests/gcov-22.c
>>>   create mode 100644 gcc/testsuite/gcc.misc-tests/gcov-23.c
>>>
>>> ---
>>> Changes since v9:
>>>
>>> * function->cond_uid is no longer in ggc memory
>>> * function->cond_uid and condition annotation is only done when coverage
>>>is requested
>>> * A few new test cases, notably interactions with C++ constexpr
>>> * Updated comments based on review feedback
>>> ---
>>>
>> 
>>> diff --git a/gcc/ipa-inline.cc b/gcc/ipa-inline.cc
>>> index dc120e6da5a..9502a21c741 100644
>>> --- a/gcc/ipa-inline.cc
>>> +++ b/gcc/ipa-inline.cc
>>> @@ -682,7 +682,7 @@ can_early_inline_edge_p (struct cgraph_edge *e)
>>>   }
>>> gcc_assert (gimple_in_ssa_p (DECL_STRUCT_FUNCTION (e->caller->decl))
>>>   && gimple_in_ssa_p (DECL_STRUCT_FUNCTION (callee->decl)));
>>> -  if (profile_arc_flag
>>> +  if ((profile_arc_flag || condition_coverage_flag)
>>> && ((lookup_attribute ("no_profile_instrument_function",
>>> DECL_ATTRIBUTES (caller->decl)) == NULL_TREE)
>>>   != (lookup_attribute ("no_profile_instrument_function",
>> tree-inline should also copy the cond tags, since always_inline
>> functions are inlined even at -O0.  But I think this can be done
>> incrementally.
>> Patch is OK.
>> Thanks a lot and sorry for taking so long on this one.
>> Honza
>
> I guess you mean that since tree-inlining happen after gimplification (does
> it?) that the basic condition -> condition expression association should
> also fold in the now-inlined conditions?
>
> Thanks for the review - I'll do a final test run and install the patch.

this patch fails badly on Solaris (and probably all non-Linux targets):

+FAIL: gcc.misc-tests/gcov-19.c (test for excess errors)
+UNRESOLVED: gcc.misc-tests/gcov-19.c compilation failed to produce executable
+FAIL: gcc.misc-tests/gcov-19.c gcov: 0 failures in line counts, 0 in branch 
percentages, 796 in condition/decision, 0 in return percentages, 0 in 
intermediate format
+FAIL: gcc.misc-tests/gcov-19.c line 1006: unexpected summary - expected 1/24, 
got 0/24

and almost 1000 more lines.

gcov-19.exe doesn't link due to use of a Linux implementation detail:

Undefined   first referenced
 symbol in file
__sigsetjmp /var/tmp//cc.8e7Qc.o
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status

Either switch the testcase to use sigsetjmp or restrict it to Linux.
Besides, emitting many hundreds of FAILs if the testcase doesn't compile
is very bad style.

Please fix.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH] c-family, c++: Handle EXCESS_PRECISION_EXPR in pretty printers

2024-03-22 Thread Rainer Orth
Hi Jakub,

> I've noticed that the c-c++-common/gomp/depobj-3.c test FAILs on i686-linux:
> PASS: c-c++-common/gomp/depobj-3.c  -std=c++17  at line 17 (test for 
> warnings, line 15)
> FAIL: c-c++-common/gomp/depobj-3.c  -std=c++17  at line 39 (test for 
> warnings, line 37)
> PASS: c-c++-common/gomp/depobj-3.c  -std=c++17  at line 43 (test for errors, 
> line 41)
> PASS: c-c++-common/gomp/depobj-3.c  -std=c++17  (test for warnings, line 45)
> FAIL: c-c++-common/gomp/depobj-3.c  -std=c++17 (test for excess errors)
> Excess errors:
> /home/jakub/src/gcc/gcc/testsuite/c-c++-common/gomp/depobj-3.c:37:38: 
> warning: the 'destroy' expression ''excess_precision_expr' not supported by 
> dump_expr' should be the same as the 'depobj' argument 
> 'obj' [-Wopenmp]
> The following patch replaces that 'excess_precision_expr' not supported by 
> dump_expr
> with (float)(((long double)a) + (long double)5)

this is PR c++/112724.

Rainer

-- 
---------
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH] testsuite: vect: Don't xfail scan-tree-dump in gcc.dg/vect/bb-slp-32.c [PR96147]

2024-03-22 Thread Rainer Orth
Hi Richard,

> On Thu, 21 Mar 2024, Rainer Orth wrote:
>
>> gcc.dg/vect/bb-slp-32.c currently XPASSes on 32 and 64-bit Solaris/SPARC:
>> 
>> XPASS: gcc.dg/vect/bb-slp-32.c -flto -ffat-lto-objects scan-tree-dump
>> slp2 "vectorization is not profitable"
>> XPASS: gcc.dg/vect/bb-slp-32.c scan-tree-dump slp2 "vectorization is not
>> profitable"
>> 
>> At least on SPARC, the current xfail can simply go, but I'm highly
>> uncertain if this is right in general.
>> 
>> Tested on sparc-sun-solaris2.11 and i386-pc-solaris2.11.
>> 
>> Ok for trunk?
>
> The condition was made for the case where vectorization fails even when
> not considering costing.  But given we now do
>
>   p = __builtin_assume_aligned (p, __BIGGEST_ALIGNMENT__);
>
> that condition doesn't make sense anymore (forgot to update it in my
> r11-6715-gb36c9cd09472c8 change).
>
> In principle the testcase should be profitable to vectorize with
> the SLP reduction support now (and we'd vectorize it that way).
> But we fail to apply SLP node CSE when merging the SLP instance
> into a common subgraph, so we over-estimate cost (and perform
> double code generation that's later CSEd).
>
> That it's still not profitable on x86_64 for me is a quite narrow loss:
>
>   Vector cost: 144
>   Scalar cost: 140
>
> So ideally we'd key the FAIL on .REDUC_PLUS not being available for
> V4SImode but then we also try V2SImode where the reduction isn't
> recognized.  So the testcase wouldn't work well for targets comparing
> cost.
>
> I'd say we remove the dg-final completely for now.  I filed PR114413
> about the costing/CSE issue above.

Thanks.  This is what I committed after re-testing.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-03-19  Rainer Orth  

gcc/testsuite:
PR tree-optimization/96147
* gcc.dg/vect/bb-slp-32.c (dg-final): Remove.

# HG changeset patch
# Parent  b3b6fa4472bc1f2b170e2b736852ec93bae94480
testsuite: vect: Don't xfail scan-tree-dump in gcc.dg/vect/bb-slp-32.c [PR96147]

diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-32.c b/gcc/testsuite/gcc.dg/vect/bb-slp-32.c
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-32.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-32.c
@@ -24,5 +24,3 @@ int foo (int *p, int a, int b)
   bar (x);
   return sum;
 }
-
-/* { dg-final { scan-tree-dump "vectorization is not profitable" "slp2" { xfail  { vect_no_align && { ! vect_hw_misalign } } } } } */


[PATCH] testsuite: vect: Don't xfail scan-tree-dump in gcc.dg/vect/bb-slp-32.c [PR96147]

2024-03-21 Thread Rainer Orth
gcc.dg/vect/bb-slp-32.c currently XPASSes on 32 and 64-bit Solaris/SPARC:

XPASS: gcc.dg/vect/bb-slp-32.c -flto -ffat-lto-objects  scan-tree-dump slp2 
"vectorization is not profitable"
XPASS: gcc.dg/vect/bb-slp-32.c scan-tree-dump slp2 "vectorization is not 
profitable"

At least on SPARC, the current xfail can simply go, but I'm highly
uncertain if this is right in general.

Tested on sparc-sun-solaris2.11 and i386-pc-solaris2.11.

Ok for trunk?

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-03-19  Rainer Orth  

gcc/testsuite:
PR tree-optimization/96147
* gcc.dg/vect/bb-slp-32.c (scan-tree-dump): Remove xfail.

# HG changeset patch
# Parent  b3b6fa4472bc1f2b170e2b736852ec93bae94480
testsuite: vect: Don't xfail scan-tree-dump in gcc.dg/vect/bb-slp-32.c [PR96147]

diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-32.c b/gcc/testsuite/gcc.dg/vect/bb-slp-32.c
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-32.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-32.c
@@ -25,4 +25,4 @@ int foo (int *p, int a, int b)
   return sum;
 }
 
-/* { dg-final { scan-tree-dump "vectorization is not profitable" "slp2" { xfail  { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump "vectorization is not profitable" "slp2" } } */


[PATCH] testsuite: i386: Skip gcc.target/i386/avx512cd-vpbroadcastmb2q-2.c etc. with Solaris as [PR114150]

2024-03-21 Thread Rainer Orth
Two avx512cd tests FAIL to assemble with the Solaris/x86 assembler:

FAIL: gcc.target/i386/avx512cd-vpbroadcastmb2q-2.c (test for excess errors)
UNRESOLVED: gcc.target/i386/avx512cd-vpbroadcastmb2q-2.c compilation failed to 
produce executable
FAIL: gcc.target/i386/avx512cd-vpbroadcastmw2d-2.c (test for excess errors)
UNRESOLVED: gcc.target/i386/avx512cd-vpbroadcastmw2d-2.c compilation failed to 
produce executable

Excess errors: 
Assembler: avx512cd-vpbroadcastmb2q-2.c
"/var/tmp//ccs_9lod.s", line 42 : Invalid instruction argument
Near line: "vpbroadcastmb2q %k0, %zmm0"

Assembler: avx512cd-vpbroadcastmw2d-2.c
"/var/tmp//ccevT6Rd.s", line 35 : Invalid instruction argument
Near line: "vpbroadcastmw2d %k0, %zmm0"

This seems to be an as bug, but given that this rarely if ever gets any
fixes these days, this test just skips the affected tests.

Adjuststing check_effective_target_avx512cd instead doesn't seem
sensible since it would disable quite a number of working tests.

Tested on i386-pc-solaris2.11 (as and gas) and x86_64-pc-linux-gnu.

Ok for trunk?

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-03-19  Rainer Orth  

gcc/testsuite:
PR target/114150
* gcc.target/i386/avx512cd-vpbroadcastmb2q-2.c: Skip on
Solaris/x86 with as.
* gcc.target/i386/avx512cd-vpbroadcastmw2d-2.c: Likewise.

# HG changeset patch
# Parent  23c541e5d902f9a56abba0367e1fb8326f350d16
testsuite: i386: xfail gcc.target/i386/avx512cd-vpbroadcastmb2q-2.c etc. with Solaris as [PR114150]

diff --git a/gcc/testsuite/gcc.target/i386/avx512cd-vpbroadcastmb2q-2.c b/gcc/testsuite/gcc.target/i386/avx512cd-vpbroadcastmb2q-2.c
--- a/gcc/testsuite/gcc.target/i386/avx512cd-vpbroadcastmb2q-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512cd-vpbroadcastmb2q-2.c
@@ -1,6 +1,7 @@
 /* { dg-do run } */
 /* { dg-options "-O2 -mavx512cd" } */
 /* { dg-require-effective-target avx512cd } */
+/* { dg-skip-if "PR target/114150" { *-*-solaris2.* && { ! gas } } } */
 
 #define HAVE_512
 #define AVX512CD
diff --git a/gcc/testsuite/gcc.target/i386/avx512cd-vpbroadcastmw2d-2.c b/gcc/testsuite/gcc.target/i386/avx512cd-vpbroadcastmw2d-2.c
--- a/gcc/testsuite/gcc.target/i386/avx512cd-vpbroadcastmw2d-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512cd-vpbroadcastmw2d-2.c
@@ -1,6 +1,7 @@
 /* { dg-do run } */
 /* { dg-options "-O2 -mavx512cd" } */
 /* { dg-require-effective-target avx512cd } */
+/* { dg-skip-if "PR target/114150" { *-*-solaris2.* && { ! gas } } } */
 
 #define HAVE_512
 #define AVX512CD


[PATCH] testsuite: vect: Require vect_hw_misalign in gcc.dg/vect/vect-cost-model-1.c etc. [PR98238]

2024-03-11 Thread Rainer Orth
Several gcc.dg/vect/vect-cost-model-?.c tests FAIL on 32 and 64-bit
Solaris/SPARC:

FAIL: gcc.dg/vect/vect-cost-model-1.c -flto -ffat-lto-objects  scan-tree-dump 
vect "LOOP VECTORIZED"
FAIL: gcc.dg/vect/vect-cost-model-1.c scan-tree-dump vect "LOOP VECTORIZED"
FAIL: gcc.dg/vect/vect-cost-model-3.c -flto -ffat-lto-objects  scan-tree-dump 
vect "LOOP VECTORIZED"
FAIL: gcc.dg/vect/vect-cost-model-3.c scan-tree-dump vect "LOOP VECTORIZED"
FAIL: gcc.dg/vect/vect-cost-model-5.c -flto -ffat-lto-objects  scan-tree-dump 
vect "LOOP VECTORIZED"
FAIL: gcc.dg/vect/vect-cost-model-5.c scan-tree-dump vect "LOOP VECTORIZED"

The dumps show

/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/vect/vect-cost-model-1.c:7:30:
 note:   ==> examining statement: _3 = *_2;
/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/vect/vect-cost-model-1.c:7:30:
 missed:   unsupported unaligned access
/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/vect/vect-cost-model-1.c:8:6: 
missed:   not vectorized: relevant stmt not supported: _3 = *_2;

so I think the tests need to require vect_hw_misalign.  This is what
this patch does.

Tested on sparc-sun-solaris2.11 and i386-pc-solaris2.11.

Ok for trunk?

Rainer

-- 
---------
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-22  Rainer Orth  

gcc/testsuite:
PR tree-optimization/98238
* gcc.dg/vect/vect-cost-model-1.c (scan-tree-dump): Also require
vect_hw_misalign.
* gcc.dg/vect/vect-cost-model-3.c: Likewise.
* gcc.dg/vect/vect-cost-model-5.c: Likewise.

# HG changeset patch
# Parent  7238442252360e699145461779d03baf86bc3a7a
testsuite: vect: Require vect_hw_misalign in gcc.dg/vect/vect-cost-model-1.c etc. [PR98238]

diff --git a/gcc/testsuite/gcc.dg/vect/vect-cost-model-1.c b/gcc/testsuite/gcc.dg/vect/vect-cost-model-1.c
--- a/gcc/testsuite/gcc.dg/vect/vect-cost-model-1.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-cost-model-1.c
@@ -8,4 +8,4 @@ f (int *x, int *y)
 x[i] += y[i];
 }
 
-/* { dg-final { scan-tree-dump {LOOP VECTORIZED} vect { target vect_int } } } */
+/* { dg-final { scan-tree-dump {LOOP VECTORIZED} vect { target { vect_int && vect_hw_misalign } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-cost-model-3.c b/gcc/testsuite/gcc.dg/vect/vect-cost-model-3.c
--- a/gcc/testsuite/gcc.dg/vect/vect-cost-model-3.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-cost-model-3.c
@@ -8,4 +8,4 @@ f (int *restrict x, int *restrict y)
 x[i] += y[i];
 }
 
-/* { dg-final { scan-tree-dump {LOOP VECTORIZED} vect { target vect_int } } } */
+/* { dg-final { scan-tree-dump {LOOP VECTORIZED} vect { target { vect_int && vect_hw_misalign } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-cost-model-5.c b/gcc/testsuite/gcc.dg/vect/vect-cost-model-5.c
--- a/gcc/testsuite/gcc.dg/vect/vect-cost-model-5.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-cost-model-5.c
@@ -8,4 +8,4 @@ f (int *restrict x, int *restrict y)
 x[i] += y[i];
 }
 
-/* { dg-final { scan-tree-dump {LOOP VECTORIZED} vect { target vect_int } } } */
+/* { dg-final { scan-tree-dump {LOOP VECTORIZED} vect { target { vect_int && vect_hw_misalign } } } } */


[PATCH] testsuite: vect: Require vect_perm in several tests [PR114071, PR113557, PR96109]

2024-03-11 Thread Rainer Orth
Several vectorization tests FAIL on 32 and 64-bit Solaris/SPARC:

FAIL: gcc.dg/vect/pr37027.c -flto -ffat-lto-objects  scan-tree-dump-times vect 
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/pr37027.c -flto -ffat-lto-objects  scan-tree-dump-times vect 
"vectorizing stmts using SLP" 1
FAIL: gcc.dg/vect/pr37027.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/pr37027.c scan-tree-dump-times vect "vectorizing stmts using 
SLP" 1
FAIL: gcc.dg/vect/pr67790.c -flto -ffat-lto-objects  scan-tree-dump vect 
"vectorizing stmts using SLP"
FAIL: gcc.dg/vect/pr67790.c scan-tree-dump vect "vectorizing stmts using SLP"
FAIL: gcc.dg/vect/slp-47.c -flto -ffat-lto-objects  scan-tree-dump-times vect 
"vectorizing stmts using SLP" 2
FAIL: gcc.dg/vect/slp-47.c scan-tree-dump-times vect "vectorizing stmts using 
SLP" 2
FAIL: gcc.dg/vect/slp-48.c -flto -ffat-lto-objects  scan-tree-dump-times vect 
"vectorizing stmts using SLP" 2
FAIL: gcc.dg/vect/slp-48.c scan-tree-dump-times vect "vectorizing stmts using 
SLP" 2
FAIL: gcc.dg/vect/slp-reduc-1.c -flto -ffat-lto-objects  scan-tree-dump-times 
vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/slp-reduc-1.c -flto -ffat-lto-objects  scan-tree-dump-times 
vect "vectorizing stmts using SLP" 1
FAIL: gcc.dg/vect/slp-reduc-1.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/slp-reduc-1.c scan-tree-dump-times vect "vectorizing stmts 
using SLP" 1
FAIL: gcc.dg/vect/slp-reduc-2.c -flto -ffat-lto-objects  scan-tree-dump-times 
vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/slp-reduc-2.c -flto -ffat-lto-objects  scan-tree-dump-times 
vect "vectorizing stmts using SLP" 1
FAIL: gcc.dg/vect/slp-reduc-2.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/slp-reduc-2.c scan-tree-dump-times vect "vectorizing stmts 
using SLP" 1
FAIL: gcc.dg/vect/slp-reduc-7.c -flto -ffat-lto-objects  scan-tree-dump-times 
vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/slp-reduc-7.c -flto -ffat-lto-objects  scan-tree-dump-times 
vect "vectorizing stmts using SLP" 1
FAIL: gcc.dg/vect/slp-reduc-7.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/slp-reduc-7.c scan-tree-dump-times vect "vectorizing stmts 
using SLP" 1
FAIL: gcc.dg/vect/slp-reduc-8.c -flto -ffat-lto-objects  scan-tree-dump vect 
"vectorized 1 loops"
FAIL: gcc.dg/vect/slp-reduc-8.c scan-tree-dump vect "vectorized 1 loops"
FAIL: gcc.dg/vect/vect-multi-peel-gaps.c -flto -ffat-lto-objects  
scan-tree-dump vect "LOOP VECTORIZED"
FAIL: gcc.dg/vect/vect-multi-peel-gaps.c scan-tree-dump vect "LOOP VECTORIZED"

The dumps show variations of

/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/vect/pr37027.c:24:17: note:   
==> examining statement: _4 = a[i_19].f2;
/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/vect/pr37027.c:24:17: missed: 
  unsupported vect permute { 1 0 3 2 5 4 }
/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/vect/pr37027.c:24:17: missed: 
  unsupported load permutation
/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/vect/pr37027.c:27:17: missed: 
  not vectorized: relevant stmt not supported: _4 = a[i_19].f2;

so I think the tests should require vect_perm.  This is what this patch does

Tested on sparc-sun-solaris2.11 and i386-pc-solaris2.11.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-22  Rainer Orth  

gcc/testsuite:
PR tree-optimization/114071
* gcc.dg/vect/pr37027.c: Require vect_perm.
* gcc.dg/vect/pr67790.c: Likewise.
* gcc.dg/vect/slp-reduc-1.c: Likewise.
* gcc.dg/vect/slp-reduc-2.c: Likewise.
* gcc.dg/vect/slp-reduc-7.c: Likewise.
* gcc.dg/vect/slp-reduc-8.c: Likewise.

PR tree-optimization/113557
* gcc.dg/vect/vect-multi-peel-gaps.c (scan-tree-dump): Also
require vect_perm.

PR testsuite/96109
* gcc.dg/vect/slp-47.c: Require vect_perm.
* gcc.dg/vect/slp-48.c: Likewise.

# HG changeset patch
# Parent  7af365ac71939e435bbc93927bcfa439568af4e5
testsuite: vect: Require vect_perm in several tests [PR??]

diff --git a/gcc/testsuite/gcc.dg/vect/pr37027.c b/gcc/testsuite/gcc.dg/vect/pr37027.c
--- a/gcc/testsuite/gcc.dg/vect/pr37027.c
+++ b/gcc/testsuite/gcc.dg/vect/pr37027.c
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_perm } */
 
 #include 
 
diff --git a/gcc/testsuite/gcc.dg/vect/pr67790.c b/gcc/testsuite/gcc.dg/vect/pr67790.c
--- a/gcc/testsuite/gcc.dg/vect/pr67790.c
+++ b/gcc/testsuite/gcc.dg/vect/pr67790.c
@@ -1,4 +1,5 @@
 /* { dg-require-effective-target vect_int } */
+/* {

Re: [PATCH] combine: Don't simplify paradoxical SUBREG on WORD_REGISTER_OPERATIONS [PR113010]

2024-03-04 Thread Rainer Orth
Hi Jeff,

> On 2/26/24 17:17, Greg McGary wrote:
>> The sign-bit-copies of a sign-extending load cannot be known until runtime on
>> WORD_REGISTER_OPERATIONS targets, except in the case of a zero-extending MEM
>> load.  See the fix for PR112758.
>> 2024-02-22  Greg McGary  
>>  PR rtl-optimization/113010
>>  * combine.cc (simplify_comparison): Simplify a SUBREG on
>>WORD_REGISTER_OPERATIONS targets only if it is a zero-extending
>>MEM load.
>>  * gcc.c-torture/execute/pr113010.c: New test.
> I think this is fine for the trunk.  I'll do some final testing on it
> tomorrow.

unfortunately, the patch broke Solaris/SPARC bootstrap
(sparc-sun-solaris2.11):

/vol/gcc/src/hg/master/local/gcc/combine.cc: In function 'rtx_code 
simplify_comparison(rtx_code, rtx_def**, rtx_def**)':
/vol/gcc/src/hg/master/local/gcc/combine.cc:12101:25: error: '*(unsigned 
int*)((char*)_mode + offsetof(scalar_int_mode, scalar_int_mode::m_mode))' 
may be used uninitialized [-Werror=maybe-uninitialized]
12101 |   scalar_int_mode mode, inner_mode, tmode;
  | ^~

Rainer

-- 
---------
Rainer Orth, Center for Biotechnology, Bielefeld University


[COMMITTED] testsuite: Fix gcc.dg/tree-ssa/builtin-snprintf-6.c XPASS on i?86 -m64 [PR91567]

2024-02-28 Thread Rainer Orth
gcc.dg/tree-ssa/builtin-snprintf-6.c currently XPASSes on i?86-*-*
configurations with -m64:

XPASS: gcc.dg/tree-ssa/builtin-snprintf-6.c scan-tree-dump-times optimized 
"Function test_assign_aggregate" 1

(seen e.g. on i386-pc-solaris2.11, i686-pc-linux-gnu, or i386-apple-darwin*).

The problem is that the xfail only handles x86_64, ignoring that i?86
configurations can also be multilibbed.

This patch fixes the by handling both forms alike.

Tested on i386-pc-solaris2.11, amd64-pc-solaris2.11,
sparc-sun-solaris2.11, and sparcv9-sun-solaris2.11.

Committed to trunk.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-28  Rainer Orth  

gcc/testsuite:
PR tree-optimization/91567
* gcc.dg/tree-ssa/builtin-snprintf-6.c (scan-tree-dump-times):
Treat i?86-*-* like x86_64-*-*.

# HG changeset patch
# Parent  27664b7bca147c0d4b3e5aa0e758719dbfc543aa
testsuite: Fix gcc.dg/tree-ssa/builtin-snprintf-6.c XPASS on i?86 -m64

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-6.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-6.c
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-6.c
@@ -91,7 +91,7 @@ void test_assign_aggregate (void)
   T (5, "123456", "s=%.*s", 3, [2]);
 }
 
-/* { dg-final { scan-tree-dump-times "Function test_assign_aggregate" 1 "optimized" { xfail { { ! x86_64-*-* } || { ilp32 } } } } } */
+/* { dg-final { scan-tree-dump-times "Function test_assign_aggregate" 1 "optimized" { xfail { { ! { i?86-*-* x86_64-*-* } } || { ilp32 } } } } } */
 
 #endif   /* x86_64 */
 


[COMMITTED] testsuite: Fix gcc.dg/attr-weakref-1.c on Solaris/x86 with as [PR70582]

2024-02-26 Thread Rainer Orth
gcc.dg/attr-weakref-1.c FAILs on 32 and 64-bit Solaris/x86 with the
native assembler:

FAIL: gcc.dg/attr-weakref-1.c (test for excess errors)
UNRESOLVED: gcc.dg/attr-weakref-1.c compilation failed to produce executable

Excess errors:
Assembler: attr-weakref-1.c
"/var/tmp//ccUSaysF.s", line 171 : Multiply defined symbol: "Wv3a"

This is a bug in the native as, which isn't seeing fixes recently.

Since only a single subtest is affected, this patch omits that one.

Tested on i386-pc-solaris2.11 (as and gas) and x86_64-pc-linux-gnu.

Committed to trunk.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-24  Rainer Orth  

gcc/testsuite:
PR ipa/70582
* gcc.dg/attr-weakref-1.c (dg-additional-options): Define
SOLARIS_X86_AS as appropriate.
(lv3, Wv3a, pv3a): Wrap in !SOLARIS_X86_AS.
(main): Likewise for chk (pv3a).

# HG changeset patch
# Parent  c2e97b9d632bb04de7c4c87d39b7e813f640f9f9
testsuite: Fix gcc.dg/attr-weakref-1.c on Solaris/x86 with as [PR70582]

diff --git a/gcc/testsuite/gcc.dg/attr-weakref-1.c b/gcc/testsuite/gcc.dg/attr-weakref-1.c
--- a/gcc/testsuite/gcc.dg/attr-weakref-1.c
+++ b/gcc/testsuite/gcc.dg/attr-weakref-1.c
@@ -14,6 +14,8 @@
 // { dg-options "-O2" }
 // { dg-additional-options "-Wl,-undefined,dynamic_lookup" { target *-*-darwin* } }
 // { dg-additional-options "-Wl,-flat_namespace" { target *-*-darwin[89]* } }
+// One subtest doesn't assemble with the Solaris/x86 as (PR ipa/70582)
+// { dg-additional-options "-DSOLARIS_X86_AS" { target { *86*-*-solaris2* && { ! gas } } } }
 // { dg-additional-sources "attr-weakref-1a.c" }
 
 // Copyright 2005 Free Software Foundation, Inc.
@@ -46,9 +48,11 @@ vtype gv2;
 static vtype Wv2a __attribute__((weakref ("gv2")));
 static vtype *pv2a USED = 
 
+#if !defined SOLARIS_X86_AS
 static vtype lv3;
 static vtype Wv3a __attribute__((weakref ("lv3")));
 static vtype *pv3a USED = 
+#endif
 
 extern vtype uv4;
 static vtype Wv4a __attribute__((weakref ("uv4")));
@@ -192,7 +196,9 @@ extern ftype wf14 __attribute__((weak));
 int main () {
   chk (!pv1a);
   chk (pv2a);
+#if !defined(SOLARIS_X86_AS)
   chk (pv3a);
+#endif
   chk (pv4a);
   chk (pv4);
   chk (pv5a);


[COMMITTED] testsuite: xfail gcc.c-torture/compile/pr61159.c on Solaris/x86 with as [PR61159]

2024-02-26 Thread Rainer Orth
gcc.c-torture/compile/pr61159.c currently FAILs on 32 and 64-bit
Solaris/x86 with the native assembler:

FAIL: gcc.c-torture/compile/pr61159.c   -O0  (test for excess errors)
FAIL: gcc.c-torture/compile/pr61159.c   -O1  (test for excess errors)
FAIL: gcc.c-torture/compile/pr61159.c   -O2  (test for excess errors)
FAIL: gcc.c-torture/compile/pr61159.c   -O2 -flto  (test for excess errors)
FAIL: gcc.c-torture/compile/pr61159.c   -O2 -flto -flto-partition=none  (test 
for excess errors)
FAIL: gcc.c-torture/compile/pr61159.c   -O3 -g  (test for excess errors)
FAIL: gcc.c-torture/compile/pr61159.c   -Os  (test for excess errors)

Excess errors:
Assembler: pr61159.c
"/var/tmp//ccRtFPva.s", line 5 : Cannot set a weak symbol to a common 
symbol

This is a bug/limitation in the native assembler.  Given that this
hasn't seen fixes for a long time, this patch xfails the test.

Tested on i386-pc-solaris2.11 (as and gas) and x86_64-pc-linux-gnu.

Committed to trunk.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-24  Rainer Orth  

gcc/testsuite:
PR ipa/61159
* gcc.c-torture/compile/pr61159.c: xfail on Solaris/x86 with as.

# HG changeset patch
# Parent  32a7094d0d8c1c287ab2dce6f79e2ad1530d1113
testsuite: xfail gcc.c-torture/compile/pr61159.c on Solaris/x86 with as [PR61159]

diff --git a/gcc/testsuite/gcc.c-torture/compile/pr61159.c b/gcc/testsuite/gcc.c-torture/compile/pr61159.c
--- a/gcc/testsuite/gcc.c-torture/compile/pr61159.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr61159.c
@@ -1,6 +1,6 @@
 /* { dg-require-alias "" } */
 /* { dg-require-weak "" } */
-/* { dg-xfail-if "weak alias" { powerpc-ibm-aix* } } */
+/* { dg-xfail-if "weak alias" { powerpc-ibm-aix* || { *86*-*-solaris* && { ! gas } } } } */
 
 static int dummy = 0;
 extern int foo __attribute__((__weak__, __alias__("dummy")));


[COMMITTED] testsuite: vect: Actually skip gcc.dg/vect/vect-bic-bitmask-12.c etc. on SPARC

2024-02-23 Thread Rainer Orth
gcc.dg/vect/vect-bic-bitmask-12.c and gcc.dg/vect/vect-bic-bitmask-23.c
currently FAIL on 32 and 64-bit Solaris/SPARC

FAIL: gcc.dg/vect/vect-bic-bitmask-12.c -flto -ffat-lto-objects  scan-tree-dump 
dce7 "<=s*.+{ 255,.+}"
FAIL: gcc.dg/vect/vect-bic-bitmask-12.c scan-tree-dump dce7 "<=s*.+{ 
255,.+}"
FAIL: gcc.dg/vect/vect-bic-bitmask-23.c -flto -ffat-lto-objects  scan-tree-dump 
dce7 "<=s*.+{ 255, 15, 1, 65535 }"
FAIL: gcc.dg/vect/vect-bic-bitmask-23.c scan-tree-dump dce7 "<=s*.+{ 255, 
15, 1, 65535 }"

although they should be skipped since

commit 5f07095d22f58572c06997aa6d4f3bc456e1925d
Author: Tamar Christina 
Date:   Tue Mar 8 11:32:59 2022 +

vect: disable bitmask tests on sparc

The problem is that dg-skip-if must come after dg-do, although this
isn't currently documented unfortunately.

Fixed by reordering the directives.

Tested on sparc-sun-solaris2.11 and i386-pc-solaris2.11.

Committed to trunk.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-22  Rainer Orth  

gcc/testsuite:
* gcc.dg/vect/vect-bic-bitmask-12.c: Move dg-skip-if down.
* gcc.dg/vect/vect-bic-bitmask-23.c: Likewise.

# HG changeset patch
# Parent  9c588428a6e298fa35c5bf75d7d374105b1575bd
testsuite: vect: Actually skip  gcc.dg/vect/vect-bic-bitmask-12.c etc. on SPARC

diff --git a/gcc/testsuite/gcc.dg/vect/vect-bic-bitmask-12.c b/gcc/testsuite/gcc.dg/vect/vect-bic-bitmask-12.c
--- a/gcc/testsuite/gcc.dg/vect/vect-bic-bitmask-12.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-bic-bitmask-12.c
@@ -1,6 +1,6 @@
-/* { dg-skip-if "missing optab for vectorization" { sparc*-*-* } } */
 /* { dg-do compile } */
 /* { dg-additional-options "-O3 -fdump-tree-dce -w" } */
+/* { dg-skip-if "missing optab for vectorization" { sparc*-*-* } } */
 
 #include 
 
diff --git a/gcc/testsuite/gcc.dg/vect/vect-bic-bitmask-23.c b/gcc/testsuite/gcc.dg/vect/vect-bic-bitmask-23.c
--- a/gcc/testsuite/gcc.dg/vect/vect-bic-bitmask-23.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-bic-bitmask-23.c
@@ -1,6 +1,6 @@
-/* { dg-skip-if "missing optab for vectorization" { sparc*-*-* } } */
 /* { dg-do compile } */
 /* { dg-additional-options "-O1 -fdump-tree-dce -w" } */
+/* { dg-skip-if "missing optab for vectorization" { sparc*-*-* } } */
 
 #include 
 


[COMMITTED] testsuite: plugin: Fix gcc.dg/plugin/crash-test-write-though-null-sarif.c on Solaris

2024-02-23 Thread Rainer Orth
gcc.dg/plugin/crash-test-write-though-null-sarif.c FAILs on Solaris:

FAIL: gcc.dg/plugin/crash-test-write-though-null-sarif.c 
-fplugin=./crash_test_plugin.so  scan-sarif-file "text": "Segmentation fault

Comparing the sarif files between Linux and Solaris reveals

-"message": 
{"text": "Segmentation fault"},
+"message": 
{"text": "Segmentation Fault"},

This patch allows for both forms.

Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11, and
x86_64-pc-linux-gnu.

Committed to trunk.

Rainer

-- 
---------
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-22  Rainer Orth  

gcc/testsuite:
* gcc.dg/plugin/crash-test-write-though-null-sarif.c
(scan-sarif-file): Allow for "Segmentation Fault", too.

# HG changeset patch
# Parent  ed942d3ea6c0b97b1812ed2c6563fd5873c8edca
testsuite: plugin: Fix gcc.dg/plugin/crash-test-write-though-null-sarif.c on Solaris

diff --git a/gcc/testsuite/gcc.dg/plugin/crash-test-write-though-null-sarif.c b/gcc/testsuite/gcc.dg/plugin/crash-test-write-though-null-sarif.c
--- a/gcc/testsuite/gcc.dg/plugin/crash-test-write-though-null-sarif.c
+++ b/gcc/testsuite/gcc.dg/plugin/crash-test-write-though-null-sarif.c
@@ -61,4 +61,4 @@ void test_inject_write_through_null (voi
{ dg-final { scan-sarif-file "\"startColumn\": 3" } }
{ dg-final { scan-sarif-file "\"endColumn\": 31" } }
  { dg-final { scan-sarif-file "\"message\": " } }
-   { dg-final { scan-sarif-file "\"text\": \"Segmentation fault" } } */
+   { dg-final { scan-sarif-file "\"text\": \"Segmentation \[Ff\]ault" } } */


Re: [patch] fix libsanitizer build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 on 32bit architectures

2024-02-22 Thread Rainer Orth
Hi Matthias,

> libsanitizer fails to build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64,
> triggering an #error in /usr/include/features-time64.h
>
> --- a/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp
> +++ b/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp
> @@ -11,6 +11,7 @@
>
>  // Before Solaris 11.4,  doesn't work in a largefile
>  environment.
>  #undef _FILE_OFFSET_BITS
> +#undef _TIME_BITS
>  #include "sanitizer_platform.h"
>  #if SANITIZER_SOLARIS
>  #  include 
> --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
> +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
> @@ -18,6 +18,7 @@
>  // depends on _FILE_OFFSET_BITS setting.
>  // To get this "true" dirent definition, we undefine _FILE_OFFSET_BITS
>  below.
>  #undef _FILE_OFFSET_BITS
> +#undef _TIME_BITS
>  #endif
>
>  // Must go after undef _FILE_OFFSET_BITS.
>
>
> The patch to sanitizer_platform_limits_posix.cpp is already present in
> trunk, but missing from the branches.
>
> Because all platform files are built in GCC, you also see the failure in
> sanitizer_procmaps_solaris.cpp. Just doing the same as for the posix 
> files fixes the issue and libsanitizer builds again.
>
> Does this have any effect on the solaris builds?  If not, ok for the trunk
> and the branches?

Since _TIME_BITS isn't used in Solaris system headers at all, there's no
impact.

However, the sanitizer_procmaps_solaris.cpp change needs to go into
upstream LLVM first and can only then be cherry-picked into libsanitizer
once it has been committed there.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH] libsanitizer: Intercept __makecontext_v2 on Solaris/SPARC [PR113785]

2024-02-16 Thread Rainer Orth
Hi Jakub,

> On Fri, Feb 16, 2024 at 01:32:04PM +0100, Rainer Orth wrote:
>> c-c++-common/asan/swapcontext-test-1.c FAILs on Solaris/SPARC:
>> 
>> FAIL: c-c++-common/asan/swapcontext-test-1.c   -O0  execution test
>> FAIL: c-c++-common/asan/swapcontext-test-1.c   -O1  execution test
>> FAIL: c-c++-common/asan/swapcontext-test-1.c   -O2  execution test
>> FAIL: c-c++-common/asan/swapcontext-test-1.c   -O2 -flto  execution test
>> FAIL: c-c++-common/asan/swapcontext-test-1.c -O2 -flto
>> -flto-partition=none execution test
>> FAIL: c-c++-common/asan/swapcontext-test-1.c -O3 -fomit-frame-pointer
>> -funroll-loops -fpeel-loops -ftracer -finline-functions execution test
>> FAIL: c-c++-common/asan/swapcontext-test-1.c   -O3 -g  execution test
>> FAIL: c-c++-common/asan/swapcontext-test-1.c   -Os  execution test
>> 
>> As detailed in PR sanitizer/113785, this happens because an ABI change
>> in Solaris 10/SPARC caused the external symbol for makecontext to be
>> changed to __makecontext_v2, which isn't intercepted.
>
> Is Solaris 9/SPARC and earlier no longer supported in GCC?

no, Solaris 9 support was removed in GCC 5 already.  The only version
supported by trunk is 11.4; 11.3 isn't but I won't actually remove
support until Solaris 11.4 systems have been added to the cfarm (which
should be soon).

> If so, ok for trunk.

Thanks.

> Otherwise I'd expect some ifdefs or whatever to check if it is
> Solaris 10+ with __makecontext_v2 or Solaris up to 9 with makecontext.

True.  However, it can be difficult to get patches upstream for OS
versions not remotely supported in LLVM (which has been 11.4-only for
years).

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[PATCH] libsanitizer: Intercept __makecontext_v2 on Solaris/SPARC [PR113785]

2024-02-16 Thread Rainer Orth
c-c++-common/asan/swapcontext-test-1.c FAILs on Solaris/SPARC:

FAIL: c-c++-common/asan/swapcontext-test-1.c   -O0  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -O1  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -O2  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -O2 -flto  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -O2 -flto -flto-partition=none  
execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -O3 -fomit-frame-pointer 
-funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -O3 -g  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -Os  execution test

As detailed in PR sanitizer/113785, this happens because an ABI change
in Solaris 10/SPARC caused the external symbol for makecontext to be
changed to __makecontext_v2, which isn't intercepted.

The following patch, submitted upstream at
https://github.com/llvm/llvm-project/pull/81588, fixes that.

Tested on sparc-sun-solaris2.11 and i386-pc-solaris2.11.

Ok to cherry-pick into trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-16  Rainer Orth  

libsanitizer:
PR sanitizer/113785
* sanitizer_common/asan/asan_interceptors.cpp: Cherry-pick
llvm-project revision 8c2033719a843a1880427a5e8caa5563248bce78.

# HG changeset patch
# Parent  2fb800df7e0fd2d03a485601ad4683a29f78f2a4
libsanitizer: Intercept __makecontext_v2 on Solaris/SPARC [PR113785]

diff --git a/libsanitizer/asan/asan_interceptors.cpp b/libsanitizer/asan/asan_interceptors.cpp
--- a/libsanitizer/asan/asan_interceptors.cpp
+++ b/libsanitizer/asan/asan_interceptors.cpp
@@ -347,8 +347,16 @@ static void ClearShadowMemoryForContextS
   PoisonShadow(bottom, ssize, 0);
 }
 
+// Since Solaris 10/SPARC, ucp->uc_stack.ss_sp refers to the stack base address
+// as on other targets.  For binary compatibility, the new version uses a
+// different external name, so we intercept that.
+#if SANITIZER_SOLARIS && defined(__sparc__)
+INTERCEPTOR(void, __makecontext_v2, struct ucontext_t *ucp, void (*func)(),
+int argc, ...) {
+#else
 INTERCEPTOR(void, makecontext, struct ucontext_t *ucp, void (*func)(), int argc,
 ...) {
+#endif
   va_list ap;
   uptr args[64];
   // We don't know a better way to forward ... into REAL function. We can
@@ -368,7 +376,11 @@ INTERCEPTOR(void, makecontext, struct uc
   ENUMERATE_ARRAY_16(0), ENUMERATE_ARRAY_16(16), ENUMERATE_ARRAY_16(32), \
   ENUMERATE_ARRAY_16(48)
 
+#if SANITIZER_SOLARIS && defined(__sparc__)
+  REAL(__makecontext_v2)
+#else
   REAL(makecontext)
+#endif
   ((struct ucontext_t *)ucp, func, argc, ENUMERATE_ARRAY_64());
 
 #undef ENUMERATE_ARRAY_4
@@ -783,7 +795,12 @@ void InitializeAsanInterceptors() {
 
 #  if ASAN_INTERCEPT_SWAPCONTEXT
   ASAN_INTERCEPT_FUNC(swapcontext);
+  // See the makecontext interceptor above for an explanation.
+#if SANITIZER_SOLARIS && defined(__sparc__)
+  ASAN_INTERCEPT_FUNC(__makecontext_v2);
+#else
   ASAN_INTERCEPT_FUNC(makecontext);
+#endif
 #  endif
 #  if ASAN_INTERCEPT__LONGJMP
   ASAN_INTERCEPT_FUNC(_longjmp);


[COMMITTED] testsuite: Require lto-plugin support in gcc.dg/lto/modref-3 etc. [PR98237]

2024-02-16 Thread Rainer Orth
gcc.dg/lto/modref-3 etc. FAIL on Solaris with the native linker:

FAIL: gcc-dg-lto-modref-3-01.exe scan-wpa-ipa-dump modref "parm 1 flags: 
no_direct_clobber no_direct_escape"
FAIL: gcc-dg-lto-modref-4-01.exe scan-wpa-ipa-dump modref "parm 1 flags: 
no_direct_clobber no_direct_escape"
FAIL: gcc.dg/lto/modref-3 c_lto_modref-3_0.o-c_lto_modref-3_1.o execute -O2 
-flto-partition=max -fdump-ipa-modref -fno-ipa-sra -fno-ipa-cp -flto
FAIL: gcc.dg/lto/modref-4 c_lto_modref-4_0.o-c_lto_modref-4_1.o execute -O2 
-flto-partition=max -fdump-ipa-modref -fno-ipa-sra -flto

The issue is that the tests require the linker plugin, which isn't
available with Solaris ld.  Thus, it also FAILs when gcc is configured
with --disable-lto-plugin.

This patch thus declares the requirement.  As it turns out, there's an
undocumented dg-require-linker-plugin already, but I introduce and use
the corresponding effective-target keyword and document both.

Given that the effective-target form is more flexible, I'm tempted to
remove dg-require-* with an empty arg as already mentioned in
sourcebuild.texi.  That is not this patch, however.

Tested on i386-pc-solaris2.11 with ld and gld.

Committed to trunk.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-14  Rainer Orth  

gcc/testsuite:
PR ipa/98237
* lib/target-supports.exp (is-effective-target): Handle
linker_plugin.
* gcc.dg/lto/modref-3_0.c: Require linker_plugin support.
* gcc.dg/lto/modref-4_0.c: Likewise.

gcc:
* doc/sourcebuild.texi (Effective-Target Keywords, Other
attribugs): Document linker_plugin.
(Require Support): Document dg-require-linker-plugin.

# HG changeset patch
# Parent  c4cd589ec9c0ac709c6678e47799d87d82fbad00
testsuite: Require lto-plugin support in gcc.dg/lto/modref-3 etc. [PR98237]

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -3009,6 +3009,9 @@ Target supports @option{-mpe-aligned-com
 @item pie
 Target supports @option{-pie}, @option{-fpie} and @option{-fPIE}.
 
+@item linker_plugin
+Target supports the linker plugin.
+
 @item rdynamic
 Target supports @option{-rdynamic}.
 
@@ -3337,6 +3340,10 @@ system.  Some tests are incompatible wit
 hosts, which involves copying the source file to the host and compiling
 it with a relative path and "@code{-o a.out}".
 
+@item dg-require-linker-plugin ""
+Skip the test is the target does not support the linker plugin.
+This is equivalent to @code{dg-require-effective-target linker_plugin}.
+
 @item dg-require-mkfifo ""
 Skip the test if the target does not support @code{mkfifo}.
 
diff --git a/gcc/testsuite/gcc.dg/lto/modref-3_0.c b/gcc/testsuite/gcc.dg/lto/modref-3_0.c
--- a/gcc/testsuite/gcc.dg/lto/modref-3_0.c
+++ b/gcc/testsuite/gcc.dg/lto/modref-3_0.c
@@ -1,5 +1,6 @@
 /* { dg-lto-do run } */
 /* { dg-lto-options { {-O2 -flto-partition=max -fdump-ipa-modref -fno-ipa-sra -fno-ipa-cp -flto} } } */
+/* { dg-require-effective-target linker_plugin } */
 extern void copy (int *a, int *b);
 extern void barrier ();
 extern int *ptr;
diff --git a/gcc/testsuite/gcc.dg/lto/modref-4_0.c b/gcc/testsuite/gcc.dg/lto/modref-4_0.c
--- a/gcc/testsuite/gcc.dg/lto/modref-4_0.c
+++ b/gcc/testsuite/gcc.dg/lto/modref-4_0.c
@@ -1,5 +1,6 @@
 /* { dg-lto-do run } */
 /* { dg-lto-options { {-O2 -flto-partition=max -fdump-ipa-modref -fno-ipa-sra -flto} } } */
+/* { dg-require-effective-target linker_plugin } */
 extern void copy (int *a, int *b);
 extern void barrier ();
 extern int *ptr;
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -9914,6 +9914,7 @@ proc is-effective-target { arg } {
 	  "htm_hw" { set selected [check_htm_hw_available] }
 	  "named_sections" { set selected [check_named_sections_available] }
 	  "gc_sections"{ set selected [check_gc_sections_available] }
+	  "linker_plugin"  { set selected [check_linker_plugin_available] }
 	  "cxa_atexit" { set selected [check_cxa_atexit_available] }
 	  default  { error "unknown effective target keyword `$arg'" }
 	}


[PATCH] testsuite: gdc: Require ucn in gdc.test/runnable/mangle.d etc. [PR104739]

2024-02-14 Thread Rainer Orth
gdc.test/runnable/mangle.d and two other tests come out UNRESOLVED on
Solaris with the native assembler:

UNRESOLVED: gdc.test/runnable/mangle.d   compilation failed to produce 
executable
UNRESOLVED: gdc.test/runnable/mangle.d -shared-libphobos   compilation failed 
to produce executable
UNRESOLVED: gdc.test/runnable/testmodule.d   compilation failed to produce 
executable 
UNRESOLVED: gdc.test/runnable/testmodule.d -shared-libphobos   compilation 
failed to produce executable
UNRESOLVED: gdc.test/runnable/ufcs.d   compilation failed to produce executable
UNRESOLVED: gdc.test/runnable/ufcs.d -shared-libphobos   compilation failed to 
produce executable

Assembler: mangle.d
"/var/tmp//cci9q2Sc.s", line 115 : Syntax error
Near line: "movzbl  test_эльфийские_письмена_9, %eax"
"/var/tmp//cci9q2Sc.s", line 115 : Syntax error
Near line: "movzbl  test_эльфийские_письмена_9, %eax"
"/var/tmp//cci9q2Sc.s", line 115 : Syntax error
Near line: "movzbl  test_эльфийские_письмена_9, %eax"
"/var/tmp//cci9q2Sc.s", line 115 : Syntax error
Near line: "movzbl  test_эльфийские_письмена_9, %eax"
"/var/tmp//cci9q2Sc.s", line 115 : Syntax error
[...]

since /bin/as lacks UCN support.

Iain recently added UNICODE_NAMES: annotations to the affected tests and
those recently were imported into trunk.

This patch handles the DejaGnu side of things, adding

{ dg-require-effective-target ucn }

to those tests on the fly.

Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11 (as and gas each),
and x86_64-pc-linux-gnu.

Ok for trunk.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-03  Rainer Orth  

gcc/testsuite:
PR d/104739
* lib/gdc-utils.exp (gdc-convert-test) : Require
ucn support.

# HG changeset patch
# Parent  5072a8062cf1eac00205b715f4c1af31c9fc45ca
testsuite: gdc: Require ucn in gdc.test/runnable/mangle.d etc. [PR104739]

diff --git a/gcc/testsuite/lib/gdc-utils.exp b/gcc/testsuite/lib/gdc-utils.exp
--- a/gcc/testsuite/lib/gdc-utils.exp
+++ b/gcc/testsuite/lib/gdc-utils.exp
@@ -244,6 +244,7 @@ proc gdc-copy-file { srcdir filename } {
 #   POST_SCRIPT:	Not handled.
 #   REQUIRED_ARGS:	Arguments to add to the compiler command line.
 #   DISABLED:		Not handled.
+#   UNICODE_NAMES:	Requires ucn support.
 #
 
 proc gdc-convert-test { base test } {
@@ -365,6 +366,10 @@ proc gdc-convert-test { base test } {
 	# COMPILABLE_MATH_TEST annotates tests that import the std.math
 	# module.  Which will need skipping if not available on the target.
 	set needs_phobos 1
+	} elseif [regexp -- {UNICODE_NAMES} $copy_line] {
+	# Require ucn support.
+	puts $fdout "// { dg-require-effective-target ucn }"
+
 	}
 }
 


[COMMITTED] testsuite: i386: Skip gcc.target/i386/pr113689-1.c etc. on Solaris [PR113909]

2024-02-14 Thread Rainer Orth
gcc.target/i386/pr113689-[1-3].c FAIL on 64-bit Solaris/x86:

FAIL: gcc.target/i386/pr113689-1.c (test for excess errors)
UNRESOLVED: gcc.target/i386/pr113689-1.c compilation failed to produce 
executable
FAIL: gcc.target/i386/pr113689-2.c (test for excess errors)
UNRESOLVED: gcc.target/i386/pr113689-2.c compilation failed to produce 
executable
FAIL: gcc.target/i386/pr113689-3.c (test for excess errors)
UNRESOLVED: gcc.target/i386/pr113689-3.c compilation failed to produce 
executable

with

Excess errors:
/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.target/i386/pr113689-1.c:43:1: 
sorry, unimplemented: no register available for profiling '-mcmodel=large'

Excess errors:
/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.target/i386/pr113689-2.c:26:1: 
sorry, unimplemented: profiling '-mcmodel=large' with PIC is not supported

Excess errors:
/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.target/i386/pr113689-3.c:15:1: 
sorry, unimplemented: profiling '-mcmodel=large' with PIC is not supported

This happens because i386/sol2.h doesn't define NO_PROFILE_COUNTERS.

So this patch just skips the tests on Solaris.

Tested on i386-pc-solaris2.11.

Committed to trunk.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-13  Rainer Orth  

gcc/testsuite:
PR target/113909
* gcc.target/i386/pr113689-1.c: Skip on Solaris.
* gcc.target/i386/pr113689-2.c: Likewise.
* gcc.target/i386/pr113689-3.c: Likewise.

# HG changeset patch
# Parent  541a06a663a132cbcf1467a248d1229e290a65ab
testsuite: i386: Skip gcc.target/i386/pr113689-1.c etc. on Solaris

diff --git a/gcc/testsuite/gcc.target/i386/pr113689-1.c b/gcc/testsuite/gcc.target/i386/pr113689-1.c
--- a/gcc/testsuite/gcc.target/i386/pr113689-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr113689-1.c
@@ -1,6 +1,7 @@
 /* { dg-do run { target { lp64 && fpic } } } */
 /* { dg-options "-O2 -fno-pic -fprofile -mcmodel=large" } */
 /* { dg-skip-if "PR90698" { *-*-darwin* } } */
+/* { dg-skip-if "PR113909" { *-*-solaris2* } } */
 
 #include 
 
diff --git a/gcc/testsuite/gcc.target/i386/pr113689-2.c b/gcc/testsuite/gcc.target/i386/pr113689-2.c
--- a/gcc/testsuite/gcc.target/i386/pr113689-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr113689-2.c
@@ -1,6 +1,7 @@
 /* { dg-do run { target { lp64 && fpic } } } */
 /* { dg-options "-O2 -fpic -fprofile -mcmodel=large" } */
 /* { dg-skip-if "PR90698" { *-*-darwin* } } */
+/* { dg-skip-if "PR113909" { *-*-solaris2* } } */
 
 __attribute__((noipa))
 void
diff --git a/gcc/testsuite/gcc.target/i386/pr113689-3.c b/gcc/testsuite/gcc.target/i386/pr113689-3.c
--- a/gcc/testsuite/gcc.target/i386/pr113689-3.c
+++ b/gcc/testsuite/gcc.target/i386/pr113689-3.c
@@ -1,6 +1,7 @@
 /* { dg-do run { target { lp64 && fpic } } } */
 /* { dg-options "-O2 -fpic -fprofile -mcmodel=large" } */
 /* { dg-skip-if "PR90698" { *-*-darwin* } } */
+/* { dg-skip-if "PR113909" { *-*-solaris2* } } */
 
 #include 
 


[COMMITTED] testsuite: gfortran: Remove obsolete references to Solaris 9

2024-02-14 Thread Rainer Orth
Some gfortran tests still contain references to long-obsolete Solaris 9.

This patch removes them.

Tested on i386-pc-solaris2.11.

Committed to trunk.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-13  Rainer Orth  

gcc/testsuite:
* gfortran.dg/fmt_en.f90 (dg-output): Don't xfail on
?86-*-solaris2.9*.
* gfortran.dg/fmt_en_rd.f90: Likewise.
* gfortran.dg/fmt_en_rn.f90: Likewise.
* gfortran.dg/fmt_en_ru.f90: Likewise.
* gfortran.dg/fmt_en_rz.f90: Likewise.

# HG changeset patch
# Parent  8c800c0f81d703746d07e942672856e9bf7eaf30
testsuite: Remove obsolete references to Solaris 9

diff --git a/gcc/testsuite/gfortran.dg/fmt_en.f90 b/gcc/testsuite/gfortran.dg/fmt_en.f90
--- a/gcc/testsuite/gfortran.dg/fmt_en.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_en.f90
@@ -180,4 +180,4 @@ contains
 
 end subroutine
 end program
-! { dg-output "All kinds rounded to nearest" { xfail { i?86-*-solaris2.9* hppa*-*-hpux* } } }
+! { dg-output "All kinds rounded to nearest" { xfail hppa*-*-hpux* } }
diff --git a/gcc/testsuite/gfortran.dg/fmt_en_rd.f90 b/gcc/testsuite/gfortran.dg/fmt_en_rd.f90
--- a/gcc/testsuite/gfortran.dg/fmt_en_rd.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_en_rd.f90
@@ -181,5 +181,5 @@ contains
 
 end subroutine
 end program
-! { dg-output "All kinds rounded down" { xfail { i?86-*-solaris2.9* hppa*-*-hpux* } } }
+! { dg-output "All kinds rounded down" { xfail hppa*-*-hpux* } }
 ! { dg-final { cleanup-saved-temps } }
diff --git a/gcc/testsuite/gfortran.dg/fmt_en_rn.f90 b/gcc/testsuite/gfortran.dg/fmt_en_rn.f90
--- a/gcc/testsuite/gfortran.dg/fmt_en_rn.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_en_rn.f90
@@ -181,5 +181,5 @@ contains
 
 end subroutine
 end program
-! { dg-output "All kinds rounded to nearest" { xfail { i?86-*-solaris2.9* hppa*-*-hpux* } } }
+! { dg-output "All kinds rounded to nearest" { xfail hppa*-*-hpux* } }
 ! { dg-final { cleanup-saved-temps } }
diff --git a/gcc/testsuite/gfortran.dg/fmt_en_ru.f90 b/gcc/testsuite/gfortran.dg/fmt_en_ru.f90
--- a/gcc/testsuite/gfortran.dg/fmt_en_ru.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_en_ru.f90
@@ -181,5 +181,5 @@ contains
 
 end subroutine
 end program
-! { dg-output "All kinds rounded up" { xfail { i?86-*-solaris2.9* hppa*-*-hpux* } } }
+! { dg-output "All kinds rounded up" { xfail hppa*-*-hpux* } }
 ! { dg-final { cleanup-saved-temps } }
diff --git a/gcc/testsuite/gfortran.dg/fmt_en_rz.f90 b/gcc/testsuite/gfortran.dg/fmt_en_rz.f90
--- a/gcc/testsuite/gfortran.dg/fmt_en_rz.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_en_rz.f90
@@ -181,5 +181,5 @@ contains
 
 end subroutine
 end program
-! { dg-output "All kinds rounded to zero" { xfail { i?86-*-solaris2.9* hppa*-*-hpux* } } }
+! { dg-output "All kinds rounded to zero" { xfail hppa*-*-hpux* } }
 ! { dg-final { cleanup-saved-temps } }


[PATCH] libgm2: Fix libm2iso/wraptime.cc compilation on Solaris

2024-02-13 Thread Rainer Orth
As it turned out, my patch to complete the libgm2 autoconf macros works
on both Linux/sparc64 and Linux/x86_64, but breaks Solaris bootstrap:

/vol/gcc/src/hg/master/local/libgm2/libm2iso/wraptime.cc: In function 'int 
m2iso_wraptime_gettimeofday(void*, timezone*)':
/vol/gcc/src/hg/master/local/libgm2/libm2iso/wraptime.cc:148:24: error: invalid 
conversion from 'void*' to 'timeval*' [-fpermissive]
  148 |   return gettimeofday (tv, tz);
  |^~
  ||
  |void*
In file included from /usr/include/sys/select.h:27,
 from /usr/include/sys/types.h:665,
 from 
/vol/gcc/src/hg/master/local/libgm2/libm2iso/wraptime.cc:35:
/usr/include/sys/time.h:444:18: note:   initializing argument 1 of 'int 
gettimeofday(timeval*, void*)'
  444 | int gettimeofday(struct timeval *_RESTRICT_KYWD, void *_RESTRICT_KYWD);
  |  ^
/vol/gcc/src/hg/master/local/libgm2/libm2iso/wraptime.cc: In function 'int 
m2iso_wraptime_settimeofday(void*, timezone*)':
/vol/gcc/src/hg/master/local/libgm2/libm2iso/wraptime.cc:165:24: error: invalid 
conversion from 'void*' to 'timeval*' [-fpermissive]
  165 |   return settimeofday (tv, tz);
  |^~
  ||
  |void*
/usr/include/sys/time.h:431:18: note:   initializing argument 1 of 'int 
settimeofday(timeval*, void*)'
  431 | int settimeofday(struct timeval *, void *);
  |  ^~~~

This happens because on Linux only HAVE_[GS]ETTIMEOFDAY is defined,
while Solaris has both that and HAVE_STRUCT_TIMEZONE, selecting
different implementations.

Fixed by casting tv to struct timeval *.

I thought about changing the signatures instead to take a struct timeval
* instead, but that seemed risky given that there's a
HAVE_STRUCT_TIMEVAL, so would probably break other targets.

Bootstrapped without regressions on i386-pc-solaris2.11,
sparc-sun-solaris2.11, and x86_64-pc-linux-gnu.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-13  Rainer Orth  

libgm2:
* libm2iso/wraptime.cc [HAVE_STRUCT_TIMEZONE && HAVE_GETTIMEOFDAY]
(EXPORT(gettimeofday)): Cast tv to struct timeval *.
[HAVE_STRUCT_TIMEZONE && HAVE_SETTIMEOFDAY]
(EXPORT(settimeofday)): Likewise.

# HG changeset patch
# Parent  54196105ece9b22dbacfebb0bebd5c857cd5c19a
libgm2: Fix libm2iso/wraptime.cc compilation on Solaris

diff --git a/libgm2/libm2iso/wraptime.cc b/libgm2/libm2iso/wraptime.cc
--- a/libgm2/libm2iso/wraptime.cc
+++ b/libgm2/libm2iso/wraptime.cc
@@ -145,7 +145,7 @@ EXPORT(KillTM) (struct tm *tv)
 extern "C" int
 EXPORT(gettimeofday) (void *tv, struct timezone *tz)
 {
-  return gettimeofday (tv, tz);
+  return gettimeofday ((struct timeval *) tv, tz);
 }
 #else
 extern "C" int
@@ -162,7 +162,7 @@ EXPORT(gettimeofday) (void *tv, void *tz
 extern "C" int
 EXPORT(settimeofday) (void *tv, struct timezone *tz)
 {
-  return settimeofday (tv, tz);
+  return settimeofday ((struct timeval *) tv, tz);
 }
 #else
 extern "C" int


Re: [PATCH] testsuite: Fix c-c++-common/pr103798-2.c on Solaris [PR113706]

2024-02-13 Thread Rainer Orth
Hi Jason,

> On 2/2/24 10:23, Rainer Orth wrote:
>> c-c++-common/pr103798-2.c FAILs on Solaris when compiled as C++:
>> FAIL: c-c++-common/pr103798-2.c  -std=gnu++14  scan-assembler-not memchr
>> FAIL: c-c++-common/pr103798-2.c  -std=gnu++17  scan-assembler-not memchr
>> FAIL: c-c++-common/pr103798-2.c  -std=gnu++20  scan-assembler-not memchr
>> FAIL: c-c++-common/pr103798-2.c  -std=gnu++98  scan-assembler-not memchr
>> As H.J. analyzed in the PR, Solaris  declares std::memchr, not
>> memchr, which isn't treated as __builtin_memchr.
>
> The problem seems to be not the std::, but that the Solaris string.h
> declares
>
> const void *memchr(const void *, int, size_t);
>
> as specified by the C++ standard, while gcc expects the return type to be
> void* like in C.
>
> This looks like a GCC bug, not Solaris; I'd prefer to xfail the testcase
> rather than work around the compiler bug.

thanks for the analysis.

What I found with my current patch, just the memchr prototype changed to
always return const void *, the test still PASSes as C, but FAILs as
C++.

In the C++ case I get a warning:

/vol/gcc/src/hg/master/local/gcc/testsuite/c-c++-common/pr103798-2.c:10:20: 
warning: declaration of ‘const void* memchr(const void*, int, size_t)’ 
conflicts with built-in declaration ‘void* memchr(const void*, int, unsigned 
int)’ [-Wbuiltin-declaration-mismatch]

Here's the patch to xfail the test instead.

Tested on sparc-sun-solaris2.11 and x86_64-pc-linux-gnu.

Ok for trunk?

Rainer

-- 
---------
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-12  Rainer Orth  

testsuite:
PR tree-optimization/113706
* c-c++-common/pr103798-2.c (scan-assembler-not): xfail for C++ on
Solaris.


# HG changeset patch
# Parent  1409f56e818a7240dd65da9566400f308a996beb
testsuite: Fix c-c++-common/pr103798-2.c on Solaris [PR113706]

diff --git a/gcc/testsuite/c-c++-common/pr103798-2.c b/gcc/testsuite/c-c++-common/pr103798-2.c
--- a/gcc/testsuite/c-c++-common/pr103798-2.c
+++ b/gcc/testsuite/c-c++-common/pr103798-2.c
@@ -27,4 +27,5 @@ main ()
  return 0;
 }
 
-/* { dg-final { scan-assembler-not "memchr" } } */
+/* See PR tree-optimization/113706 for the xfail.  */
+/* { dg-final { scan-assembler-not "memchr" { xfail { c++ && *-*-solaris2* } } } } */


Unreviewed c++ and libgomp testsuite patches

2024-02-12 Thread Rainer Orth
The following patches have remained unreviewed for a week or more:

testsuite: Fix c-c++-common/pr103798-2.c on Solaris [PR113706]
https://gcc.gnu.org/pipermail/gcc-patches/2024-February/644842.html

Probably needs a C++ maintainer, although I've Cc'ed the testcase author
for good measure.

libgomp: testsuite: Don't XPASS libgomp.c/alloc-pinned-1.c etc. on 
non-Linux targets [PR113448]
https://gcc.gnu.org/pipermail/gcc-patches/2024-February/644967.html

Needs a libgomp maintainer (or the testcase author).

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[PATCH] libgm2: Define missing configure macros [PR113888]

2024-02-12 Thread Rainer Orth
As detailed in PR modula2/113888, the 32-bit libm2pim/target.c doesn't
assemble in a Linux/sparc64 multilib build.  However, the root cause is
that the HAVE_EXP10* macros are never defined.  While I was at it, I
checked for other cases where the code uses HAVE_* macros that are
missing from config.h.in.

This patch adds the missing checks, changes the configure checks where
the names don't match what's used in the code, or corrects the code to
use the right names.

So far tested on sparc64-unknown-linux-gnu by building libgm2 (32 and
64-bit) and running the gm2 tests.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-12  Rainer Orth  

libmgm2:
PR modula2/113888
* configure.ac (GM2_CHECK_LIB): Rename gettimeofday guard to
HAVE_GETTIMEOFDAY.
(GM_CHECK_LIB): Check for settimeofday.
(GM2_CHECK_LIB): Check for exp10, exp10f, exp10l in libm.
(AC_CHECK_DECLS): Check for getenv.
* configure, config.h.in: Regenerate.
* libm2pim/dtoa.cc: Rename ,  guards to
HAVE_STRINGS_H, HAVE_STRING_H.
* libm2pim/ldtoa.cc: Likewise.

# HG changeset patch
# Parent  4f9cde8a5ed4b67cc625923887c1fcf610e8234c
libgm2: Define missing configure macros [PR113888]

diff --git a/libgm2/configure.ac b/libgm2/configure.ac
--- a/libgm2/configure.ac
+++ b/libgm2/configure.ac
@@ -297,7 +297,7 @@ GM2_CHECK_LIB([c],[getgid],[GETGID])
 GM2_CHECK_LIB([c],[getopt_long],[GETOPT_LONG])
 GM2_CHECK_LIB([c],[getopt_long_only],[GETOPT_LONG_ONLY])
 GM2_CHECK_LIB([c],[getpid],[GETPID])
-GM2_CHECK_LIB([c],[gettimeofday],[GETTIMEOFD])
+GM2_CHECK_LIB([c],[gettimeofday],[GETTIMEOFDAY])
 GM2_CHECK_LIB([c],[getuid],[GETUID])
 GM2_CHECK_LIB([c],[ioctl],[IOCTL])
 GM2_CHECK_LIB([c],[kill],[KILL])
@@ -311,6 +311,7 @@ GM2_CHECK_LIB([c],[read],[READ])
 GM2_CHECK_LIB([c],[select],[SELECT])
 GM2_CHECK_LIB([c],[setitimer],[SETITIMER])
 GM2_CHECK_LIB([c],[setgid],[SETGID])
+GM2_CHECK_LIB([c],[settimeofday],[SETTIMEOFDAY])
 GM2_CHECK_LIB([c],[setuid],[SETUID])
 GM2_CHECK_LIB([c],[stat],[STAT])
 GM2_CHECK_LIB([c],[strsignal],[STRSIGNAL])
@@ -323,10 +324,15 @@ GM2_CHECK_LIB([c],[unlink],[UNLINK])
 GM2_CHECK_LIB([c],[wait],[WAIT])
 GM2_CHECK_LIB([c],[write],[WRITE])
 
+GM2_CHECK_LIB([m],[exp10],[EXP10])
+GM2_CHECK_LIB([m],[exp10f],[EXP10F])
+GM2_CHECK_LIB([m],[exp10l],[EXP10L])
 GM2_CHECK_LIB([m],[signbit],[SIGNBIT])
 GM2_CHECK_LIB([m],[signbitf],[SIGNBITF])
 GM2_CHECK_LIB([m],[signbitl],[SIGNBITL])
 
+AC_CHECK_DECLS([getenv])
+
 AC_MSG_NOTICE([libgm2 has finished checking target libc and libm contents.])
 
 # We test the host here and later on check the target.
diff --git a/libgm2/libm2pim/dtoa.cc b/libgm2/libm2pim/dtoa.cc
--- a/libgm2/libm2pim/dtoa.cc
+++ b/libgm2/libm2pim/dtoa.cc
@@ -33,11 +33,11 @@ see the files COPYING3 and COPYING.RUNTI
 #define M2EXPORT(FUNC) m2pim ## _M2_dtoa_ ## FUNC
 #define M2LIBNAME "m2pim"
 
-#if defined(HAVE_STRINGS)
+#if defined(HAVE_STRINGS_H)
 #include 
 #endif
 
-#if defined(HAVE_STRING)
+#if defined(HAVE_STRING_H)
 #include 
 #endif
 
diff --git a/libgm2/libm2pim/ldtoa.cc b/libgm2/libm2pim/ldtoa.cc
--- a/libgm2/libm2pim/ldtoa.cc
+++ b/libgm2/libm2pim/ldtoa.cc
@@ -34,11 +34,11 @@ see the files COPYING3 and COPYING.RUNTI
 #define M2EXPORT(FUNC) m2pim ## _M2_ldtoa_ ## FUNC
 #define M2LIBNAME "m2pim"
 
-#if defined(HAVE_STRINGS)
+#if defined(HAVE_STRINGS_H)
 #include 
 #endif
 
-#if defined(HAVE_STRING)
+#if defined(HAVE_STRING_H)
 #include 
 #endif
 


[COMMITTED] testsuite: Don't xfail gcc.dg/debug/dwarf2/inline5.c

2024-02-07 Thread Rainer Orth
gcc.dg/debug/dwarf2/inline5.c has been XPASSing on Solaris (both SPARC
and x86, 32 and 64-bit) with the native assembler since 20210429.
According to gcc-testresults postings, the same is true on AIX.

XPASS: gcc.dg/debug/dwarf2/inline5.c scan-assembler-not (DIE 
(0x([0-9a-f]*)) DW_TAG_lexical_block)[^#/!@;|]*[#/!@;|]+ 
+DW_AT.*DW_TAG_lexical_block)[^#/!@;|x]*x1[^#/!@;|]*[#/!@;|]
 +DW_AT_abstract_origin

This is obviously due to

commit 16683cefc636636ba6fed23fe0de89ed19bc7876
Author: Alexandre Oliva 
Date:   Wed Apr 28 14:07:41 2021 -0300

fix asm-not pattern in dwarf2/inline5.c

This patch thus removes the xfail.

Tested on i386-pc-solaris2.11 (as and gas), sparc-sun-solaris2.11 (as
and gas), and i686-pc-linux-gnu.

Committed to trunk.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-06  Rainer Orth  

gcc/testsuite:
* gcc.dg/debug/dwarf2/inline5.c: Don't xfail scan-assembler-not on
{ aix || solaris2 } && !gas.

# HG changeset patch
# Parent  5e88f4bb18b22df244fb83dd9c18eafa9a34bf70
testsuite: Don't xfail gcc.dg/debug/dwarf2/inline5.c

diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c b/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c
@@ -9,7 +9,7 @@
 /* We do not know which is output first so look for both invalid abstract
origins on the lexical blocks (knowing that the abstract instance has
no attribute following the DW_TAG_lexical_block.  */
-/* { dg-final { scan-assembler-not "\\(DIE \\(0x(\[0-9a-f\]*)\\) DW_TAG_lexical_block\\)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +DW_AT.*DW_TAG_lexical_block\\)\[^#/!@;\\|x\]*x\\1\[^#/!@;\\|\]*\[#/!@;\\|\] +DW_AT_abstract_origin" { xfail { { *-*-aix* || *-*-solaris2.* } && { ! gas } } } } } */
+/* { dg-final { scan-assembler-not "\\(DIE \\(0x(\[0-9a-f\]*)\\) DW_TAG_lexical_block\\)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +DW_AT.*DW_TAG_lexical_block\\)\[^#/!@;\\|x\]*x\\1\[^#/!@;\\|\]*\[#/!@;\\|\] +DW_AT_abstract_origin" } } */
 /* { dg-final { scan-assembler-not "DW_TAG_lexical_block\\)\[^#/!@;\\|x\]*x(\[0-9a-f\]*)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +DW_AT_abstract_origin.*\\(DIE \\(0x\\1\\) DW_TAG_lexical_block\\)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +DW_AT" } } */
 
 int foo (int i)


Re: [PATCH] libssp: Fix gets-chk.c compilation on Solaris

2024-02-06 Thread Rainer Orth
Hi Jakub,

sorry for dropping the ball on this.

> On Mon, Dec 04, 2023 at 11:42:09AM +0100, Rainer Orth wrote:
>> The recent warning patches broke the libssp build on Solaris:
>> 
>> /vol/gcc/src/hg/master/local/libssp/gets-chk.c: In function '__gets_chk':
>> /vol/gcc/src/hg/master/local/libssp/gets-chk.c:67:12: error: implicit
>> declaration of function 'gets'; did you mean 'getw'?
>> [-Wimplicit-function-declaration]
>>67 | return gets (s);
>>   |^~~~
>>   |getw 
>> /vol/gcc/src/hg/master/local/libssp/gets-chk.c:67:12: error: returning
>> 'int' from a function with return type 'char *' makes pointer from
>> integer without a cast [-Wint-conversion]
>>67 | return gets (s);
>>   |^~~~
>> /vol/gcc/src/hg/master/local/libssp/gets-chk.c:74:12: error: returning
>> 'int' from a function with return type 'char *' makes pointer from
>> integer without a cast [-Wint-conversion]
>>74 | return gets (s);
>>   |^~~~
>> 
>> The guard around the gets declaration in gets-chk.c is
>> 
>> #if !(!defined __USE_ISOC11 \
>>   || (defined __cplusplus && __cplusplus <= 201103L))
>> extern char *gets (char *);
>> #endif
>> 
>> __USE_ISOC11 is a glibc-only thing, while Solaris 
>> declares gets like
>> 
>> #if __STDC_VERSION__ < 201112L && __cplusplus < 201402L
>> extern char *gets(char *) __ATTR_DEPRECATED;
>> #endif
>> 
>> If one needs to check __USE_ISO11 at all, one certainly needs to check
>> __STDC_VERSION__ to avoid breaking every non-glibc target.  Besides, I
>> don't see what's the use of checking __cplusplus when compiling a C-only
>> source file.  On top of all that, the double negation makes the guard
>> unnecessarily hard to understand.
>> 
>> I really don't know if it's useful/appropriate to check __USE_ISOC11 and
>> __cplusplus here at all; still I've left both for now.
>> 
>> Here's what I've used to complete the Solaris bootstrap.
>> 
>> Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11,
>> x86_64-pc-linux-gnu, and x86_64-apple-darwin23.1.0.
>> 
>> -- 
>> -
>> Rainer Orth, Center for Biotechnology, Bielefeld University
>> 
>> 
>> 2023-12-03  Rainer Orth  
>> 
>>  libssp:
>>  * gets-chk.c (gets): Avoid double negation.
>>  Also check __STDC_VERSION__ >= 201112L.
>> 
>
>> # HG changeset patch
>> # Parent  334015ab01f6c0e5af821c1e9bc83b8677cc0bfb
>> libssp: Fix gets-chk.c compilation on Solaris
>> 
>> diff --git a/libssp/gets-chk.c b/libssp/gets-chk.c
>> --- a/libssp/gets-chk.c
>> +++ b/libssp/gets-chk.c
>> @@ -51,8 +51,9 @@ see the files COPYING3 and COPYING.RUNTI
>>  # include 
>>  #endif
>>  
>> -#if !(!defined __USE_ISOC11 \
>> -  || (defined __cplusplus && __cplusplus <= 201103L))
>> +#if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)   \
>> + || !defined __USE_ISOC11   \
>> + || (defined __cplusplus && __cplusplus >= 201402L)
>
> The above isn't equivalent.  Avoiding double negation would mean
> #if (defined __USE_ISOC11 \
>  && !(defined __cplusplus && __cplusplus <= 201103L))
> or
> #if (defined __USE_ISOC11 \
>  && (!defined __cplusplus || __cplusplus > 201103L))
> No?
> __USE_ISOC11 is defined as
> /* This is to enable the ISO C11 extension.  */
> #if (defined _ISOC11_SOURCE || defined _ISOC2X_SOURCE \
>  || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L))
> # define __USE_ISOC11   1
> #endif
> where _ISOC11_SOURCE or _ISOC2X_SOURCE are defined whenever _GNU_SOURCE
> is or when user defines them, or __USE_ISOC11 is also defined for
> if __cplusplus >= 201703L.
>
> Obviously, if you add that
>   (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)
> it will mean it will be prototyped always (as I think we compile it without
> any -std= flags).
>
> What about using what we had for glibc (or even better, expect gets
> to be declared for glibc < 2.16) and use what you add for other libraries?
> The file is written and compiled as C, so we don't need to bother with C++
> though.
> So
> #if (defined (__GLIBC_PREREQ) \
>  ? (__GLI

[PATCH] libgcc: Export i386 symbols added after GCC_7.0.0 on Solaris [PR113700]

2024-02-06 Thread Rainer Orth
As reported in the PR, all libgcc x86 symbol versions added after
GCC_7.0.0 were only added to i386/libgcc-glibc.ver, missing all of
libgcc-sol2.ver, libgcc-bsd.ver, and libgcc-darwin.ver.

This patch fixes this for Solaris/x86, adding all of them
(GCC_1[234].0.0) as GCC_14.0.0 to not retroactively change history.

Since this isn't the first time this happens, I've added a note to the
end of libgcc-glibc.ver to request notifying other maintainers in case
of additions.

Tested on i386-pc-solaris2.11.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-01  Rainer Orth  

libgcc:
* config/i386/libgcc-sol2.ver (GCC_14.0.0): Added all symbols from
i386/libgcc-glibc.ver (GCC_12.0.0, GCC_13.0.0, GCC_14.0.0).
* config/i386/libgcc-glibc.ver: Request notifications on updates.

# HG changeset patch
# Parent  e582765ce980229b4c3ae5afc6a28e5aa480cdaf
libgcc: Export i386 symbols added after GCC_7.0.0 on Solaris [PR113700]

diff --git a/libgcc/config/i386/libgcc-glibc.ver b/libgcc/config/i386/libgcc-glibc.ver
--- a/libgcc/config/i386/libgcc-glibc.ver
+++ b/libgcc/config/i386/libgcc-glibc.ver
@@ -236,3 +236,7 @@ GCC_14.0.0 {
   __floatbitintxf
   __floatbitinttf
 }
+
+# Please notify the maintainers of libgcc-{bsd,darwin,sol2}.ver of any
+# additions.  Those version scripts usually need to be kept in sync with
+# libgcc-glibc.ver.
diff --git a/libgcc/config/i386/libgcc-sol2.ver b/libgcc/config/i386/libgcc-sol2.ver
--- a/libgcc/config/i386/libgcc-sol2.ver
+++ b/libgcc/config/i386/libgcc-sol2.ver
@@ -115,3 +115,39 @@ GCC_4.8.0 {
 GCC_7.0.0 {
   __signbittf2
 }
+
+GCC_14.0.0 {
+  # Added to GCC_12.0.0 in i386/libgcc-glibc.
+  __divhc3
+  __mulhc3
+  __eqhf2
+  __nehf2
+  __extendhfdf2
+  __extendhfsf2
+  __extendhftf2
+  __extendhfxf2
+  __fixhfti
+  __fixunshfti
+  __floattihf
+  __floatuntihf
+  __truncdfhf2
+  __truncsfhf2
+  __trunctfhf2
+  __truncxfhf2
+  # Added to GCC_13.0.0 in i386/libgcc-glibc.
+  __extendbfsf2
+  __floattibf
+  __floatuntibf
+  __truncdfbf2
+  __truncsfbf2
+  __trunctfbf2
+  __truncxfbf2
+  __trunchfbf2
+  # Added to GCC_14.0.0 in i386/libgcc-glibc.
+  __fixxfbitint
+  __fixtfbitint
+  __floatbitintbf
+  __floatbitinthf
+  __floatbitintxf
+  __floatbitinttf
+}


[PATCH] libgomp: testsuite: Don't XPASS libgomp.c/alloc-pinned-1.c etc. on non-Linux targets [PR113448]

2024-02-05 Thread Rainer Orth
Two libgomp tests XPASS on Solaris (any non-Linux target actually) since
their introduction:

XPASS: libgomp.c/alloc-pinned-1.c execution test
XPASS: libgomp.c/alloc-pinned-2.c execution test

The problem is that the test just prints

OS unsupported

and exits successfully, while the test is XFAILed:

/* { dg-xfail-run-if "Pinning not implemented on this host" { ! *-*-linux-gnu } 
} */

Fixed by aborting immediately after the message above in the non-Linux
case.

Tested on i386-pc-solaris2.11 and i686-pc-linux-gnu.

Ok for trunk?

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-02  Rainer Orth  

libgomp:
PR testsuite/113448
* testsuite/libgomp.c/alloc-pinned-1.c [!__linux__] (CHECK_SIZE):
Call abort.
* testsuite/libgomp.c/alloc-pinned-2.c [!__linux__] (CHECK_SIZE):
Likewise.

# HG changeset patch
# Parent  b7015efde7d6a48dd520698b470fcaf824758f21
libgomp: testsuite: Fix libgomp.c/alloc-pinned-1.c etc. on non-Linux targets [PR113085]

diff --git a/libgomp/testsuite/libgomp.c/alloc-pinned-1.c b/libgomp/testsuite/libgomp.c/alloc-pinned-1.c
--- a/libgomp/testsuite/libgomp.c/alloc-pinned-1.c
+++ b/libgomp/testsuite/libgomp.c/alloc-pinned-1.c
@@ -45,7 +45,10 @@ get_pinned_mem ()
 }
 #else
 #define PAGE_SIZE 1024 /* unknown */
-#define CHECK_SIZE(SIZE) fprintf (stderr, "OS unsupported\n");
+#define CHECK_SIZE(SIZE) { \
+  fprintf (stderr, "OS unsupported\n"); \
+  abort (); \
+  }
 #define EXPECT_OMP_NULL_ALLOCATOR
 
 int
diff --git a/libgomp/testsuite/libgomp.c/alloc-pinned-2.c b/libgomp/testsuite/libgomp.c/alloc-pinned-2.c
--- a/libgomp/testsuite/libgomp.c/alloc-pinned-2.c
+++ b/libgomp/testsuite/libgomp.c/alloc-pinned-2.c
@@ -45,12 +45,16 @@ get_pinned_mem ()
 }
 #else
 #define PAGE_SIZE 1024 /* unknown */
-#define CHECK_SIZE(SIZE) fprintf (stderr, "OS unsupported\n");
+#define CHECK_SIZE(SIZE) { \
+  fprintf (stderr, "OS unsupported\n"); \
+  abort (); \
+  }
 #define EXPECT_OMP_NULL_ALLOCATOR
 
 int
 get_pinned_mem ()
 {
+  abort ();
   return 0;
 }
 #endif


[PATCH] testsuite: Fix c-c++-common/pr103798-2.c on Solaris [PR113706]

2024-02-02 Thread Rainer Orth
c-c++-common/pr103798-2.c FAILs on Solaris when compiled as C++:

FAIL: c-c++-common/pr103798-2.c  -std=gnu++14  scan-assembler-not memchr
FAIL: c-c++-common/pr103798-2.c  -std=gnu++17  scan-assembler-not memchr
FAIL: c-c++-common/pr103798-2.c  -std=gnu++20  scan-assembler-not memchr
FAIL: c-c++-common/pr103798-2.c  -std=gnu++98  scan-assembler-not memchr

As H.J. analyzed in the PR, Solaris  declares std::memchr, not
memchr, which isn't treated as __builtin_memchr.

To avoid this, this patch declares memchr directly instead of including
.

Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11, and
i686-pc-linux-gnu.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-01  Rainer Orth  

gcc/testsuite:
PR tree-optimization/113706
* c-c++-common/pr103798-2.c (NULL): Define.
(size_t, memchr): Declare instead of including .

# HG changeset patch
# Parent  943813561aef290adb442042f9c4fecd82ee
testsuite: Fix c-c++-common/pr103798-2.c on Solaris [PR113706]

diff --git a/gcc/testsuite/c-c++-common/pr103798-2.c b/gcc/testsuite/c-c++-common/pr103798-2.c
--- a/gcc/testsuite/c-c++-common/pr103798-2.c
+++ b/gcc/testsuite/c-c++-common/pr103798-2.c
@@ -1,7 +1,16 @@
 /* { dg-do run } */
 /* { dg-options "-O2 -fdump-tree-optimized -save-temps" } */
 
-#include 
+#define NULL ((void *) 0)
+
+typedef __SIZE_TYPE__ size_t;
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern void *memchr (const void *, int, size_t);
+#ifdef __cplusplus
+}
+#endif
 
 __attribute__ ((weak))
 int


[COMMITTED] testsuite: i386: Fix gcc.target/i386/sse2-stv-1.c on Solaris/x86

2024-02-02 Thread Rainer Orth
gcc.target/i386/sse2-stv-1.c FAILs on 32-bit Solaris/x86:

FAIL: gcc.target/i386/sse2-stv-1.c scan-assembler-not %[er]sp
FAIL: gcc.target/i386/sse2-stv-1.c scan-assembler-not shldl

The test assumes the Linux/x86 default of -mno-stackrealign, while
32-bit Solaris/x86 default to -mstackrealign.

Fixed by explicitly specifying -mno-stackrealign.

Tested on i386-pc-solaris2.11 and i686-pc-linux-gnu.

Committed to trunk.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-01  Rainer Orth  

gcc/testsuite:
* gcc.target/i386/sse2-stv-1.c (dg-options): Add -mno-stackrealign.

# HG changeset patch
# Parent  1b69d161152aa71acfac15a0d29081f891eb8598
testsuite: i386: Fix gcc.target/i386/sse2-stv-1.c on Solaris/x86

diff --git a/gcc/testsuite/gcc.target/i386/sse2-stv-1.c b/gcc/testsuite/gcc.target/i386/sse2-stv-1.c
--- a/gcc/testsuite/gcc.target/i386/sse2-stv-1.c
+++ b/gcc/testsuite/gcc.target/i386/sse2-stv-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile { target ia32 } } */
-/* { dg-options "-O2 -msse2" } */
+/* { dg-options "-O2 -msse2 -mno-stackrealign" } */
 
 unsigned long long a,b,c,d;
 


[COMMITTED] testsuite: i386: Restrict gcc.target/i386/pr80569.c to gas

2024-02-02 Thread Rainer Orth
gcc.target/i386/pr80569.c FAILs on Solaris/x86 with the native
assembler:

FAIL: gcc.target/i386/pr80569.c (test for excess errors)

Excess errors:
Assembler: pr80569.c 
"/var/tmp//ccm4_iqb.s", line 2 : Illegal mnemonic
Near line: ".code16gcc"
"/var/tmp//ccm4_iqb.s", line 2 : Syntax error
Near line: ".code16gcc"

.code16gcc is a gas extension, so restrict the test to gas.

Tested on i386-pc-solaris2.11 (as and gas) and i686-pc-linux-gnu.

Committed to trunk.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-01  Rainer Orth  

gcc/testsuite:
* gcc.target/i386/pr80569.c: Require gas.

# HG changeset patch
# Parent  1d2125161d5c03f6695de16e4e8608ed7a0d8163
testsuite: i386: Restrict gcc.target/i386/pr80569.c to gas

diff --git a/gcc/testsuite/gcc.target/i386/pr80569.c b/gcc/testsuite/gcc.target/i386/pr80569.c
--- a/gcc/testsuite/gcc.target/i386/pr80569.c
+++ b/gcc/testsuite/gcc.target/i386/pr80569.c
@@ -1,6 +1,8 @@
 /* PR target/80569 */
 /* { dg-do assemble } */
 /* { dg-options "-O2 -m16 -march=haswell" } */
+/* Non-gas assemblers choke on .code16gcc.  */
+/* { dg-require-effective-target gas } */
 
 void load_kernel(void *setup_addr)
 {


[PATCH] testsuite: i386: Fix gcc.target/i386/pr71321.c on Solaris/x86

2024-02-02 Thread Rainer Orth
gcc.target/i386/pr71321.c FAILs on 64-bit Solaris/x86 with the native
assembler:

FAIL: gcc.target/i386/pr71321.c scan-assembler-not lea.*0

The problem is that /bin/as doesn't fully support cfi directives, so the
.eh_frame section is specified explicitly, which includes ".long 0".
The regular expression above includes ".*", which does multiline
matches.  AFAICS those aren't needed here.

This patch changes the RE not to use multiline patches.

Tested on i386-pc-solaris2.11 (as and gas) and i686-pc-linux-gnu.

Ok for trunk?

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-01  Rainer Orth  

gcc/testsuite:
* gcc.target/i386/pr71321.c (scan-assembler-not): Avoid multiline
matches.

# HG changeset patch
# Parent  f2342e77e566f9b5bdb221afd339753dcb4d1723
testsuite: i386: Fix gcc.target/i386/pr71321.c on Solaris/x86

diff --git a/gcc/testsuite/gcc.target/i386/pr71321.c b/gcc/testsuite/gcc.target/i386/pr71321.c
--- a/gcc/testsuite/gcc.target/i386/pr71321.c
+++ b/gcc/testsuite/gcc.target/i386/pr71321.c
@@ -12,4 +12,4 @@ unsigned cvt_to_2digit_ascii(uint8_t i)
 {
   return cvt_to_2digit(i, 10) + 0x0a3030;
 }
-/* { dg-final { scan-assembler-not "lea.*0" } } */
+/* { dg-final { scan-assembler-not "lea\[^\n\r]*0" } } */


[COMMITTED] testsuite: i386: Fix gcc.target/i386/pieces-memcpy-7.c etc. on Solaris/x86

2024-02-02 Thread Rainer Orth
gcc.target/i386/pieces-memcpy-7.c etc. FAIL on 32-bit Solaris/x86:

FAIL: gcc.target/i386/pieces-memcpy-7.c scan-assembler-not %[re]bp
FAIL: gcc.target/i386/pieces-memcpy-8.c scan-assembler-not %[re]bp
FAIL: gcc.target/i386/pieces-memcpy-9.c scan-assembler-not %[re]bp
FAIL: gcc.target/i386/pieces-memset-36.c scan-assembler-not %[re]bp
FAIL: gcc.target/i386/pieces-memset-40.c scan-assembler-not %[re]bp
FAIL: gcc.target/i386/pieces-memset-9.c scan-assembler-not %[re]bp

The problem is that the tests assume -mno-stackrealign while 32-bit
Solaris/x86 defaults to -mstackrealign.

Fixed by explicitly specifying -mno-stackrealign.

Tested on i386-pc-solaris2.11 and i686-pc-linux-gnu.

Committed to trunk.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-01  Rainer Orth  

gcc/testsuite:
* gcc.target/i386/pieces-memcpy-7.c (dg-additional-options): Add
-mno-stackrealign.
* gcc.target/i386/pieces-memcpy-8.c: Likewise.
* gcc.target/i386/pieces-memcpy-9.c: Likewise.
* gcc.target/i386/pieces-memset-36.c: Likewise.
* gcc.target/i386/pieces-memset-40.c: Likewise.
* gcc.target/i386/pieces-memset-9.c: Likewise.

# HG changeset patch
# Parent  ca1b8d9f5c6a848755e05983218d627eb8e5b5fa
testsuite: i386: Fix gcc.target/i386/pieces-memcpy-7.c etc. on Solaris/x86

diff --git a/gcc/testsuite/gcc.target/i386/pieces-memcpy-7.c b/gcc/testsuite/gcc.target/i386/pieces-memcpy-7.c
--- a/gcc/testsuite/gcc.target/i386/pieces-memcpy-7.c
+++ b/gcc/testsuite/gcc.target/i386/pieces-memcpy-7.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
-/* Cope with --enable-frame-pointer.  */
-/* { dg-additional-options "-fomit-frame-pointer" } */
+/* Cope with --enable-frame-pointer, Solaris/x86 -mstackrealign default.  */
+/* { dg-additional-options "-fomit-frame-pointer -mno-stackrealign" } */
 
 void
 foo (int a1, int a2, int a3, int a4, int a5, int a6, char *dst, char *src)
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memcpy-8.c b/gcc/testsuite/gcc.target/i386/pieces-memcpy-8.c
--- a/gcc/testsuite/gcc.target/i386/pieces-memcpy-8.c
+++ b/gcc/testsuite/gcc.target/i386/pieces-memcpy-8.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -mno-avx2 -mavx -mtune=generic" } */
-/* Cope with --enable-frame-pointer.  */
-/* { dg-additional-options "-fomit-frame-pointer" } */
+/* Cope with --enable-frame-pointer, Solaris/x86 -mstackrealign default.  */
+/* { dg-additional-options "-fomit-frame-pointer -mno-stackrealign" } */
 
 void
 foo (int a1, int a2, int a3, int a4, int a5, int a6, char *dst, char *src)
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memcpy-9.c b/gcc/testsuite/gcc.target/i386/pieces-memcpy-9.c
--- a/gcc/testsuite/gcc.target/i386/pieces-memcpy-9.c
+++ b/gcc/testsuite/gcc.target/i386/pieces-memcpy-9.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -mavx512f -mtune=generic" } */
-/* Cope with --enable-frame-pointer.  */
-/* { dg-additional-options "-fomit-frame-pointer" } */
+/* Cope with --enable-frame-pointer, Solaris/x86 -mstackrealign default.  */
+/* { dg-additional-options "-fomit-frame-pointer -mno-stackrealign" } */
 
 void
 foo (int a1, int a2, int a3, int a4, int a5, int a6, char *dst, char *src)
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-36.c b/gcc/testsuite/gcc.target/i386/pieces-memset-36.c
--- a/gcc/testsuite/gcc.target/i386/pieces-memset-36.c
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-36.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -mno-avx512f -mavx2 -mtune=generic" } */
-/* Cope with --enable-frame-pointer.  */
-/* { dg-additional-options "-fomit-frame-pointer" } */
+/* Cope with --enable-frame-pointer, Solaris/x86 -mstackrealign default.  */
+/* { dg-additional-options "-fomit-frame-pointer -mno-stackrealign" } */
 
 extern char *dst;
 
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-40.c b/gcc/testsuite/gcc.target/i386/pieces-memset-40.c
--- a/gcc/testsuite/gcc.target/i386/pieces-memset-40.c
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-40.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -mno-avx512f -mavx2 -mtune=sandybridge" } */
-/* Cope with --enable-frame-pointer.  */
-/* { dg-additional-options "-fomit-frame-pointer" } */
+/* Cope with --enable-frame-pointer, Solaris/x86 -mstackrealign default.  */
+/* { dg-additional-options "-fomit-frame-pointer -mno-stackrealign" } */
 
 extern char *dst;
 
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-9.c b/gcc/testsuite/gcc.target/i386/pieces-memset-9.c
--- a/gcc/testsuite/gcc.target/i386/pieces-memset-9.c
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-9.c
@@ -1,7 +1,7 @@
 /* { dg-do

[COMMITTED] testsuite: i386: Fix gcc.target/i386/apx-ndd-cmov.c on Solaris/x86

2024-02-02 Thread Rainer Orth
gcc.target/i386/apx-ndd-cmov.c FAILs on 64-bit Solaris/x86 with the
native assembler:

FAIL: gcc.target/i386/apx-ndd-cmov.c scan-assembler-times cmove[^\\n\\r]*, %eax 
1
FAIL: gcc.target/i386/apx-ndd-cmov.c scan-assembler-times cmovge[^\\n\\r]*, 
%eax 1

The gas vs. as difference is

-   cmove   c+4(%rip), %esi, %eax
+   cmovl.e c+4(%rip), %esi, %eax

-   cmovge  %ecx, %edx, %eax
+   cmovl.ge%ecx, %edx, %eax

This patch accounts for both forms.

Tested on i386-pc-solaris2.11 (as and gas) and i686-pc-linux-gnu.

Committed to trunk.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-01  Rainer Orth  

gcc/testsuite:
* gcc.target/i386/apx-ndd-cmov.c (scan-assembler-times): Allow for
cmovl.e, cmovl.ge.

# HG changeset patch
# Parent  b7b9c1365b7c54f5c0e618608af26512175c
testsuite: i386: Fix gcc.target/i386/apx-ndd-cmov.c on Solaris/x86

diff --git a/gcc/testsuite/gcc.target/i386/apx-ndd-cmov.c b/gcc/testsuite/gcc.target/i386/apx-ndd-cmov.c
--- a/gcc/testsuite/gcc.target/i386/apx-ndd-cmov.c
+++ b/gcc/testsuite/gcc.target/i386/apx-ndd-cmov.c
@@ -1,7 +1,7 @@
 /* { dg-do compile { target { ! ia32 } } } */
 /* { dg-options "-O2 -m64 -mapxf" } */
-/* { dg-final { scan-assembler-times "cmove\[^\n\r]*, %eax" 1 } } */
-/* { dg-final { scan-assembler-times "cmovge\[^\n\r]*, %eax" 1 } } */
+/* { dg-final { scan-assembler-times "cmov(l\.)?e\[^\n\r]*, %eax" 1 } } */
+/* { dg-final { scan-assembler-times "cmov(l\.)?ge\[^\n\r]*, %eax" 1 } } */
 
 unsigned int c[4];
 


Re: [PATCH] c-family: Fix ICE with large column number after restoring a PCH [PR105608]

2024-02-01 Thread Rainer Orth
Hi Lewis,

> On Fri, Jan 26, 2024 at 04:16:54PM -0500, Jason Merrill wrote:
>> On 12/5/23 20:52, Lewis Hyatt wrote:
>> > Hello-
>> > 
>> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105608
>> > 
>> > There are two related issues here really, a regression since GCC 11 where 
>> > we
>> > can ICE after restoring a PCH, and a deeper issue with bogus locations
>> > assigned to macros that were defined prior to restoring a PCH.  This patch
>> > fixes the ICE regression with a simple change, and I think it's appropriate
>> > for GCC 14 as well as backport to 11, 12, 13. The bad locations (wrong, but
>> > not generally causing an ICE, and mostly affecting only the output of
>> > -Wunused-macros) are not as problematic, and will be harder to fix. I could
>> > take a stab at that for GCC 15. In the meantime the patch adds XFAILed
>> > tests for the wrong locations (as well as passing tests for the regression
>> > fix). Does it look OK please? Bootstrap + regtest all languages on x86-64
>> > Linux. Thanks!
>> 
>> OK for trunk and branches, thanks!
>>
>
> Thanks for the review! That is all taken care of. I have one more request if
> you don't mind please... There have been some further comments on the PR
> indicating that the new xfailed testcase I added is failing in an unexpected
> way on at least one architecture. To recap, the idea here was that
>
> 1) libcpp needs new logic to be able to output correct locations for this
> case. That will be some new code that is suitable for stage 1, not now.
>
> 2) In the meantime, we fixed things up enough to avoid an ICE that showed up
> in GCC 11, and added an xfailed testcase to remind about #1.
>
> The problem is that, the reason that libcpp outputs the wrong locations, is
> that it has always used a location from the old line_map instance to index
> into the new line_map instance, and so the exact details of the wrong
> locations it outputs depend on the state of those two line maps, which may
> differ depending on system includes and things like that. So I was hoping to
> make one further one-line change to libcpp, not yet to output correct
> locations, but at least to output one which is the same always and doesn't
> depend on random things. This would assign all restored macros to a
> consistent location, one line following the #include that triggered the PCH
> process. I think this probably shouldn't be backported but it would be nice
> to get into GCC 14, while nothing critical, at least it would avoid the new
> test failure that's being reported. But more generally, I think using a
> location from a totally different line map is dangerous and could have worse
> consequences that haven't been seen yet. Does it look OK please? Thanks!

FWIW, I've tested this (the initial) version of this patch on
sparc-sun-solaris2.11 (PASSes as before) and i386-pc-solaris2.11 (PASSes
now unlike before).

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: Unreviewed patches

2024-02-01 Thread Rainer Orth
Hi Uros,

> On Wed, Jan 31, 2024 at 3:04 PM Rainer Orth  
> wrote:
>>
>> Three patches have remained unreviewed for a week or more:
>>
>> c++: Fix g++.dg/ext/attr-section2.C etc. with Solaris/SPARC as
>> https://gcc.gnu.org/pipermail/gcc-patches/2024-January/643434.html
>>
>> This one may even be obvious.

I do claim that now and have installed the patch.

>> testsuite: i386: Fix gcc.target/i386/pr70321.c on 32-bit Solaris/x86
>> https://gcc.gnu.org/pipermail/gcc-patches/2024-January/643771.html
>>
>> testsuite: i386: Fix gcc.target/i386/avx512vl-stv-rotatedi-1.c on
>> 32-bit Solaris/x86
>> https://gcc.gnu.org/pipermail/gcc-patches/2024-January/643774.html
>>
>> Those two require an x86 maintainer.
>
> OK for x86 patches, I'd say that these two fall under Solaris
> maintainership (if not obvious, after all).

I've always been careful when touching files that affect non-Solaris
targets, in case a maintainer sees a better solution or finds fault with
mine.

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[COMMITTED] Link shared libasan with -z now on Solaris

2024-02-01 Thread Rainer Orth
g++.dg/asan/default-options-1.C FAILs on Solaris/SPARC and x86:

FAIL: g++.dg/asan/default-options-1.C   -O0  execution test
FAIL: g++.dg/asan/default-options-1.C   -O1  execution test
FAIL: g++.dg/asan/default-options-1.C   -O2  execution test
FAIL: g++.dg/asan/default-options-1.C   -O2 -flto  execution test
FAIL: g++.dg/asan/default-options-1.C   -O2 -flto -flto-partition=none  
execution test
FAIL: g++.dg/asan/default-options-1.C   -O3 -g  execution test
FAIL: g++.dg/asan/default-options-1.C   -Os  execution test

The failure is always the same:

AddressSanitizer: CHECK failed: asan_rtl.cpp:397 "((!AsanInitIsRunning() && 
"ASan init calls itself!")) != (0)" (0x0, 0x0) (tid=1)

This happens because libasan makes unportable assumptions about
initialization order that don't hold on Solaris.  The problem has
already been fixed in clang by

[Driver] Link shared asan runtime lib with -z now on Solaris/x86
https://reviews.llvm.org/D156325

where it was way more prevalent.

This patch applies the same fix to gcc.

Tested on i386-pc-solaris2.11 (ld and gld) and sparc-sun-solaris2.11.

Committed to trunk.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-01-30  Rainer Orth  

gcc:
* config/sol2.h (LIBASAN_EARLY_SPEC): Add -z now unless
-static-libasan.  Add missing whitespace.

# HG changeset patch
# Parent  613872ca097917ba43515f110e45a9ec0fc176fa
Link shared libasan with -z now on Solaris

diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -255,7 +255,7 @@ along with GCC; see the file COPYING3.  
   " %{!shared:libasan_preinit%O%s} \
 %{static-libasan:%{!shared: -Bstatic "\
 LD_WHOLE_ARCHIVE_OPTION " -lasan " LD_NO_WHOLE_ARCHIVE_OPTION \
-"-Bdynamic}}%{!static-libasan:-lasan}"
+" -Bdynamic}}%{!static-libasan:-z now -lasan}"
 
 /* Error out on -fsanitize=thread|leak.  */
 #define LIBTSAN_EARLY_SPEC "\


Unreviewed patches

2024-01-31 Thread Rainer Orth
Three patches have remained unreviewed for a week or more:

c++: Fix g++.dg/ext/attr-section2.C etc. with Solaris/SPARC as
https://gcc.gnu.org/pipermail/gcc-patches/2024-January/643434.html

This one may even be obvious.

testsuite: i386: Fix gcc.target/i386/pr70321.c on 32-bit Solaris/x86
https://gcc.gnu.org/pipermail/gcc-patches/2024-January/643771.html

testsuite: i386: Fix gcc.target/i386/avx512vl-stv-rotatedi-1.c on 
32-bit Solaris/x86
https://gcc.gnu.org/pipermail/gcc-patches/2024-January/643774.html

Those two require an x86 maintainer.

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[PATCH] testsuite: i386: Fix gcc.target/i386/pr38534-1.c etc. on Solaris/x86

2024-01-31 Thread Rainer Orth
The gcc.target/i386/pr38534-1.c etc. tests FAIL on 32 and 64-bit
Solaris/x86:

FAIL: gcc.target/i386/pr38534-1.c scan-assembler-not push
FAIL: gcc.target/i386/pr38534-2.c scan-assembler-not push
FAIL: gcc.target/i386/pr38534-3.c scan-assembler-not push
FAIL: gcc.target/i386/pr38534-4.c scan-assembler-not push

The tests assume the Linux/x86 default of -fomit-frame-pointer, while
Solaris/x86 defaults to -fno-omit-frame-pointer.

Fixed by specifying -fomit-frame-pointer explicitly.

Tested on i386-pc-solaris2.11 and i686-pc-linux-gnu.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-01-30  Rainer Orth  

gcc/testsuite:
* gcc.target/i386/pr38534-1.c: Add -fomit-frame-pointer to
dg-options.
* gcc.target/i386/pr38534-2.c: Likewise.
* gcc.target/i386/pr38534-3.c: Likewise.
* gcc.target/i386/pr38534-4.c: Likewise.

# HG changeset patch
# Parent  002cd7277f8ae2677784c606659300d27e7342a4
testsuite: i386: Fix gcc.target/i386/pr38534-1.c etc. on Solaris/x86

diff --git a/gcc/testsuite/gcc.target/i386/pr38534-1.c b/gcc/testsuite/gcc.target/i386/pr38534-1.c
--- a/gcc/testsuite/gcc.target/i386/pr38534-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr38534-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -mtune-ctrl=^prologue_using_move,^epilogue_using_move" } */
+/* { dg-options "-O2 -mtune-ctrl=^prologue_using_move,^epilogue_using_move -fomit-frame-pointer" } */
 
 #define ARRAY_SIZE 256
 
diff --git a/gcc/testsuite/gcc.target/i386/pr38534-2.c b/gcc/testsuite/gcc.target/i386/pr38534-2.c
--- a/gcc/testsuite/gcc.target/i386/pr38534-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr38534-2.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -mtune-ctrl=^prologue_using_move,^epilogue_using_move" } */
+/* { dg-options "-O2 -mtune-ctrl=^prologue_using_move,^epilogue_using_move -fomit-frame-pointer" } */
 
 extern void bar (void) __attribute__ ((no_callee_saved_registers));
 extern void fn (void) __attribute__ ((noreturn));
diff --git a/gcc/testsuite/gcc.target/i386/pr38534-3.c b/gcc/testsuite/gcc.target/i386/pr38534-3.c
--- a/gcc/testsuite/gcc.target/i386/pr38534-3.c
+++ b/gcc/testsuite/gcc.target/i386/pr38534-3.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -mtune-ctrl=^prologue_using_move,^epilogue_using_move" } */
+/* { dg-options "-O2 -mtune-ctrl=^prologue_using_move,^epilogue_using_move -fomit-frame-pointer" } */
 
 typedef void (*fn_t) (void) __attribute__ ((no_callee_saved_registers));
 extern fn_t bar;
diff --git a/gcc/testsuite/gcc.target/i386/pr38534-4.c b/gcc/testsuite/gcc.target/i386/pr38534-4.c
--- a/gcc/testsuite/gcc.target/i386/pr38534-4.c
+++ b/gcc/testsuite/gcc.target/i386/pr38534-4.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -mtune-ctrl=^prologue_using_move,^epilogue_using_move" } */
+/* { dg-options "-O2 -mtune-ctrl=^prologue_using_move,^epilogue_using_move -fomit-frame-pointer" } */
 
 typedef void (*fn_t) (void) __attribute__ ((no_callee_saved_registers));
 extern void fn (void) __attribute__ ((noreturn));


[PATCH] testsuite: i386: Fix gcc.target/i386/no-callee-saved-1.c etc. on Solaris/x86

2024-01-31 Thread Rainer Orth
The gcc.target/i386/no-callee-saved-[12].c tests FAIL on Solaris/x86:

FAIL: gcc.target/i386/no-callee-saved-1.c scan-assembler-not push
FAIL: gcc.target/i386/no-callee-saved-2.c scan-assembler-not push

In both cases, the test expect the Linux/x86 default of
-fomit-frame-pointer, while Solaris/x86 defaults to
-fno-omit-frame-pointer.

So this patch explicitly specifies -fomit-frame-pointer.

Tested on i386-pc-solaris2.11 (as and gas) and i686-pc-linux-gnu.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-01-30  Rainer Orth  

gcc/testsuite:
* gcc.target/i386/no-callee-saved-1.c: Add -fomit-frame-pointer to
dg-options.
* gcc.target/i386/no-callee-saved-2.c: Likewise.

# HG changeset patch
# Parent  6cd45b5f542c222744120356f69afdaebd618627
testsuite: i386: Fix gcc.target/i386/no-callee-saved-1.c etc. on Solaris/x86

diff --git a/gcc/testsuite/gcc.target/i386/no-callee-saved-1.c b/gcc/testsuite/gcc.target/i386/no-callee-saved-1.c
--- a/gcc/testsuite/gcc.target/i386/no-callee-saved-1.c
+++ b/gcc/testsuite/gcc.target/i386/no-callee-saved-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -mtune-ctrl=^prologue_using_move,^epilogue_using_move" } */
+/* { dg-options "-O2 -mtune-ctrl=^prologue_using_move,^epilogue_using_move -fomit-frame-pointer" } */
 
 extern int bar (int)
 #ifndef __x86_64__
diff --git a/gcc/testsuite/gcc.target/i386/no-callee-saved-2.c b/gcc/testsuite/gcc.target/i386/no-callee-saved-2.c
--- a/gcc/testsuite/gcc.target/i386/no-callee-saved-2.c
+++ b/gcc/testsuite/gcc.target/i386/no-callee-saved-2.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -mtune-ctrl=^prologue_using_move,^epilogue_using_move" } */
+/* { dg-options "-O2 -mtune-ctrl=^prologue_using_move,^epilogue_using_move -fomit-frame-pointer" } */
 
 extern int bar (int) __attribute__ ((no_caller_saved_registers))
 #ifndef __x86_64__


[PATCH] testsuite: i386: Disable .eh_frame in gcc.target/i386/auto-init-5.c etc.

2024-01-31 Thread Rainer Orth
The gcc.target/i386/auto-init-5.c and gcc.target/i386/auto-init-6.c
tests FAIL on 64-bit Solaris/x86 with the native assembler:

FAIL: gcc.target/i386/auto-init-5.c scan-assembler-times .long\\t0 14
FAIL: gcc.target/i386/auto-init-6.c scan-assembler-times long\\t0 8

/bin/as doesn't fully support the CFI directives, so the .eh_frame
sections are emitted directly and contain .long.  Since .eh_frame
doesn't matter for those tests, this patch disables its generation in
the first place.

Tested on i386-pc-solaris2.11 (as and gas) and i686-pc-linux-gnu.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-01-30  Rainer Orth  

gcc/testsuite:
* gcc.target/i386/auto-init-5.c: Add
-fno-asynchronous-unwind-tables to dg-options.
* gcc.target/i386/auto-init-6.c: Likewise.

# HG changeset patch
# Parent  5486f016175658d0c7c2de48c893e9fbd68d3493
testsuite: i386: Disable .eh_frame in gcc.target/i386/auto-init-5.c etc.

diff --git a/gcc/testsuite/gcc.target/i386/auto-init-5.c b/gcc/testsuite/gcc.target/i386/auto-init-5.c
--- a/gcc/testsuite/gcc.target/i386/auto-init-5.c
+++ b/gcc/testsuite/gcc.target/i386/auto-init-5.c
@@ -1,6 +1,6 @@
 /* Verify zero initialization for complex type automatic variables.  */
 /* { dg-do compile } */
-/* { dg-options "-ftrivial-auto-var-init=zero" } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fno-asynchronous-unwind-tables" } */
 
 
 _Complex long double result;
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-6.c b/gcc/testsuite/gcc.target/i386/auto-init-6.c
--- a/gcc/testsuite/gcc.target/i386/auto-init-6.c
+++ b/gcc/testsuite/gcc.target/i386/auto-init-6.c
@@ -2,7 +2,7 @@
 /* Note, _Complex long double is initialized to zeroes due to the current
implemenation limitation.  */
 /* { dg-do compile } */
-/* { dg-options "-ftrivial-auto-var-init=pattern -march=x86-64 -mtune=generic -msse" } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -march=x86-64 -mtune=generic -msse -fno-asynchronous-unwind-tables" } */
 
 
 _Complex long double result;


[COMMITTED] testsuite: Require ucn in g++.dg/cpp0x/udlit-extended-id-1.C

2024-01-31 Thread Rainer Orth
g++.dg/cpp0x/udlit-extended-id-1.C FAILs on Solaris/SPARC and x86 with
the native assembler:

UNRESOLVED: g++.dg/cpp0x/udlit-extended-id-1.C  -std=c++14 compilation failed 
to produce executable
FAIL: g++.dg/cpp0x/udlit-extended-id-1.C  -std=c++17 (test for excess errors)
UNRESOLVED: g++.dg/cpp0x/udlit-extended-id-1.C  -std=c++17 compilation failed 
to produce executable
FAIL: g++.dg/cpp0x/udlit-extended-id-1.C  -std=c++20 (test for excess errors)
UNRESOLVED: g++.dg/cpp0x/udlit-extended-id-1.C  -std=c++20 compilation failed 
to produce executable

/bin/as doesn't support UCN identifiers:

/usr/ccs/bin/as: "/var/tmp//ccCl_9fa.s", line 4: error: invalid character (0xcf)
/usr/ccs/bin/as: "/var/tmp//ccCl_9fa.s", line 4: error: invalid character (0x80)
/usr/ccs/bin/as: "/var/tmp//ccCl_9fa.s", line 4: error: statement syntax
/usr/ccs/bin/as: "/var/tmp//ccCl_9fa.s", line 4: error: statement syntax
[...]

To avoid this, this patch requires ucn support.

Tested on i386-pc-solaris2.11 (as and gas), sparc-sun-solaris2.11 (as
and gas), and i686-pc-linux-gnu.

Committed to trunk.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-01-30  Rainer Orth  

gcc/testsuite:
* g++.dg/cpp0x/udlit-extended-id-1.C: Require ucn support.

# HG changeset patch
# Parent  b19044614bf18d15d2ccd8b2b26450678f93acaf
testsuite: Require ucn in g++.dg/cpp0x/udlit-extended-id-1.C

diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-extended-id-1.C b/gcc/testsuite/g++.dg/cpp0x/udlit-extended-id-1.C
--- a/gcc/testsuite/g++.dg/cpp0x/udlit-extended-id-1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/udlit-extended-id-1.C
@@ -1,5 +1,6 @@
 // { dg-do run { target c++11 } }
 // { dg-additional-options "-Wno-error=normalized" }
+// { dg-require-effective-target ucn }
 #include 
 #include 
 using namespace std;


Re: [PATCH] testsuite/vect: Add target checks to refined patterns [PR113558]

2024-01-24 Thread Rainer Orth
Hi Jeff,

> On 1/24/24 07:40, Robin Dapp wrote:
>> Hi,
>> on Solaris/SPARC several vector tests appeared to be regressing.  They
>> were never vectorized but the checks before r14-3612-ge40edf64995769
>> would match regardless if a loop was actually vectorized or not.
>> The refined checks only match a successful vectorization attempt
>> but are run unconditionally.  This patch adds target checks to them.
>> Bootstrapped (unnecessarily) and regtested on x86, aarch64 and
>> power10.  Regtested on riscv and (the previous version that
>> missed vect-reduc-pattern-2a.c) on Solaris/SPARC by Rainer Orth.
>> Is this OK if Rainer's second run is successful?
>> Regards
>>   Robin
>> gcc/testsuite/ChangeLog:
>>  PR testsuite/113558
>>  * gcc.dg/vect/no-scevccp-outer-7.c: Add target check.
>>  * gcc.dg/vect/vect-outer-4c-big-array.c: Ditto.
>>  * gcc.dg/vect/vect-reduc-dot-s16a.c: Ditto.
>>  * gcc.dg/vect/vect-reduc-dot-s8a.c: Ditto.
>>  * gcc.dg/vect/vect-reduc-dot-s8b.c: Ditto.
>>  * gcc.dg/vect/vect-reduc-dot-u16b.c: Ditto.
>>  * gcc.dg/vect/vect-reduc-dot-u8a.c: Ditto.
>>  * gcc.dg/vect/vect-reduc-dot-u8b.c: Ditto.
>>  * gcc.dg/vect/vect-reduc-pattern-1a.c: Ditto.
>>  * gcc.dg/vect/vect-reduc-pattern-1b-big-array.c: Ditto.
>>  * gcc.dg/vect/vect-reduc-pattern-1c-big-array.c: Ditto.
>>  * gcc.dg/vect/vect-reduc-pattern-2a.c: Ditto.
>>  * gcc.dg/vect/vect-reduc-pattern-2b-big-array.c: Ditto.
>>  * gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c: Ditto.
> Yes, OK if Rainer's run is successful.  If you need to make similiar
> changes to other tests, consider them pre-approved.

sparc-sun-solaris2.11 testing just completed successfully.

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[PATCH] testsuite: i386: Don't restrict gcc.dg/vect/vect-simd-clone-16c.c etc. to it686 [PR113556]

2024-01-24 Thread Rainer Orth
A couple of gcc.dg/vect/vect-simd-clone-1*.c tests FAIL on 32-bit
Solaris/x86 since 20230222:

FAIL: gcc.dg/vect/vect-simd-clone-16c.c scan-tree-dump-times vect "[nr] 
[^n]* = foo.simdclone" 2
FAIL: gcc.dg/vect/vect-simd-clone-16d.c scan-tree-dump-times vect "[nr] 
[^n]* = foo.simdclone" 2
FAIL: gcc.dg/vect/vect-simd-clone-17c.c scan-tree-dump-times vect "[nr] 
[^n]* = foo.simdclone" 2
FAIL: gcc.dg/vect/vect-simd-clone-17d.c scan-tree-dump-times vect "[nr] 
[^n]* = foo.simdclone" 2
FAIL: gcc.dg/vect/vect-simd-clone-18c.c scan-tree-dump-times vect "[nr] 
[^n]* = foo.simdclone" 2
FAIL: gcc.dg/vect/vect-simd-clone-18d.c scan-tree-dump-times vect "[nr] 
[^n]* = foo.simdclone" 2

The problem is that the 32-bit Solaris/x86 triple still uses i386,
although gcc defaults to -mpentium4.  However, the tests only handle
x86_64* and i686*, although the tests don't seem to require some
specific ISA extension not covered by vect_simd_clones.

To fix this, the tests now allow generic i?86.  At the same time, I've
removed the wildcards from x86_64* and i686* since DejaGnu uses the
canonical forms.

Tested on i386-pc-solaris2.11 and i686-pc-linux-gnu.

Ok for trunk?

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-01-24  Rainer Orth  

gcc/testsuite:
PR target/113556
* gcc.dg/vect/vect-simd-clone-16c.c: Don't wildcard x86_64 in
target specs.  Allow any i?86 target instead of i686 only.
* gcc.dg/vect/vect-simd-clone-16d.c: Likewise.
* gcc.dg/vect/vect-simd-clone-17c.c: Likewise.
* gcc.dg/vect/vect-simd-clone-17d.c: Likewise.
* gcc.dg/vect/vect-simd-clone-18c.c: Likewise.
* gcc.dg/vect/vect-simd-clone-18d.c: Likewise.

# HG changeset patch
# Parent  fdb3dfc0639b142e4a092ef5f9c68954d3e5bf74
testsuite: i386: Don't restrict gcc.dg/vect/vect-simd-clone-16c.c etc. to it686 [PR113556]

diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16c.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16c.c
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16c.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16c.c
@@ -7,11 +7,11 @@
 
 /* Ensure the the in-branch simd clones are used on targets that support them.
Some targets use another call for the epilogue loops.  */
-/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 2 "vect" { target { ! { x86_64*-*-* || { i686*-*-* || aarch64*-*-* } } } } } } */
+/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 2 "vect" { target { ! { x86_64-*-* || { i?86-*-* || aarch64*-*-* } } } } } } */
 /* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 3 "vect" { target { aarch64*-*-* } } } } */
 
 /* x86_64 fails to use in-branch clones for TYPE=short.  */
-/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 0 "vect" { target x86_64*-*-* i686*-*-* } } } */
+/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 0 "vect" { target x86_64-*-* i?86-*-* } } } */
 
 /* The LTO test produces two dump files and we scan the wrong one.  */
 /* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16d.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16d.c
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16d.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16d.c
@@ -7,11 +7,11 @@
 
 /* Ensure the the in-branch simd clones are used on targets that support them.
Some targets use another call for the epilogue loops.  */
-/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 2 "vect" { target { ! { x86_64*-*-* || { i686*-*-* || aarch64*-*-* } } } } } } */
+/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 2 "vect" { target { ! { x86_64-*-* || { i?86-*-* || aarch64*-*-* } } } } } } */
 /* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 3 "vect" { target { aarch64*-*-* } } } } */
 
 /* x86_64 fails to use in-branch clones for TYPE=char.  */
-/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 0 "vect" { target x86_64*-*-* i686*-*-* } } } */
+/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 0 "vect" { target x86_64-*-* i?86-*-* } } } */
 
 /* The LTO test produces two dump files and we scan the wrong one.  */
 /* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17c.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17c.c
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17c.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17c.c
@@ -7,11 +7,11 @@
  

[PATCH] testsuite: i386: Fix gcc.target/i386/avx512vl-stv-rotatedi-1.c on 32-bit Solaris/x86

2024-01-24 Thread Rainer Orth
gcc.target/i386/avx512vl-stv-rotatedi-1.c FAILs on 32-bit Solaris/x86
since its introduction in

commit 4814b63c3c2326cb5d7baa63882da60ac011bd97
Author: Roger Sayle 
Date:   Mon Jul 10 09:04:29 2023 +0100

i386: Add AVX512 support for STV of SI/DImode rotation by constant.

FAIL: gcc.target/i386/avx512vl-stv-rotatedi-1.c scan-assembler-times vpro[lr]q 
29

While the test depends on -mstv, 32-bit Solaris/x86 defaults to
-mstackrealign which is incompatible.

The patch thus specifies -mstv -mno-stackrealign explicitly.

Tested on i386-pc-solaris2.11 and i686-pc-linux-gnu.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-01-23  Rainer Orth  

gcc/testsuite:
* gcc.target/i386/avx512vl-stv-rotatedi-1.c: Add -mstv
-mno-stackrealign to dg-options.

# HG changeset patch
# Parent  b787665f90dfbd5be1b00d411675d6fd896f7a9a
testsuite: i386: Fix gcc.target/i386/avx512vl-stv-rotatedi-1.c on 32-bit Solaris/x86

diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-stv-rotatedi-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-stv-rotatedi-1.c
--- a/gcc/testsuite/gcc.target/i386/avx512vl-stv-rotatedi-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-stv-rotatedi-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile { target ia32 } } */
-/* { dg-options "-O2 -mavx512vl" } */
+/* { dg-options "-O2 -mavx512vl -mstv -mno-stackrealign" } */
 
 unsigned long long rot1(unsigned long long x) { return (x>>1) | (x<<63); }
 unsigned long long rot2(unsigned long long x) { return (x>>2) | (x<<62); }


[PATCH] testsuite: i386: Fix gcc.target/i386/pr80833-1.c on 32-bit Solaris/x86

2024-01-24 Thread Rainer Orth
gcc.target/i386/pr80833-1.c FAILs on 32-bit Solaris/x86 since 20220609:

FAIL: gcc.target/i386/pr80833-1.c scan-assembler pextrd

Unlike e.g. Linux/i686, 32-bit Solaris/x86 defaults to -mstackrealign,
so this patch overrides that to match.

Tested on i386-pc-solaris2.11 and i686-pc-linux-gnu.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-01-23  Rainer Orth  

gcc/testsuite:
* gcc.target/i386/pr80833-1.c: Add -mno-stackrealign to dg-options.

# HG changeset patch
# Parent  0f0cde35c23eb9b92159347bfc0ae5f075be65b3
testsuite: i386: Fix gcc.target/i386/pr80833-1.c on 32-bit Solaris/x86

diff --git a/gcc/testsuite/gcc.target/i386/pr80833-1.c b/gcc/testsuite/gcc.target/i386/pr80833-1.c
--- a/gcc/testsuite/gcc.target/i386/pr80833-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr80833-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -msse4.1 -mtune=intel -mregparm=2" } */
+/* { dg-options "-O2 -msse4.1 -mtune=intel -mregparm=2 -mno-stackrealign" } */
 /* { dg-require-effective-target ia32 } */
 
 long long test (long long a)


[PATCH] testsuite: i386: Fix gcc.target/i386/pr70321.c on 32-bit Solaris/x86

2024-01-24 Thread Rainer Orth
gcc.target/i386/pr70321.c FAILs on 32-bit Solaris/x86 since its
introduction in

commit 43201f2c2173894bf7c423cad6da1c21567e06c0
Author: Roger Sayle 
Date:   Mon May 30 21:20:09 2022 +0100

PR target/70321: Split double word equality/inequality after STV on x86.

FAIL: gcc.target/i386/pr70321.c scan-assembler-times mov 1

The failure happens because 32-bit Solaris/x86 defaults to
-fno-omit-frame-pointer.

Fixed by specifying -fomit-frame-pointer explicitly.

Tested on i386-pc-solaris2.11 and i686-pc-linux-gnu.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-01-23  Rainer Orth  

gcc/testsuite:
* gcc.target/i386/pr70321.c: Add -fomit-frame-pointer to
dg-options.

# HG changeset patch
# Parent  229bf3d228cb30f17ea645f6f4b2e8f48d2cfa75
testsuite: i386: Fix gcc.target/i386/pr70321.c on 32-bit Solaris/x86

diff --git a/gcc/testsuite/gcc.target/i386/pr70321.c b/gcc/testsuite/gcc.target/i386/pr70321.c
--- a/gcc/testsuite/gcc.target/i386/pr70321.c
+++ b/gcc/testsuite/gcc.target/i386/pr70321.c
@@ -1,5 +1,5 @@
 /* { dg-do compile { target ia32 } } */
-/* { dg-options "-O2" } */
+/* { dg-options "-O2 -fomit-frame-pointer" } */
 
 void foo (long long ixi)
 {


[PATCH] c++: Fix g++.dg/ext/attr-section2.C etc. with Solaris/SPARC as

2024-01-19 Thread Rainer Orth
The new g++.dg/ext/attr-section2*.C tests FAIL on Solaris/SPARC with the
native assembler:

+FAIL: g++.dg/ext/attr-section2.C  -std=c++14  scan-assembler .(section|csect)[ 
t]+.foo
+FAIL: g++.dg/ext/attr-section2.C  -std=c++17  scan-assembler .(section|csect)[ 
t]+.foo
+FAIL: g++.dg/ext/attr-section2.C  -std=c++20  scan-assembler .(section|csect)[ 
t]+.foo

The problem is that the SPARC assembler requires the section name to be
double-quoted, like

.section".foo%_Z3varIiE",#alloc,#write,#progbits

This patch allows for that.  At the same time, it quotes literal dots in
the REs.

Tested on sparc-sun-solaris2.11 (as and gas) and i386-pc-solaris2.11 (as
and gas).

Ok for trunk?

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-01-18  Rainer Orth  

gcc/testsuite:
* g++.dg/ext/attr-section2.C (scan-assembler): Quote dots.  Allow
for double-quoted section name.
* g++.dg/ext/attr-section2a.C: Likewise.
* g++.dg/ext/attr-section2b.C: Likewise.

# HG changeset patch
# Parent  7d0c57f448dfceb02583a770e09fa7907720ba7e
c++: Fix g++.dg/ext/attr-section2.C etc. with Solaris/SPARC as

diff --git a/gcc/testsuite/g++.dg/ext/attr-section2.C b/gcc/testsuite/g++.dg/ext/attr-section2.C
--- a/gcc/testsuite/g++.dg/ext/attr-section2.C
+++ b/gcc/testsuite/g++.dg/ext/attr-section2.C
@@ -6,4 +6,4 @@ template
 
 template int var;
 
-// { dg-final { scan-assembler {.(section|csect)[ \t]+.foo} } }
+// { dg-final { scan-assembler {\.(section|csect)[ \t]+"?\.foo} } }
diff --git a/gcc/testsuite/g++.dg/ext/attr-section2a.C b/gcc/testsuite/g++.dg/ext/attr-section2a.C
--- a/gcc/testsuite/g++.dg/ext/attr-section2a.C
+++ b/gcc/testsuite/g++.dg/ext/attr-section2a.C
@@ -11,4 +11,4 @@ int A::var = 42;
 
 template struct A;
 
-// { dg-final { scan-assembler {.(section|csect)[ \t]+.foo} } }
+// { dg-final { scan-assembler {\.(section|csect)[ \t]+"?\.foo} } }
diff --git a/gcc/testsuite/g++.dg/ext/attr-section2b.C b/gcc/testsuite/g++.dg/ext/attr-section2b.C
--- a/gcc/testsuite/g++.dg/ext/attr-section2b.C
+++ b/gcc/testsuite/g++.dg/ext/attr-section2b.C
@@ -9,4 +9,4 @@ int* fun() {
 
 template int* fun();
 
-// { dg-final { scan-assembler {.(section|csect)[ \t]+.foo} } }
+// { dg-final { scan-assembler {\.(section|csect)[ \t]+"?\.foo} } }


Re: [PATCH] libstdc++: Update baseline symbols for riscv64-linux

2024-01-18 Thread Rainer Orth
Andreas Schwab  writes:

>   * config/abi/post/riscv64-linux-gnu/baseline_symbols.txt: Update.

Speaking of baselines: is this a good time to update them for other
targets, too, or should we better wait a little longer?

Thanks.
Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [COMMITTED] rust_debug: Cast size_t values to unsigned long before printing.

2024-01-18 Thread Rainer Orth
Hi Arthur,

> Yes, I was talking about this on IRC the other day - if we do run in a
> situation where we have more than UINT32_MAX procedural macros in memory 
> we have big issues. These debug prints will probably end up getting removed
> soon as they clutter the output a lot for little information.

makes sense, especially if they break the build once in a while ;-)

> I don't mind doing it the right way for our regular prints, but we have not
> been using PRIu64 in our codebase so far, so I'd rather change all those
> incriminating format specifiers at once later down the line - this patch
> was pushed so that 32bit targets could bootstrap the Rust frontend for now.

Makes sense: using different styles throughout the codebase only creates
confusion.

On a related issue: didn't you have some 32-bit host in your CI?  I
remember having similar issues in the past which could easily be avoided
in advance this way.

Thanks.
Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [COMMITTED] rust_debug: Cast size_t values to unsigned long before printing.

2024-01-18 Thread Rainer Orth
Arthur Cohen  writes:

> Using %lu to format size_t values breaks 32 bit targets, and %zu is not
> supported by one of the hosts GCC aims to support - HPUX

But we do have uses of %zu in gcc/rust already!

> diff --git a/gcc/rust/expand/rust-proc-macro.cc 
> b/gcc/rust/expand/rust-proc-macro.cc
> index e8618485b71..09680733e98 100644
> --- a/gcc/rust/expand/rust-proc-macro.cc
> +++ b/gcc/rust/expand/rust-proc-macro.cc
> @@ -171,7 +171,7 @@ load_macros (std::string path)
>if (array == nullptr)
>  return {};
>  
> -  rust_debug ("Found %lu procedural macros", array->length);
> +  rust_debug ("Found %lu procedural macros", (unsigned long) array->length);

Not the best way either: array->length is std::uint64_t, so the format
should use

... %" PRIu64 " procedural...

instead.

I've attached my patch to PR rust/113461.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH] libgomp, v2: Use absolute pathname to testsuite/flock [PR113192]

2024-01-10 Thread Rainer Orth
Hi Jakub,

>> FLOCK is also substituted into testsuite/libgomp-site-extra.exp.in,
>> which gets included into site.exp.  That one has
>> 
>> ## Begin content included from file libgomp-site-extra.exp.  Do not modify. 
>> ##
>> set FLOCK {$(abs_top_srcdir)/testsuite/flock}
>> 
>> So expect tries to literally execute '$(abs_top_srcdir)/testsuite/flock'
>> which cannot work.
>
> Does the following work then?
>
> Using autoconf's internal _AC_SRCDIRS macro doesn't seem to be a good idea
> to me, so I've copied what e.g. libobjc configure does instead.

The patch worked just fine (tested on i386-pc-solaris2.11 by
rebuilding/testing libgomp from scratch).  site.exp is as expected:

set FLOCK {/vol/gcc/src/hg/master/local/libgomp/testsuite/flock}

Thanks a lot.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [committed] libgomp: Use absolute pathname to testsuite/flock [PR113192]

2024-01-10 Thread Rainer Orth
Hi Jakub,

> When flock program doesn't exist, libgomp configure attempts to
> offer a fallback version using a perl script, but we weren't using
> absolute filename to that, so it apparently failed to work correctly.
>
> The following patch arranges for it to get the absolute filename.
>
> Tested by John David in the PR.

This patch completely broke parallel libgomp testing on Solaris:

ERROR: couldn't execute "\$(abs_top_srcdir)/testsuite/flock": no such file or 
directory

FLOCK is also substituted into testsuite/libgomp-site-extra.exp.in,
which gets included into site.exp.  That one has

## Begin content included from file libgomp-site-extra.exp.  Do not modify. ##
set FLOCK {$(abs_top_srcdir)/testsuite/flock}

So expect tries to literally execute '$(abs_top_srcdir)/testsuite/flock'
which cannot work.

Rainer

-- 
---------
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH]middle-end: check if target can do extract first for early breaks [PR113199]

2024-01-09 Thread Rainer Orth
Richard Biener  writes:

> On Tue, 9 Jan 2024, Tamar Christina wrote:
>
>> > > -
>> > > -  gimple_seq_add_seq (, tem);
>> > > -
>> > > -  scalar_res = gimple_build (, CFN_EXTRACT_LAST, scalar_type,
>> > > - mask, vec_lhs_phi);
>> > > +scalar_res = gimple_build (, CFN_VEC_EXTRACT, TREE_TYPE
>> > (vectype),
>> > > +   vec_lhs_phi, bitstart);
>> > 
>> > So bitstart is always zero?  I wonder why using CFN_VEC_EXTRACT over
>> > BIT_FIELD_REF here which wouldn't need any additional target support.
>> > 
>> 
>> Ok, how about...
>> 
>> ---
>> 
>> I was generating the vector reverse mask without checking if the target
>> actually supported such an operation.
>> 
>> This patch changes it to if the bitstart is 0 then use BIT_FIELD_REF instead
>> to extract the first element since this is supported by all targets.
>> 
>> This is good for now since masks always come from whilelo.  But in the future
>> when masks can come from other sources we will need the old code back.
>> 
>> Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu
>> and no issues with --enable-checking=release --enable-lto
>> --with-build-config=bootstrap-O3 --enable-checking=yes,rtl,extra.
>> tested on cross cc1 for amdgcn-amdhsa and issue fixed.
>> 
>> Ok for master?
>
> OK.
>
>> Thanks,
>> Tamar
>> 
>> gcc/ChangeLog:
>> 
>>  PR tree-optimization/113199
>>  * tree-vect-loop.cc (vectorizable_live_operation_1): Use
>>  BIT_FIELD_REF.

This patch broke bootstrap (everywhere, it seems; seen on
i386-pc-solaris2.11 and sparc-sun-solaris2.11):

/vol/gcc/src/hg/master/local/gcc/tree-vect-loop.cc: In function 'tree_node* 
vectorizable_live_operation_1(loop_vec_info, stmt_vec_info, basic_block, tree, 
int, slp_tree, tree, tree, tree, tree, bool, gimple_stmt_iterator*)':
/vol/gcc/src/hg/master/local/gcc/tree-vect-loop.cc:10598:52: error: unused 
parameter 'restart_loop' [-Werror=unused-parameter]
10598 |tree lhs_type, bool restart_loop,
  |   ~^~~~

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [pushed] testsuite: move more analyzer test cases to c-c++-common (3) [PR96395]

2023-12-15 Thread Rainer Orth
David Malcolm  writes:

> Move a further 268 tests from gcc.dg/analyzer to c-c++-common/analyzer.
>
> Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
> Pushed to trunk as r14-6564-gae034b9106fbdd.

This patch introduced 840 additional FAILs on i386-pc-solaris2.11, no
doubt more instances of PR analyzer/111475.  Is this supposed to work
anywhere but Linux?  Right now the analyzer testsuite is a total
nightmare...

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [committed] d: Merge upstream dmd, druntime 2bbf64907c, phobos b64bfbf91

2023-12-14 Thread Rainer Orth
Thomas Schwinge  writes:

> On 2023-12-11T11:13:28+0100, Iain Buclaw  wrote:
>> Excerpts from Iain Buclaw's message of Dezember 11, 2023 11:07 am:
>>> This patch merges the D front-end and runtime library with upstream dmd
>>> 2bbf64907c, and the standard library with phobos b64bfbf91.
>>>
>>> Synchronizing with the upstream release of v2.106.0.
>
>> [...] should
>> fix that linker problem when using gdc-9 for bootstrapping.
>
> Thanks, confirmed for x86_64-pc-linux-gnu bootstrap with GCC 9.

Also confirmed on i386-pc-solaris2.11 and sparc-sun-solaris2.11.

Thanks.
Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


[PATCH] ada: Fix Ada bootstrap on FreeBSD

2023-12-11 Thread Rainer Orth
Ada bootstrap on FreeBSD/amd64 was also broken by the recent warning
changes:

terminals.c: In function 'allocate_pty_desc':
terminals.c:1200:12: error: implicit declaration of function 'openpty'; did you
mean 'openat'? [-Wimplicit-function-declaration]
 1200 |   status = openpty (_fd, _fd, NULL, NULL, NULL);
  |^~~
  |openat

terminals.c: At top level:
terminals.c:1268:9: warning: "TABDLY" redefined
 1268 | #define TABDLY 0
  | ^~
In file included from /usr/include/termios.h:38,
 from terminals.c:1109:
/usr/include/sys/_termios.h:111:9: note: this is the location of the previous 
definition
  111 | #define TABDLY  0x0004  /* tab delay mask */
  | ^~
make[7]: *** [../gcc-interface/Makefile:302: terminals.o] Error 1

Fixed by including the necessary header and guarding the fallback
definition of TABDLY.

This allowed a 64-bit-only bootstrap on x86_64-unknown-freebsd14.0 to
complete successfully.  Multilibbed bootstrap is still broken for
unrelated reasons, cf. PR ada/ada/112958.

Ok for trunk?

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-12-11  Rainer Orth  

gcc/ada:
* terminals.c [__FreeBSD__]: Include .
(TABDLY): Only define if missing.

diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1125,6 +1125,9 @@ void
 #if defined (__APPLE__)
 #   include 
 #endif
+#if defined (__FreeBSD__)
+#   include 
+#endif
 
 #define CDISABLE _POSIX_VDISABLE
 
@@ -1265,11 +1268,13 @@ allocate_pty_desc (pty_desc **desc) {
 #ifndef NLDLY
 #define NLDLY 0
 #define CRDLY 0
-#define TABDLY 0
 #define BSDLY 0
 #define VTDLY 0
 #define FFDLY 0
 #endif
+#ifndef TABDLY
+#define TABDLY 0
+#endif
 
 /* child_setup_tty - set terminal properties
  *


Re: [PATCH] libssp: Fix gets-chk.c compilation on Solaris

2023-12-07 Thread Rainer Orth
Rainer Orth  writes:

> The recent warning patches broke the libssp build on Solaris:
>
> /vol/gcc/src/hg/master/local/libssp/gets-chk.c: In function '__gets_chk':
> /vol/gcc/src/hg/master/local/libssp/gets-chk.c:67:12: error: implicit
> declaration of function 'gets'; did you mean 'getw'?
> [-Wimplicit-function-declaration]
>67 | return gets (s);
>   |^~~~
>   |getw 
> /vol/gcc/src/hg/master/local/libssp/gets-chk.c:67:12: error: returning
> 'int' from a function with return type 'char *' makes pointer from integer
> without a cast [-Wint-conversion]
>67 | return gets (s);
>   |^~~~
> /vol/gcc/src/hg/master/local/libssp/gets-chk.c:74:12: error: returning
> 'int' from a function with return type 'char *' makes pointer from integer
> without a cast [-Wint-conversion]
>74 | return gets (s);
>   |^~~~
>
> The guard around the gets declaration in gets-chk.c is
>
> #if !(!defined __USE_ISOC11 \
>   || (defined __cplusplus && __cplusplus <= 201103L))
> extern char *gets (char *);
> #endif
>
> __USE_ISOC11 is a glibc-only thing, while Solaris 
> declares gets like
>
> #if __STDC_VERSION__ < 201112L && __cplusplus < 201402L
> extern char *gets(char *) __ATTR_DEPRECATED;
> #endif
>
> If one needs to check __USE_ISO11 at all, one certainly needs to check
> __STDC_VERSION__ to avoid breaking every non-glibc target.  Besides, I
> don't see what's the use of checking __cplusplus when compiling a C-only
> source file.  On top of all that, the double negation makes the guard
> unnecessarily hard to understand.
>
> I really don't know if it's useful/appropriate to check __USE_ISOC11 and
> __cplusplus here at all; still I've left both for now.
>
> Here's what I've used to complete the Solaris bootstrap.
>
> Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11,
> x86_64-pc-linux-gnu, and x86_64-apple-darwin23.1.0.

Ping?  It's only been four days, but without a fix Solaris bootstrap
remains broken.

In hindsight, I wonder if it wouldn't be better to just check for a gets
declaration using AC_CHECK_DECLS, rather than second-guessing what
guards various implementions use, even messing with
implementation-private macros...

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[PATCH] libssp: Fix gets-chk.c compilation on Solaris

2023-12-04 Thread Rainer Orth
The recent warning patches broke the libssp build on Solaris:

/vol/gcc/src/hg/master/local/libssp/gets-chk.c: In function '__gets_chk':
/vol/gcc/src/hg/master/local/libssp/gets-chk.c:67:12: error: implicit 
declaration of function 'gets'; did you mean 'getw'? 
[-Wimplicit-function-declaration]
   67 | return gets (s);
  |^~~~
  |getw 
/vol/gcc/src/hg/master/local/libssp/gets-chk.c:67:12: error: returning 'int' 
from a function with return type 'char *' makes pointer from integer without a 
cast [-Wint-conversion]   
   67 | return gets (s);
  |^~~~
/vol/gcc/src/hg/master/local/libssp/gets-chk.c:74:12: error: returning 'int' 
from a function with return type 'char *' makes pointer from integer without a 
cast [-Wint-conversion]
   74 | return gets (s);
  |^~~~

The guard around the gets declaration in gets-chk.c is

#if !(!defined __USE_ISOC11 \
  || (defined __cplusplus && __cplusplus <= 201103L))
extern char *gets (char *);
#endif

__USE_ISOC11 is a glibc-only thing, while Solaris 
declares gets like

#if __STDC_VERSION__ < 201112L && __cplusplus < 201402L
extern char *gets(char *) __ATTR_DEPRECATED;
#endif

If one needs to check __USE_ISO11 at all, one certainly needs to check
__STDC_VERSION__ to avoid breaking every non-glibc target.  Besides, I
don't see what's the use of checking __cplusplus when compiling a C-only
source file.  On top of all that, the double negation makes the guard
unnecessarily hard to understand.

I really don't know if it's useful/appropriate to check __USE_ISOC11 and
__cplusplus here at all; still I've left both for now.

Here's what I've used to complete the Solaris bootstrap.

Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11,
x86_64-pc-linux-gnu, and x86_64-apple-darwin23.1.0.

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-12-03  Rainer Orth  

libssp:
* gets-chk.c (gets): Avoid double negation.
Also check __STDC_VERSION__ >= 201112L.

# HG changeset patch
# Parent  334015ab01f6c0e5af821c1e9bc83b8677cc0bfb
libssp: Fix gets-chk.c compilation on Solaris

diff --git a/libssp/gets-chk.c b/libssp/gets-chk.c
--- a/libssp/gets-chk.c
+++ b/libssp/gets-chk.c
@@ -51,8 +51,9 @@ see the files COPYING3 and COPYING.RUNTI
 # include 
 #endif
 
-#if !(!defined __USE_ISOC11\
-  || (defined __cplusplus && __cplusplus <= 201103L))
+#if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)	\
+ || !defined __USE_ISOC11	\
+ || (defined __cplusplus && __cplusplus >= 201402L)
 extern char *gets (char *);
 #endif
 


[PATCH] ada: Fix Ada bootstrap on Solaris

2023-12-04 Thread Rainer Orth
The recent warning patches broke Ada bootstrap on Solaris:

adaint.c: In function '__gnat_kill':
adaint.c:3597:3: error: implicit declaration of function 'kill' 
[-Wimplicit-function-declaration]
 3597 |   kill (pid, sig);
  |   ^~~~

expect.c: In function '__gnat_expect_poll':
expect.c:409:5: error: implicit declaration of function 'memset' 
[-Wimplicit-function-declaration]
  409 | FD_ZERO ();
  | ^~~
expect.c:55:1: note: include '' or provide a declaration of 'memset'
   54 | #include 
  +++ |+#include 
   55 | #endif

I'm now including the necessary headers:  for kill and
 for memset.  However, I found the GNAT C sources to be an
incredible and hard to untangle maze: instead of using autoconf, they
are generously sprinkled with deeply nested platform macros, so I may
well have included the headers in an inappropriate place.

Bootstrapped without regressions on i386-pc-solaris2.11,
sparc-sun-solaris2.11, x86_64-pc-linux-gnu, and
x86_64-apple-darwin23.1.0.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-12-03  Rainer Orth  

gcc/ada:
* adaint.c: Include .
* expect.c: Include .

# HG changeset patch
# Parent  5cf4f08be31b5169b377de570ac0ab0f159161af
ada: Fix Ada bootstrap on Solaris

diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -243,6 +243,7 @@ UINT __gnat_current_ccs_encoding;
 #define DIR_SEPARATOR '\\'
 
 #else
+#include 
 #include 
 #endif
 
diff --git a/gcc/ada/expect.c b/gcc/ada/expect.c
--- a/gcc/ada/expect.c
+++ b/gcc/ada/expect.c
@@ -41,6 +41,7 @@
 
 #include "adaint.h"
 #include 
+#include 
 
 #if defined (__vxworks) && defined (__RTP__)
 # include 


[PATCH] gm2: Fix mc/mc.flex compilation on Solaris

2023-12-04 Thread Rainer Orth
The recent warning changes broke gm2 bootstrap on Solaris:

/vol/gcc/src/hg/master/local/gcc/m2/mc/mc.flex: In function 'handleFile':
/vol/gcc/src/hg/master/local/gcc/m2/mc/mc.flex:297:21: error: implicit 
declaration of function 'alloca' [-Wimplicit-function-declaration]
  297 |   char *s = (char *)alloca (strlen (filename) + 2 + 1);
  | ^~

alloca needs  on Solaris, which isn't universally available.
Since mc.flex doesn't include any config header, I chose to switch to
__builtin_alloca instead.

/vol/gcc/src/hg/master/local/gcc/m2/mc/mc.flex:332:19: error: implicit 
declaration of function 'index' [-Wimplicit-function-declaration]
  332 |   char   *p = index(sdate, '\n');
  |   ^

index is declared in  on Solaris, again not a standard
header.  I simply switched to using strchr to avoid that issue.

Bootstrapped without regressions on i386-pc-solaris2.11,
sparc-sun-solaris2.11, x86_64-pc-linux-gnu, and
x86_64-apple-darwin23.1.0.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-12-03  Rainer Orth  

gcc/m2:
* mc/mc.flex [__GNUC__]: Define alloca as __builtin_alloca.
(handleDate): Use strchr instead of index.

# HG changeset patch
# Parent  76246607bf26a4639355410e36af4cbf08c04f99
gm2: Fix mc/mc.flex compilation on Solaris

diff --git a/gcc/m2/mc/mc.flex b/gcc/m2/mc/mc.flex
--- a/gcc/m2/mc/mc.flex
+++ b/gcc/m2/mc/mc.flex
@@ -28,6 +28,10 @@ along with GNU Modula-2; see the file CO
 #include 
 #include 
 
+#ifdef __GNUC__
+#define alloca __builtin_alloca
+#endif
+
 #if !defined(TRUE)
 #  define TRUE (1==1)
 #endif
@@ -329,7 +333,7 @@ handleDate (void)
   time_t  clock = time ((long *)0);
   char   *sdate = ctime ();
   char   *s = (char *)alloca (strlen (sdate)+2+1);
-  char   *p = index(sdate, '\n');
+  char   *p = strchr(sdate, '\n');
 
   if (p != NULL) {
 *p = (char) 0;


[PATCH] libiberty: Fix pex_unix_wait return type

2023-12-04 Thread Rainer Orth
The recent warning patches broke Solaris bootstrap:

/vol/gcc/src/hg/master/local/libiberty/pex-unix.c:326:3: error: initialization 
of 'pid_t (*)(struct pex_obj *, pid_t,  int *, struct pex_time *, int,  const 
char **, int *)' {aka 'long int (*)(struct pex_obj *, long int,  int *, struct 
pex_time *, int,  const char **, int *)'} from incompatible pointer type 'int 
(*)(struct pex_obj *, pid_t,  int *, struct pex_time *, int,  const char **, 
int *)' {aka 'int (*)(struct pex_obj *, long int,  int *, struct pex_time *, 
int,  const char **, int *)'} [-Wincompatible-pointer-types]
  326 |   pex_unix_wait,
  |   ^
/vol/gcc/src/hg/master/local/libiberty/pex-unix.c:326:3: note: (near 
initialization for 'funcs.wait')

While pex_funcs.wait expects a function returning pid_t, pex_unix_wait
currently returns int.  However, on Solaris pid_t is long for 32-bit,
but int for 64-bit.

This patches fixes this by having pex_unix_wait return pid_t as
expected, and like every other variant already does.

Bootstrapped without regressions on i386-pc-solaris2.11,
sparc-sun-solaris2.11, x86_64-pc-linux-gnu, and
x86_64-apple-darwin23.1.0.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-12-03  Rainer Orth  

libiberty:
* pex-unix.c (pex_unix_wait): Change return type to pid_t.

# HG changeset patch
# Parent  2e3efea7d8370094e0472added4d944ecf1e0270
libiberty: Fix pex_unix_wait signature

diff --git a/libiberty/pex-unix.c b/libiberty/pex-unix.c
--- a/libiberty/pex-unix.c
+++ b/libiberty/pex-unix.c
@@ -308,8 +308,8 @@ static pid_t pex_unix_exec_child (struct
  int, int, int, int,
  const char **, int *);
 static int pex_unix_close (struct pex_obj *, int);
-static int pex_unix_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
-			  int, const char **, int *);
+static pid_t pex_unix_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
+			   int, const char **, int *);
 static int pex_unix_pipe (struct pex_obj *, int *, int);
 static FILE *pex_unix_fdopenr (struct pex_obj *, int, int);
 static FILE *pex_unix_fdopenw (struct pex_obj *, int, int);
@@ -934,7 +934,7 @@ pex_unix_exec_child (struct pex_obj *obj
 
 /* Wait for a child process to complete.  */
 
-static int
+static pid_t
 pex_unix_wait (struct pex_obj *obj, pid_t pid, int *status,
 	   struct pex_time *time, int done, const char **errmsg,
 	   int *err)


[PATCH] ada: Fix Ada bootstrap on macOS

2023-12-01 Thread Rainer Orth
The recent warning changes broke Ada bootstrap on macOS:

adaint.c: In function '__gnat_copy_attribs':
adaint.c:3336:10: error: implicit declaration of function 'utimes'; did you 
mean 'utime'? [-Wimplicit-function-declaration]
 3336 |  if (utimes (to, tbuf) == -1) {
  |  ^~
  |  utime
adaint.c: In function '__gnat_kill':
adaint.c:3597:3: error: implicit declaration of function 'kill' 
[-Wimplicit-function-declaration]
 3597 |   kill (pid, sig);
  |   ^~~~
terminals.c: In function 'allocate_pty_desc':
terminals.c:1196:12: error: implicit declaration of function 'openpty'; did you 
mean 'openat'? [-Wimplicit-function-declaration]
 1196 |   status = openpty (_fd, _fd, NULL, NULL, NULL);
  |^~~
  |openat
terminals.c: In function '__gnat_setup_winsize':
terminals.c:1392:6: error: implicit declaration of function 'kill' 
[-Wimplicit-function-declaration]
 1392 |  kill (desc->child_pid, SIGWINCH);
  |  ^~~~

This patch fixes this by including the necessary headers: 
for utimes,  for kill, and  for openpty.  With those
changes, the build completed on x86_64-apple-darwin2[0-3] (make check
still running).

Ok for trunk?

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-12-01  Rainer Orth  

gcc/ada:
* adaint.c [__APPLE__]: Include , .
* terminals.c [!_WIN32]: Include .
[__APPLE__]: Include .
Fix typos.

diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -85,6 +85,8 @@
 
 #if defined (__APPLE__)
 #include 
+#include 
+#include 
 #include 
 #endif
 
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -31,7 +31,7 @@
 
 #define ATTRIBUTE_UNUSED __attribute__((unused))
 
-/* First all usupported platforms. Add stubs for exported routines. */
+/* First all unsupported platforms. Add stubs for exported routines. */
 
 #if defined (VMS) || defined (__vxworks) || defined (__Lynx__) \
   || defined (__ANDROID__) || defined (__PikeOS__) || defined(__DJGPP__)
@@ -1089,7 +1089,7 @@ void
 {
 }
 
-#else /* defined(_WIN32, implementatin for all UNIXes */
+#else /* defined(_WIN32, implementation for all UNIXes */
 
 /* First defined some macro to identify easily some systems */
 #if defined (__FreeBSD__) \
@@ -1104,6 +1104,7 @@ void
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1121,6 +1122,9 @@ void
 #if defined (__hpux__)
 #   include 
 #endif
+#if defined (__APPLE__)
+#   include 
+#endif
 
 #define CDISABLE _POSIX_VDISABLE
 


Re: [PATCH] libgo, libstdc++: Regenerate GCC_CHECK_ASSEMBLER_HWCAP users

2023-12-01 Thread Rainer Orth
Hi Ian,

> On Thu, Nov 30, 2023 at 11:46 AM Ian Lance Taylor  wrote:
>>
>> On Thu, Nov 30, 2023 at 1:30 AM Rainer Orth 
>> wrote:
>> >
>> > the gcc-autoregen bot correctly complained that the libgo and libstdc++
>> > configure scripts hadn't been regenerated.  I'd have commited the
>> > following as obvious (just whitespace change), but since libgo is
>> > imported from upstream, I'm uncertain how best to handle that part.
>>
>> I can update libgo/configure upstream, but first I'd like to
>> understand the change in git revision
>> 6a6d3817afa02bbcd2388c8e005da6faf88932f1, which seems unnecessary.
>> Asked in https://gcc.gnu.org/pipermail/gcc-patches/2023-November/638814.html.
>
> OK, fixed now in the GCC repo.

thanks for taking care of this.  I've now regenerated the libstdc++
configure script, too, which should silence the gcc-autoregen bot.

    Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[PATCH] libgo, libstdc++: Regenerate GCC_CHECK_ASSEMBLER_HWCAP users

2023-11-30 Thread Rainer Orth
After

Author: Rainer Orth 
Date:   Thu Nov 30 10:06:23 2023 +0100

libiberty: Disable hwcaps for sha1.o

the gcc-autoregen bot correctly complained that the libgo and libstdc++
configure scripts hadn't been regenerated.  I'd have commited the
following as obvious (just whitespace change), but since libgo is
imported from upstream, I'm uncertain how best to handle that part.

This patch regenerates the other users of the GCC_CHECK_ASSEMBLER_HWCAP
macro.  No functional changes.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-11-30  Rainer Orth  

libgo:
* configure: Regenerate.

libstdc++-v3:
* configure: Regenerate.



[PATCH] libiberty: Disable hwcaps for sha1.o

2023-11-29 Thread Rainer Orth
This patch

commit bf4f40cc3195eb7b900bf5535cdba1ee51fdbb8e
Author: Jakub Jelinek 
Date:   Tue Nov 28 13:14:05 2023 +0100

libiberty: Use x86 HW optimized sha1

broke Solaris/x86 bootstrap with the native as:

libtool: compile:  /var/gcc/regression/master/11.4-gcc/build/./gcc/gccgo 
-B/var/gcc/regression/master/11.4-gcc/build/./gcc/ 
-B/vol/gcc/i386-pc-solaris2.11/bin/ -B/vol/gcc/i386-pc-solaris2.11/lib/ 
-isystem /vol/gcc/i386-pc-solaris2.11/include -isystem 
/vol/gcc/i386-pc-solaris2.11/sys-include -fchecking=1 -minline-all-stringops 
-O2 -g -I . -c -fgo-pkgpath=internal/goarch 
/vol/gcc/src/hg/master/local/libgo/go/internal/goarch/goarch.go zgoarch.go
ld.so.1: go1: fatal: /var/gcc/regression/master/11.4-gcc/build/gcc/go1: 
hardware capability (CA_SUNW_HW_2) unsupported: 0x400  [ SHA1 ]
gccgo: fatal error: Killed signal terminated program go1

As is already done in a couple of other similar cases, this patches
disables hwcaps support for libiberty.

Initially, this didn't work because config/hwcaps.m4 uses target_os, but
didn't ensure it is defined.

Tested on i386-pc-solaris2.11 with as and gas (gcc build completed, make
check still running).  binutils-gdb build is currently broken in
gdb/procfs.c, unfortunately.

Ok for both gcc and binutils?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-11-29  Rainer Orth  

config:
* hwcaps.m4 (GCC_CHECK_ASSEMBLER_HWCAP): Require
AC_CANONICAL_TARGET.

libiberty:
* configure.ac (GCC_CHECK_ASSEMBLER_HWCAP): Invoke.
* configure, aclocal.m4: Regenerate.
* Makefile.in (COMPILE.c): Add HWCAP_CFLAGS.

# HG changeset patch
# Parent  fd492da0442de0bcc8afbf1aa71957f3e05afdb7
libiberty: Disable hwcaps for sha1.o

diff --git a/config/hwcaps.m4 b/config/hwcaps.m4
--- a/config/hwcaps.m4
+++ b/config/hwcaps.m4
@@ -7,6 +7,7 @@ dnl  HWCAP_CFLAGS='-Wa,-nH' if possible.
 dnl
 AC_DEFUN([GCC_CHECK_ASSEMBLER_HWCAP], [
   test -z "$HWCAP_CFLAGS" && HWCAP_CFLAGS=''
+  AC_REQUIRE([AC_CANONICAL_TARGET])
 
   # Restrict the test to Solaris, other assemblers (e.g. AIX as) have -nH
   # with a different meaning.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -114,7 +114,7 @@ INCDIR=$(srcdir)/$(MULTISRCTOP)../includ
 
 COMPILE.c = $(CC) -c @DEFS@ $(CFLAGS) $(CPPFLAGS) -I. -I$(INCDIR) \
$(HDEFINES) @ac_libiberty_warn_cflags@ -D_GNU_SOURCE \
-   @CET_HOST_FLAGS@
+   @CET_HOST_FLAGS@ @HWCAP_CFLAGS@
 
 # Just to make sure we don't use a built-in rule with VPATH
 .c.$(objext):
diff --git a/libiberty/configure.ac b/libiberty/configure.ac
--- a/libiberty/configure.ac
+++ b/libiberty/configure.ac
@@ -265,6 +265,8 @@ AC_SUBST(NOASANFLAG)
 GCC_CET_HOST_FLAGS(CET_HOST_FLAGS)
 AC_SUBST(CET_HOST_FLAGS)
 
+GCC_CHECK_ASSEMBLER_HWCAP
+
 echo "# Warning: this fragment is automatically generated" > temp-frag
 
 if [[ -n "${frag}" ]] && [[ -f "${frag}" ]]; then


Re: [PATCH] testsuite, i386: Only check for cfi directives if supported [PR112729]

2023-11-29 Thread Rainer Orth
Rainer Orth  writes:

> gcc.target/i386/apx-interrupt-1.c and two more tests FAIL on Solaris/x86
> with the native assembler.  Like Darwin as, it doesn't support cfi
> directives.  Instead of adding more and more targets in every affected
> test, this patch introduces a cfi effective-target keyword to check for
> the prerequisite.
>
> Tested on i386-pc-solaris2.11 (as and gas), x86_64-pc-linux-gnu, and
> x86_64-apple-darwin23.1.0.
>
> Any comments on the CFI detection in target-supports.exp?  Otherwise,
> I'll commit the patch as is.

Given that nobody found fault with the CFI detection, I've rebased the
patch to account for the -fomit-frame-pointer changes, retested and
committed it to trunk.

> The tests still FAIL on Solaris/x86 and FreeBSD/x86_64 with gas due to
> their -fno-omit-frame-pointer default; this will be addressed
> separately.

This has been handled now.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


# HG changeset patch
# Parent  0314b8e4604293f389540a558f0c9580f957aaa1
testsuite, i386: Only check for cfi directives if supported

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2671,6 +2671,9 @@ The language for the compiler under test
 @item c99_runtime
 Target provides a full C99 runtime.
 
+@item cfi
+Target supports DWARF CFI directives.
+
 @item correct_iso_cpp_string_wchar_protos
 Target @code{string.h} and @code{wchar.h} headers provide C++ required
 overloads for @code{strchr} etc. functions.
diff --git a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
--- a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
+++ b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-do compile { target { { ! ia32 } && cfi } } } */
 /* { dg-options "-mapx-features=egpr -m64 -O2 -mgeneral-regs-only -mno-cld -mno-push-args -maccumulate-outgoing-args -fomit-frame-pointer" } */
-/* { dg-skip-if "does not emit .cfi_xxx" "*-*-darwin*" } */
 
 extern void foo (void *) __attribute__ ((interrupt));
 extern int bar (int);
diff --git a/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c b/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c
--- a/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c
+++ b/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-do compile { target { { ! ia32 } && cfi } } } */
 /* { dg-options "-O2 -mapx-features=push2pop2 -fomit-frame-pointer" } */
-/* { dg-skip-if "does not emit .cfi_xxx" "*-*-darwin*" } */
 
 extern int bar (int);
 
diff --git a/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c b/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c
--- a/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c
+++ b/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-do compile { target { { ! ia32 } && cfi } } } */
 /* { dg-options "-O2 -mapx-features=push2pop2 -fomit-frame-pointer -mforce-drap" } */
-/* { dg-skip-if "does not emit .cfi_xxx" "*-*-darwin*" } */
 
 #include "apx-push2pop2-1.c"
 
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -10082,6 +10082,18 @@ proc check_effective_target_c99_runtime 
 }]
 }
 
+# Return 1 if the target supports DWARF CFI directives.
+
+proc check_effective_target_cfi { } {
+return [check_no_compiler_messages cfi assembly {
+	#ifdef __GCC_HAVE_DWARF2_CFI_ASM
+/* ok */
+	#else
+	#error unsupported
+	#endif
+} ""]
+}
+
 # Return 1 if the target provides the D runtime.
 
 proc check_effective_target_d_runtime { } {


[COMMITTED] testsuite: Adjust g++.dg/opt/devirt2.C on SPARC

2023-11-29 Thread Rainer Orth
Since 20231124, g++.dg/opt/devirt2.C began to FAIL on 32 and 64-bit
Solaris/SPARC:

FAIL: g++.dg/opt/devirt2.C  -std=gnu++14  scan-assembler-times 
(jmp|call)[^\\n]*xyzzy 4
FAIL: g++.dg/opt/devirt2.C  -std=gnu++17  scan-assembler-times 
(jmp|call)[^\\n]*xyzzy 4
FAIL: g++.dg/opt/devirt2.C  -std=gnu++20  scan-assembler-times 
(jmp|call)[^\\n]*xyzzy 4
FAIL: g++.dg/opt/devirt2.C  -std=gnu++98  scan-assembler-times 
(jmp|call)[^\\n]*xyzzy 4

This is no doubt due to

commit ba0869323e1d45b1328b4cb723cb139a2e2146c3
Author: Maciej W. Rozycki 
Date:   Thu Nov 23 16:13:59 2023 +

testsuite: Fix subexpressions with `scan-assembler-times'

which fixes exactly the double-counting the test relied on/worked around
on sparc.  Fixed by adjusting the count.

Tested on sparc-sun-solaris2.11, installed on trunk.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-11-28  Rainer Orth  

gcc/testsuite:
* g++.dg/opt/devirt2.C: Adjust scan-assembler-count on sparc for
removal of -inline from regexp.  Update comment.

# HG changeset patch
# Parent  952ad5d0e0d8e0f83d5acc5fa08b1c7ee273e67c
testsuite: Adjust g++.dg/opt/devirt2.C on SPARC

diff --git a/gcc/testsuite/g++.dg/opt/devirt2.C b/gcc/testsuite/g++.dg/opt/devirt2.C
--- a/gcc/testsuite/g++.dg/opt/devirt2.C
+++ b/gcc/testsuite/g++.dg/opt/devirt2.C
@@ -17,9 +17,7 @@
 // { dg-final { scan-assembler-times "jsr\[^\n\]*xyzzy" 2 { target alpha*-*-* } } }
 // Unless the assembler supports -relax, the 32-bit SPARC compiler generates
 // sethi/jmp instead of just call, so the scans need to be more specific.
-// With subexpressions, Tcl regexp -inline -all returns both the complete
-// match and the subexpressions, so double the count.
-// { dg-final { scan-assembler-times "\(jmp|call\)\[^\n\]*xyzzy" 4 { target sparc*-*-* } } }
+// { dg-final { scan-assembler-times "\(jmp|call\)\[^\n\]*xyzzy" 2 { target sparc*-*-* } } }
 
 struct S { S(); virtual void xyzzy(); };
 struct R { int a; S s; R(); };


Re: [PATCH] testsuite: scev: expect fail on ilp32

2023-11-28 Thread Rainer Orth
Richard Biener  writes:

> On Sun, 19 Nov 2023, Jeff Law wrote:
>
>> 
>> 
>> On 11/19/23 00:30, Alexandre Oliva wrote:
>> > 
>> > I've recently patched scev-3.c and scev-5.c because it only passed by
>> > accident on ia32.  It also fails on some (but not all) arm-eabi
>> > variants.  It seems hard to characterize the conditions in which the
>> > optimization is supposed to pass, but expecting them to fail on ilp32
>> > targets, though probably a little excessive and possibly noisy, is not
>> > quite as alarming as getting a fail in test reports, so I propose
>> > changing the xfail marker from ia32 to ilp32.
>> > 
>> > I'm also proposing to add a similar marker to scev-4.c.  Though it
>> > doesn't appear to be failing for me, I've got reports that suggest it
>> > still does for others, and it certainly did for us as well.
>> > 
>> > Regstrapped on x86_64-linux-gnu, also tested on arm-eabi with default
>> > cpu on trunk, and with tms570 on gcc-13.  Ok to install?
>> > 
>> > 
>> > for  gcc/testsuite/ChangeLog
>> > 
>> >  * gcc.dg/tree-ssa/scev-3.c: xfail on all ilp32 targets,
>> >  though some of these do pass.
>> >  * gcc.dg/tree-ssa/scev-4.c: Likewise.
>> >  * gcc.dg/tree-ssa/scev-5.c: Likewise.
>> OK.  Though hopefully someone will figure out what properties actually cause
>> the differences so that we can do the right thing without the noisy XPASS at
>> some point.
>
> The tests all test IVOPTs induction variable selecting results
> (assuming every target would come to the "obvious" conclusion),
> so it's probably not only target but also sub-target (aka -mtune)
> sensitive ...
>
> In the end we might need to move/duplicate the test to some
> gcc.target/* dir and restrict it to a specific tuning.

FWIW, since Alexandre's patch all three tests XPASS on 32-bit
Solaris/SPARC:

XPASS: gcc.dg/tree-ssa/scev-3.c scan-tree-dump-times ivopts "" 1
XPASS: gcc.dg/tree-ssa/scev-4.c scan-tree-dump-times ivopts "" 1
XPASS: gcc.dg/tree-ssa/scev-5.c scan-tree-dump-times ivopts "" 1

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[PATCH] testsuite: Handle double-quoted LTO section names [PR112728]

2023-11-28 Thread Rainer Orth
The gcc.dg/scantest-lto.c test FAILs on Solaris/SPARC with the native as:

FAIL: gcc.dg/scantest-lto.c scan-assembler-not ascii
FAIL: gcc.dg/scantest-lto.c scan-assembler-times ascii 0

It requires double-quoting the section name which scanasm.exp doesn't
allow for.

This patch fixes that.

Tested on sparc-sun-solaris2.11 (as and gas) and i386-pc-solaris2.11 (as
and gas).

As reported in PR testsuite/112728, there are more targets where this
test FAILs, but I cannot say why and those are probably different
issues.

I guess this patch is pretty obvious and can be committed under my
testsuite maintainership, but I may be overlooking something?

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-11-23  Rainer Orth  

gcc/testsuite:
PR testsuite/112728
* lib/scanasm.exp (dg-scan): Allow for double-quoted LTO section names.
(scan-assembler-times): Likewise.
(scan-assembler-dem-not): Likewise.

# HG changeset patch
# Parent  00ba0ae2e7291afbbcee5f4abe6fb041e3cc5448
testsuite: Handle double-quoted LTO section names

diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp
--- a/gcc/testsuite/lib/scanasm.exp
+++ b/gcc/testsuite/lib/scanasm.exp
@@ -82,8 +82,8 @@ proc dg-scan { name positive testcase ou
 if { [string compare -length 14 $name scan-assembler] == 0 } {
   # Remove LTO sections.
   # ??? Somehow, .*? is still greedy.
-  # regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*\.gnu\.lto_.*?\n(?=[[:space:]]*\.text\n)} $text {\1} text
-  regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text
+  # regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*"?\.gnu\.lto_.*?\n(?=[[:space:]]*\.text\n)} $text {\1} text
+  regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*"?\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text
 }
 
 set match [regexp -- $pattern $text]
@@ -503,7 +503,7 @@ proc scan-assembler-times { args } {
 set fd [open $output_file r]
 set text [read $fd]
 close $fd
-regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text
+regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*"?\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text
 
 set result_count [llength [regexp -inline -all -- $pattern $text]]
 if {$result_count == $times} {
@@ -565,7 +565,7 @@ proc scan-assembler-dem { args } {
 
 set output [remote_exec host "$cxxfilt" "" "$output_file"]
 set text [lindex $output 1]
-regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text
+regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*"?\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text
 
 if [regexp -- $pattern $text] {
 	pass "$testcase scan-assembler-dem $pp_pattern"
@@ -622,7 +622,7 @@ proc scan-assembler-dem-not { args } {
 
 set output [remote_exec host "$cxxfilt" "" "$output_file"]
 set text [lindex $output 1]
-regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text
+regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*"?\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text
 
 if ![regexp -- $pattern $text] {
 	pass "$testcase scan-assembler-dem-not $pp_pattern"


Re: [PATCH] libsanitizer: Check assembler support for symbol assignment [PR112563]

2023-11-28 Thread Rainer Orth
Hi Jakub,

>>> But will they accept a patch to check a macro never set anywhere in and
>>> irrelevant to LLVM?  That's why I kept all in one patch, to be GCC-local.
>>
>> I meant the patch would be gcc local.
>> But, for later we need only the changes to the imported files be in one
>> commit, not others, because merge.sh will not revert the GCC owned changes,
>> just the imported ones, and so that is what should be reapplied.
>> And, the preference of not using config.h is because we do it like that
>> for other stuff already (exactly to minimize amount of local changes).
>
> ah, now I get it.  Will rework the patch accordingly.

here are both patches.

Bootstrapped on sparc-sun-solaris2.11 (as and gas) and
i386-pc-solaris2.11 (as and gas).

Ok for trunk?

Thanks.
Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-11-23  Rainer Orth  

libsanitizer:
PR libsanitizer/112563
* configure.ac (libsanitizer_cv_as_sym_assign): Check for
assembler symbol assignment support.
* configure, config.h.in: Regenerate.
* asan/Makefile.am (DEFS): Add @AS_SYM_ASSIGN_DEFS@.
* Makefile.in, asan/Makefile.in, hwasan/Makefile.in,
interception/Makefile.in, libbacktrace/Makefile.in,
lsan/Makefile.in, sanitizer_common/Makefile.in, tsan/Makefile.in,
ubsan/Makefile.in: Regenerate.

libsanitizer:
PR libsanitizer/112563
* sanitizer_common/sanitizer_redefine_builtins.h: Check
HAVE_AS_SYM_ASSIGN.

# HG changeset patch
# Parent  1f757467f1bed35373c55b65cde4f9b0506172f5
libsanitizer: Check assembler support for symbol assignment [PR112563]

diff --git a/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am
--- a/libsanitizer/asan/Makefile.am
+++ b/libsanitizer/asan/Makefile.am
@@ -3,7 +3,7 @@ AM_CPPFLAGS = -I $(top_srcdir)/include -
 # May be used by toolexeclibdir.
 gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
-DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DASAN_HAS_EXCEPTIONS=1 -DASAN_NEEDS_SEGV=1 -DCAN_SANITIZE_UB=0 -DASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION=0
+DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DASAN_HAS_EXCEPTIONS=1 -DASAN_NEEDS_SEGV=1 -DCAN_SANITIZE_UB=0 -DASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION=0 @AS_SYM_ASSIGN_DEFS@
 if USING_MAC_INTERPOSE
 DEFS += -DMAC_INTERPOSE_FUNCTIONS -DMISSING_BLOCKS_SUPPORT
 endif
diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -214,6 +214,19 @@ if test "$libsanitizer_cv_sys_atomic" = 
 	[Define to 1 if you have the __atomic functions])
 fi
 
+# Check if assembler supports symbol assignment.
+AC_CACHE_CHECK([assembler symbol assignment],
+[libsanitizer_cv_as_sym_assign],
+[AC_COMPILE_IFELSE(
+  [AC_LANG_PROGRAM([],
+		   [asm("a = b");])],
+  [libsanitizer_cv_as_sym_assign=yes],
+  [libsanitizer_cv_as_sym_assign=no])])
+if test "$libsanitizer_cv_as_sym_assign" = "yes"; then
+  as_sym_assign_defs=-DHAVE_AS_SYM_ASSIGN=1
+fi
+AC_SUBST(AS_SYM_ASSIGN_DEFS, [$as_sym_assign_defs])
+
 # The library needs to be able to read the executable itself.  Compile
 # a file to determine the executable format.  The awk script
 # filetype.awk prints out the file type.
# HG changeset patch
# Parent  60ba51b7bcf476549e3d8165b7c90ec0a3cf0979
libsanitizer: Require assembler support for sanitizer_redefine_builtins.h [PR112563]

diff --git a/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h b/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h
--- a/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h
+++ b/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h
@@ -15,7 +15,7 @@
 #define SANITIZER_REDEFINE_BUILTINS_H
 
 // The asm hack only works with GCC and Clang.
-#if !defined(_WIN32)
+#if !defined(_WIN32) && defined(HAVE_AS_SYM_ASSIGN)
 
 asm("memcpy = __sanitizer_internal_memcpy");
 asm("memmove = __sanitizer_internal_memmove");
@@ -50,7 +50,7 @@ using vector = Define_SANITIZER_COMMON_N
 }  // namespace std
 
 #  endif  // __cpluplus
-#endif// !_WIN32
+#endif// !_WIN32 && HAVE_AS_SYM_ASSIGN
 
 #  endif  // SANITIZER_REDEFINE_BUILTINS_H
 #endif// SANITIZER_COMMON_NO_REDEFINE_BUILTINS


[COMMITTED] testsuite: Fix gcc.dg/pr111409.c on Solaris/SPARC with as

2023-11-28 Thread Rainer Orth
gcc.dg/pr111409.c FAILs on Solaris/SPARC with the native as:

FAIL: gcc.dg/pr111409.c scan-assembler-times .sections+.debug_macro 1

Unlike most other ELF targets, that assembler requires the section name to
be double-quoted.  This patch allows for that.  It also expects \t to
separate .section directive and name like other similar tests, and escapes
literal dots.

Tested on sparc-sun-solaris2.11 (as and gas) and i386-pc-solaris2.11 (as
and gas).

According to gcc-testresults, the test also FAILs on
powerpc-ibm-aix7.2.5.0 and hppa64-hp-hpux11.11.  AIX seems to be the
same issue, while HP/UX apparently has a different section syntax.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-11-23  Rainer Orth  

gcc/testsuite:
* gcc.dg/pr111409.c: Allow for " before .debug_macro.
Quote literals dots.

# HG changeset patch
# Parent  fd39a5a60b8433590aee9d4e91f3683675d37a0b
testsuite: Fix gcc.dg/pr111409.c on Solaris/SPARC with as

diff --git a/gcc/testsuite/gcc.dg/pr111409.c b/gcc/testsuite/gcc.dg/pr111409.c
--- a/gcc/testsuite/gcc.dg/pr111409.c
+++ b/gcc/testsuite/gcc.dg/pr111409.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
 /* { dg-skip-if "split DWARF unsupported" { *-*-darwin* } } */
 /* { dg-options "-gsplit-dwarf -g3 -dA" } */
-/* { dg-final { scan-assembler-times {.section\s+.debug_macro} 1 } } */
-/* { dg-final { scan-assembler-not {.byte\s+0x7\s*#\s*Import} } } */
+/* { dg-final { scan-assembler-times {\.section\t"?\.debug_macro} 1 } } */
+/* { dg-final { scan-assembler-not {\.byte\s+0x7\s*#\s*Import} } } */
 
 #define foo 1


[PATCH] testsuite, i386: Only check for cfi directives if supported [PR112729]

2023-11-28 Thread Rainer Orth
gcc.target/i386/apx-interrupt-1.c and two more tests FAIL on Solaris/x86
with the native assembler.  Like Darwin as, it doesn't support cfi
directives.  Instead of adding more and more targets in every affected
test, this patch introduces a cfi effective-target keyword to check for
the prerequisite.

Tested on i386-pc-solaris2.11 (as and gas), x86_64-pc-linux-gnu, and
x86_64-apple-darwin23.1.0.

Any comments on the CFI detection in target-supports.exp?  Otherwise,
I'll commit the patch as is.

The tests still FAIL on Solaris/x86 and FreeBSD/x86_64 with gas due to
their -fno-omit-frame-pointer default; this will be addressed
separately.

Thanks.
Raine

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-11-24  Rainer Orth  

gcc/testsuite:
PR testsuite/112729
* lib/target-supports.exp (check_effective_target_cfi): New proc.
* gcc.target/i386/apx-interrupt-1.c: Require cfi instead of
skipping on *-*-darwin*.
* gcc.target/i386/apx-push2pop2_force_drap-1.c: Likewise.
* gcc.target/i386/apx-push2pop2-1.c: Likewise.

gcc:
PR testsuite/112729
* doc/sourcebuild.texi (Effective-Target Keywords, Environment
attributes): Document cfi.

# HG changeset patch
# Parent  4c217a4922ab8f91e45518fef88ad562f71fc0a5
testsuite, i386: Only check for cfi directives if supported

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2671,6 +2671,9 @@ The language for the compiler under test
 @item c99_runtime
 Target provides a full C99 runtime.
 
+@item cfi
+Target supports DWARF CFI directives.
+
 @item correct_iso_cpp_string_wchar_protos
 Target @code{string.h} and @code{wchar.h} headers provide C++ required
 overloads for @code{strchr} etc. functions.
diff --git a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
--- a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
+++ b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-do compile { target { { ! ia32 } && cfi } } } */
 /* { dg-options "-mapx-features=egpr -m64 -O2 -mgeneral-regs-only -mno-cld -mno-push-args -maccumulate-outgoing-args" } */
-/* { dg-skip-if "does not emit .cfi_xxx" "*-*-darwin*" } */
 
 extern void foo (void *) __attribute__ ((interrupt));
 extern int bar (int);
diff --git a/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c b/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c
--- a/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c
+++ b/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-do compile { target { { ! ia32 } && cfi } } } */
 /* { dg-options "-O2 -mapx-features=push2pop2" } */
-/* { dg-skip-if "does not emit .cfi_xxx" "*-*-darwin*" } */
 
 extern int bar (int);
 
diff --git a/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c b/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c
--- a/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c
+++ b/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-do compile { target { { ! ia32 } && cfi } } } */
 /* { dg-options "-O2 -mapx-features=push2pop2 -mforce-drap" } */
-/* { dg-skip-if "does not emit .cfi_xxx" "*-*-darwin*" } */
 
 #include "apx-push2pop2-1.c"
 
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -10082,6 +10082,18 @@ proc check_effective_target_c99_runtime 
 }]
 }
 
+# Return 1 if the target supports DWARF CFI directives.
+
+proc check_effective_target_cfi { } {
+return [check_no_compiler_messages cfi assembly {
+	#ifdef __GCC_HAVE_DWARF2_CFI_ASM
+/* ok */
+	#else
+	#error unsupported
+	#endif
+} ""]
+}
+
 # Return 1 if the target provides the D runtime.
 
 proc check_effective_target_d_runtime { } {


Re: [PATCH] libsanitizer: Check assembler support for symbol assignment [PR112563]

2023-11-27 Thread Rainer Orth
Hi Jakub,

>> But will they accept a patch to check a macro never set anywhere in and
>> irrelevant to LLVM?  That's why I kept all in one patch, to be GCC-local.
>
> I meant the patch would be gcc local.
> But, for later we need only the changes to the imported files be in one
> commit, not others, because merge.sh will not revert the GCC owned changes,
> just the imported ones, and so that is what should be reapplied.
> And, the preference of not using config.h is because we do it like that
> for other stuff already (exactly to minimize amount of local changes).

ah, now I get it.  Will rework the patch accordingly.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH] libsanitizer: Check assembler support for symbol assignment [PR112563]

2023-11-27 Thread Rainer Orth
Hi Jakub,

>> 2023-11-23  Rainer Orth  
>> 
>>  libsanitizer:
>>  PR libsanitizer/112563
>>  * configure.ac (libsanitizer_cv_as_sym_assign): Check for
>>  assembler symbol assignment support.
>>  * configure, config.h.in: Regenerate.
>>  * sanitizer_common/sanitizer_redefine_builtins.h: Include config.h.
>>  Check HAVE_AS_SYM_ASSIGN.
>
> Can you please
> 1) split it into 2 patches, one touching config* which is owned by GCC (and
>Makefiles, see later), one just 
> sanitizer_common/sanitizer_redefine_builtins.h
> 2) avoid using config.h in, instead use AC_SUBST and add @HAVE_AS_SYM_ASSIGN@
>to Makefile.am's DEFS where needed (either expanding to nothing or
>-DHAVE_AS_SYM_ASSIGN=1)?  The reason is to minimize changes to imported
>sources
>
> Once the sanitizer_common/sanitizer_redefine_builtins.h change (just
> the && defined(HAVE_AS_SYM_ASSIGN) addition) patch is committed and pushed
> upstream, add its commit has LOCAL_PATCHES.

But will they accept a patch to check a macro never set anywhere in and
irrelevant to LLVM?  That's why I kept all in one patch, to be GCC-local.

If we go (or at least try) this upstream route, should I wait for
approval there and than commit both parts to GCC, keeping it in my local
tree until then?

> Note, your ChangeLog entry was pretending config.h include has been added
> to one header, but it went to a different one instead.

Drats, that's what you get for starting one way and adjusting later ;-)

    Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[PATCH] libsanitizer: Check assembler support for symbol assignment [PR112563]

2023-11-27 Thread Rainer Orth
The recent libsanitizer import broke the build on Solaris/SPARC with the
native as:

/usr/ccs/bin/as: ".libs/sanitizer_errno.s", line 4247: error: symbol 
"__sanitizer_internal_memset" is used but not defined
/usr/ccs/bin/as: ".libs/sanitizer_errno.s", line 4247: error: symbol 
"__sanitizer_internal_memcpy" is used but not defined
/usr/ccs/bin/as: ".libs/sanitizer_errno.s", line 4247: error: symbol 
"__sanitizer_internal_memmove" is used but not defined

Since none of the alternatives considered in the PR worked out, this
patch checks if the assembler does support symbol assignment, disabling
the code otherwise.  This returns the code to the way it was up to LLVM 16.

Bootstrapped without regressions on sparc-sun-solaris2.11 (as and gas),
i386-pc-solaris2.11, x86_64-pc-linux-gnu, and x86_64-apple-darwin21.6.0.

Ok for trunk?

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-11-23  Rainer Orth  

libsanitizer:
PR libsanitizer/112563
* configure.ac (libsanitizer_cv_as_sym_assign): Check for
assembler symbol assignment support.
* configure, config.h.in: Regenerate.
* sanitizer_common/sanitizer_redefine_builtins.h: Include config.h.
Check HAVE_AS_SYM_ASSIGN.

# HG changeset patch
# Parent  1f757467f1bed35373c55b65cde4f9b0506172f5
libsanitizer: Require assembler support for sanitizer_redefine_builtins.h [PR112563]

diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -214,6 +214,19 @@ if test "$libsanitizer_cv_sys_atomic" = 
 	[Define to 1 if you have the __atomic functions])
 fi
 
+# Check if assembler supports symbol assignment.
+AC_CACHE_CHECK([assembler symbol assignment],
+[libsanitizer_cv_as_sym_assign],
+[AC_COMPILE_IFELSE(
+  [AC_LANG_PROGRAM([],
+		   [asm("a = b");])],
+  [libsanitizer_cv_as_sym_assign=yes],
+  [libsanitizer_cv_as_sym_assign=no])])
+if test "$libsanitizer_cv_as_sym_assign" = "yes"; then
+  AC_DEFINE([HAVE_AS_SYM_ASSIGN], 1,
+  	[Define to 1 if assembler supports symbol assignment])
+fi
+
 # The library needs to be able to read the executable itself.  Compile
 # a file to determine the executable format.  The awk script
 # filetype.awk prints out the file type.
diff --git a/libsanitizer/sanitizer_common/sanitizer_internal_defs.h b/libsanitizer/sanitizer_common/sanitizer_internal_defs.h
--- a/libsanitizer/sanitizer_common/sanitizer_internal_defs.h
+++ b/libsanitizer/sanitizer_common/sanitizer_internal_defs.h
@@ -12,6 +12,7 @@
 #ifndef SANITIZER_DEFS_H
 #define SANITIZER_DEFS_H
 
+#include "config.h"
 #include "sanitizer_platform.h"
 #include "sanitizer_redefine_builtins.h"
 
diff --git a/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h b/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h
--- a/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h
+++ b/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h
@@ -15,7 +15,7 @@
 #define SANITIZER_REDEFINE_BUILTINS_H
 
 // The asm hack only works with GCC and Clang.
-#if !defined(_WIN32)
+#if !defined(_WIN32) && defined(HAVE_AS_SYM_ASSIGN)
 
 asm("memcpy = __sanitizer_internal_memcpy");
 asm("memmove = __sanitizer_internal_memmove");
@@ -50,7 +50,7 @@ using vector = Define_SANITIZER_COMMON_N
 }  // namespace std
 
 #  endif  // __cpluplus
-#endif// !_WIN32
+#endif// !_WIN32 && HAVE_AS_SYM_ASSIGN
 
 #  endif  // SANITIZER_REDEFINE_BUILTINS_H
 #endif// SANITIZER_COMMON_NO_REDEFINE_BUILTINS


Re: [committed] sanitizer: Fix build on SPARC/Solaris with Solaris as [PR112562]

2023-11-22 Thread Rainer Orth
Hi Jakub,

> Solaris as apparently doesn't accept %function and requires @function
> instead.

actually, it's the other way round: Solaris/x86 as cannot handle
%function, but requires @function.

Solaris/SPARC as is similar (requires #function instead), but is
unaffected: sanitizer_asm.h disables ASM_INTERCEPTOR_TRAMPOLINE on sparc
and sets ASM_INTERCEPTOR_TRAMPOLINE_SUPPORT to 0, so interceptor.h
doesn't use the problematic version of DECLARE_WRAPPER.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [committed] d: Merge upstream dmd ff57fec515, druntime ff57fec515, phobos 17bafda79.

2023-11-21 Thread Rainer Orth
Rainer Orth  writes:

> either this patch or the previous one broke D bootstrap with GCC 9.  On
> both i386-pc-solaris2.11 with gdc 9.4.0 and sparc-sun-solaris2.11 with
> gdc 9.3.0, stage 1 d21 fails to link with
>
> Undefined   first referenced
>  symbol in file
> _D3dmd4root11stringtable34__T11StringValueTC3dmd5mtype4TypeZ11StringValue7lstringMFNaNbNiNjZPa
>  d/func.o
> _D3dmd4root11stringtable34__T11StringValueTC3dmd5mtype4TypeZ11StringValue8toDcharsMxFNaNbNiNjZPxa
>  d/func.o
> _D3dmd4root11stringtable34__T11StringValueTC3dmd5mtype4TypeZ11StringValue8toStringMxFNaNbNiNjZAxa
>  d/func.o
> ld: fatal: symbol referencing errors
> collect2: error: ld returned 1 exit status
> make[3]: *** [/vol/gcc/src/hg/master/local/gcc/d/Make-lang.in:236: d21] Error 
> 1

Same on i686-pc-linux-gnu, btw.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [committed] d: Merge upstream dmd ff57fec515, druntime ff57fec515, phobos 17bafda79.

2023-11-21 Thread Rainer Orth
Hi Iain,

> This patch merges the D front-end and runtime library with upstream dmd
> ff57fec515, and the standard library with phobos 17bafda79.
>
> Synchronizing with the upstream release candidate of v2.106.0.
>
> D front-end changes:
>
> - Import dmd v2.106.0-rc.1.
> - New'ing multi-dimensional arrays are now are converted to a single
>   template call `_d_newarraymTX'.
>
> D runtime changes:
>
> - Import druntime v2.106.0-rc.1.
>
> Phobos changes:
>
> - Import phobos v2.106.0-rc.1.
>
> Bootstrapped and regression tested on x86_64-linux-gnu/-m32, committed
> to mainline.

either this patch or the previous one broke D bootstrap with GCC 9.  On
both i386-pc-solaris2.11 with gdc 9.4.0 and sparc-sun-solaris2.11 with
gdc 9.3.0, stage 1 d21 fails to link with

Undefined   first referenced
 symbol in file
_D3dmd4root11stringtable34__T11StringValueTC3dmd5mtype4TypeZ11StringValue7lstringMFNaNbNiNjZPa
 d/func.o
_D3dmd4root11stringtable34__T11StringValueTC3dmd5mtype4TypeZ11StringValue8toDcharsMxFNaNbNiNjZPxa
 d/func.o
_D3dmd4root11stringtable34__T11StringValueTC3dmd5mtype4TypeZ11StringValue8toStringMxFNaNbNiNjZAxa
 d/func.o
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
make[3]: *** [/vol/gcc/src/hg/master/local/gcc/d/Make-lang.in:236: d21] Error 1

I'm now running bootstraps with gdc 11.1.0 instead, which seems to work:
in both cases, stage 1 d21 did link.

If this is intentional, install.texi should be updated accordingly.

Rainer

-- 
---------
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: gfortran.dg/dg.exp debug messages pollute test output

2023-11-15 Thread Rainer Orth
Hi FX,

>> FX submitted the patch series, I can find the reference if you need it.
>
> Patch was submitted in this thread:
> https://gcc.gnu.org/pipermail/gcc-patches/2023-September/630096.html

ah, I see.  I'd been looking for the patch summary and Iain's name in my
searches; that's why I came up blank.

>>> Besides,
>>> it's unclear if those messages can just be removed (they are pretty
>>> cryptic as is) or at least changed to use verbose instead of puts.
>>> Please fix.
>
> I don’t see value in this output, so I think it’s best to remove the puts
> calls entirely. Attached patch does that.
> Testing under progress, OK if it passes? (or does that count as obvious
> fix-up of the previous patch)

Ok for trunk.  However, this perfectly fits the obvious criteria, too.

Thanks.
Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


gfortran.dg/dg.exp debug messages pollute test output

2023-11-13 Thread Rainer Orth
Hi Iain,

I happened to notice that make check output is cluttered with the likes
of

dg set al  
-B/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/./libatomic/  
-B/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/./libatomic/.libs
 ml /var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/.
revised FFLAGS -pedantic-errors 
-B/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/./libatomic/ 
-B/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/./libatomic/.libs

(quite a number of instances).  Those messages are from
gfortran.dg/dg.exp, introduced by your patch

commit a0673ec5f9236dca6ada23f28343c591ccd575e4
Author: Iain Sandoe 
Date:   Fri Apr 16 20:01:40 2021 +0100

Testsuite: allow non-installed testing on darwin

I couldn't find any submission for that patch, unfortunately.  Besides,
it's unclear if those messages can just be removed (they are pretty
cryptic as is) or at least changed to use verbose instead of puts.

Please fix.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH] Format gotools.sum closer to what DejaGnu does

2023-11-02 Thread Rainer Orth
rep.dot@gmail.com writes:

> On 2 November 2023 18:06:54 CET, Maxim Kuvyrkov 
> wrote:
>>> On Nov 2, 2023, at 21:02, rep.dot@gmail.com wrote:
>>> 
>>> Hi Maxim!
>>> 
>>> Many thanks for the patch! Quick question below..
>>> 
>>> On 2 November 2023 13:48:55 CET, Maxim Kuvyrkov
>>>  wrote:
[...]
>>> Are you sure you used the correct version of automake?
>>
>>I used automake 1.15.1 (from Ubuntu 20.04 automake-1.15 package), and I
>> double-checked after getting the runstatedir update.
>
> I think that runstatedir is a Debian (and derivatives) addition, would
> probably suffice to just drop that line manually..

One needs to use the exact version of the autotools as documented on
https://gcc.gnu.org/install/prerequisites.html.  Since distros often
apply local patches, it's best to use a self-built version to guard
against those.  Manually dropping parts of the regenerated files is
heavily fraught with error, especially since you usually don't know what
to drop.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [committed] d: Merge upstream dmd, druntime e48bc0987d, phobos 2458e8f82.

2023-10-30 Thread Rainer Orth
Hi Iain,

> This patch merges the D front-end and runtime library with upstream dmd
> e48bc0987d, and standard library with phobos 2458e8f82.
>
> Synchronizing with the v2.106.0-beta.1 release.
>
> D front-end changes:
>
> - Import dmd v2.106.0-beta.1.

this patch broke D bootstrap, it seems:

/vol/gcc/src/hg/master/local/gcc/d/expr.cc: In member function 'virtual void 
ExprVisitor::visit(NewExp*)':
/vol/gcc/src/hg/master/local/gcc/d/expr.cc:2361:21: error: unused variable 
'tarray' [-Werror=unused-variable]
 2361 | TypeDArray *tarray = tb->isTypeDArray ();
  | ^~

It removed the uses of tarray, but kept the initialization.

Rainer

-- 
---------
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH] build: Allow for Xcode 15 ld -v output

2023-08-16 Thread Rainer Orth
Hi Iain,

> OK, thanks
> (I do not yet have an xcode-15 or darwin23 setup)

Xcode 15 beta claims to also support macOS 13/Darwin 22, though I
haven't tried this.

> After some bake time,  this will need backporting to open branches, to avoid 
> those also failing in the same way,

Agreed: those incompatibilities are pretty messy.  It seems Apple has
changed a considerable part of the cctools (or however they call it
those days) codebase.  dsymutil is another case which now warns

warning: '.debug_macinfo' is not currently supported: file will be skipped
note: while processing const1.o

in quite a number of cases where the previous version didn't.

>> Note however that the new ld isn't yet usable to build gcc: for a
>> trivial testcase which amounts to
>> 
>> ld -dynamic -o conftest conftest.o libstdc++.a -lSystem -no_compact_unwind
>> 
>> it dies with an assertion failure.  I've filed a bug for this issue:
>> 
>> ld assertion failure in ld::AtomPlacement::findAtom (FB12978804)
>> 
>> Instead there's ld-classic which still works as usual.
>
> I’m assuming ‘ld-classic’ in this context means ‘ld64’?
> in which case, ld-classic now has two meanings :) .. (the older ld_classic
> is part of cctools)

Right: there's an actual ld-classic binary (and manpage) which still
identifies itself as ld64.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[PATCH] fixincludes: Update darwin_flt_eval_method for macOS 14

2023-08-16 Thread Rainer Orth
On macOS 14, a guard in  changed:

-- MacOSX13.3.sdk/usr/include/math.h2023-04-19 01:54:44
+++ MacOSX14.0.sdk/usr/include/math.h   2023-08-01 08:42:43
@@ -22,0 +23 @@
+
@@ -43 +44 @@
-#if __FLT_EVAL_METHOD__ == 0
+#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == -1
@@ -49 +50 @@
-#elif __FLT_EVAL_METHOD__ == 2 || __FLT_EVAL_METHOD__ == -1
+#elif __FLT_EVAL_METHOD__ == 2

Therefore the darwin_flt_eval_method fixincludes fix doesn't match any
longer, leading to a large number of testsuite failures like

/private/var/gcc/regression/master/14-gcc/build/gcc/include-fixed/math.h:69:5: 
error: #error "Unsupported value of __FLT_EVAL_METHOD__."  

where __FLT_EVAL_METHOD__ = 16.

This patch adjusts the fix to allow for both forms.

Tested with make check in fixincludes on x86_64-apple-darwin23.0.0 and
verifying that  has indeed been fixed as expected.

Ok for trunk?

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-08-16  Rainer Orth  

fixincludes:
* inclhack.def (darwin_flt_eval_method): Handle macOS 14 guard
variant.
* fixincl.x: Regenerate.
* tests/base/math.h [DARWIN_FLT_EVAL_METHOD_CHECK]: Update test.

# HG changeset patch
# Parent  e7f5115ad4125cf69230cd511f1887327f1b3d4b
fixincludes: Update darwin_flt_eval_method for macOS 14

diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -1819,10 +1819,11 @@ fix = {
 hackname  = darwin_flt_eval_method;
 mach  = "*-*-darwin*";
 files = math.h;
-select= "^#if __FLT_EVAL_METHOD__ == 0$";
-c_fix = format;
-c_fix_arg = "#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 16";
-test_text = "#if __FLT_EVAL_METHOD__ == 0";
+select= "^#if __FLT_EVAL_METHOD__ == 0( \\|\\| __FLT_EVAL_METHOD__ == -1)?$";
+c_fix = format;
+c_fix_arg = "%0 || __FLT_EVAL_METHOD__ == 16";
+test_text = "#if __FLT_EVAL_METHOD__ == 0\n"
+		"#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == -1";
 };
 
 /*
diff --git a/fixincludes/tests/base/math.h b/fixincludes/tests/base/math.h
--- a/fixincludes/tests/base/math.h
+++ b/fixincludes/tests/base/math.h
@@ -32,6 +32,7 @@
 
 #if defined( DARWIN_FLT_EVAL_METHOD_CHECK )
 #if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 16
+#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == -1 || __FLT_EVAL_METHOD__ == 16
 #endif  /* DARWIN_FLT_EVAL_METHOD_CHECK */
 
 


[PATCH] build: Allow for Xcode 15 ld -v output

2023-08-16 Thread Rainer Orth
Since Xcode 15 beta 6, ld -v output differs from previous versions:

* macOS 13/Xcode 14:

  @(#)PROGRAM:ld  PROJECT:ld64-857.1

* macOS 14/Xcode 15:

  @(#)PROGRAM:ld  PROJECT:dyld-1015.1

configure cannot handle the new form, so LD64_VERSION isn't set.

This patch fixes this.  The autoconf manual states that sed doesn't
portably support alternation, so I'm using two separate expressions to
extract the version number.

Tested on x86_64-apple-darwin23.0.0.

Ok for trunk?


Note however that the new ld isn't yet usable to build gcc: for a
trivial testcase which amounts to

ld -dynamic -o conftest conftest.o libstdc++.a -lSystem -no_compact_unwind

it dies with an assertion failure.  I've filed a bug for this issue:

ld assertion failure in ld::AtomPlacement::findAtom (FB12978804)

Instead there's ld-classic which still works as usual.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-08-16  Rainer Orth  

gcc:
* configure.ac (gcc_cv_ld64_version): Allow for dyld in ld -v
output.
* configure: Regenerate.

# HG changeset patch
# Parent  97d64120b89e921db84ade7f8c75d9e18072d768
build: Allow for Xcode 15 ld -v output

diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6263,7 +6263,8 @@ if test x"$ld64_flag" = x"yes"; then
 # If the version was not specified, try to find it.
 AC_MSG_CHECKING(linker version)
 if test x"${gcc_cv_ld64_version}" = x; then
-  gcc_cv_ld64_version=`$gcc_cv_ld -v 2>&1 | grep ld64 | sed s/.*ld64-// | awk '{print $1}'`
+  gcc_cv_ld64_version=`$gcc_cv_ld -v 2>&1 | $EGREP 'ld64|dyld' \
+  | sed -e 's/.*ld64-//' -e 's/.*dyld-//'| awk '{print $1}'`
 fi
 AC_MSG_RESULT($gcc_cv_ld64_version)
 


Re: [PATCH] config-list.mk Darwin: Use --with-gnu-as

2023-08-15 Thread Rainer Orth
Hi Jan-Benedict,

> config-list.mk Darwin: Use --with-gnu-as for mass-building tests
>
> As `config-list.mk` is probably mostly used on Linux system, where
> Apple's tools aren't around. Let's use --with-gnu-as instead to have
> an useable assembler.
>
> contrib/ChangeLog:
>
>   * config-list.mk (i686-apple-darwin): Use --with-gnu-as.
>   (i686-apple-darwin9): Ditto.
>   (i686-apple-darwin10): Ditto.
>   (powerpc-darwin8): Ditto.
>   (powerpc-darwin7): Ditto.
>   (powerpc64-darwin): Ditto.
>   (x86_64-apple-darwin): Ditto.

this doesn't seem right: binutils toplevel configure.ac has gas in
noconfigdirs for all but i?86-*-darwin*.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


[PATCH] libsanitizer: Fix SPARC stacktraces

2023-08-07 Thread Rainer Orth
As detailed in LLVM Issue #57624
(https://github.com/llvm/llvm-project/issues/57624), a patch to
sanitizer_internal_defs.h broke SPARC stacktraces in the sanitizers.
The issue has now been fixed upstream (https://reviews.llvm.org/D156504)
and I'd like to cherry-pick that patch.

Bootstrapped without regressions on sparc-sun-solaris2.11.

Ok for trunk and the gcc-13 branch?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-07-27  Rainer Orth  

libsanitizer:
* sanitizer_common/sanitizer_stacktrace_sparc.cpp,
sanitizer_common/sanitizer_unwind_linux_libcdep.cpp: Cherry-pick
llvm-project revision 679c076ae446af81eba81ce9b94203a273d4b88a.

# HG changeset patch
# Parent  cc61fd6b33c37b7a2a1415e0ed02f75dd8a21110
Fix SPARC stacktraces in sanitizers

diff --git a/libsanitizer/sanitizer_common/sanitizer_stacktrace_sparc.cpp b/libsanitizer/sanitizer_common/sanitizer_stacktrace_sparc.cpp
--- a/libsanitizer/sanitizer_common/sanitizer_stacktrace_sparc.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_stacktrace_sparc.cpp
@@ -30,13 +30,7 @@ void BufferedStackTrace::UnwindFast(uptr
   // TODO(yln): add arg sanity check for stack_top/stack_bottom
   CHECK_GE(max_depth, 2);
   const uptr kPageSize = GetPageSizeCached();
-#if defined(__GNUC__)
-  // __builtin_return_address returns the address of the call instruction
-  // on the SPARC and not the return address, so we need to compensate.
-  trace_buffer[0] = GetNextInstructionPc(pc);
-#else
   trace_buffer[0] = pc;
-#endif
   size = 1;
   if (stack_top < 4096) return;  // Sanity check for stack top.
   // Flush register windows to memory
diff --git a/libsanitizer/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp b/libsanitizer/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp
--- a/libsanitizer/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp
@@ -139,13 +139,7 @@ void BufferedStackTrace::UnwindSlow(uptr
   if (to_pop == 0 && size > 1)
 to_pop = 1;
   PopStackFrames(to_pop);
-#if defined(__GNUC__) && defined(__sparc__)
-  // __builtin_return_address returns the address of the call instruction
-  // on the SPARC and not the return address, so we need to compensate.
-  trace_buffer[0] = GetNextInstructionPc(pc);
-#else
   trace_buffer[0] = pc;
-#endif
 }
 
 void BufferedStackTrace::UnwindSlow(uptr pc, void *context, u32 max_depth) {


Re: [pushed][LRA]: Check and update frame to stack pointer elimination after stack slot allocation

2023-07-20 Thread Rainer Orth
Hi Vladimir,

> The following patch is necessary for porting avr to LRA.
>
> The patch was successfully bootstrapped and tested on x86-64, aarch64, and
> ppc64le.
>
> There is still avr poring problem with reloading of subreg of frame
> pointer.  I'll address it later on this week.

this patch most likely broke sparc-sun-solaris2.11 bootstrap:

/var/gcc/regression/master/11.4-gcc/build/./gcc/xgcc 
-B/var/gcc/regression/master/11.4-gcc/build/./gcc/ 
-B/vol/gcc/sparc-sun-solaris2.11/bin/ -B/vol/gcc/sparc-sun-solaris2.11/lib/ 
-isystem /vol/gcc/sparc-sun-solaris2.11/include -isystem 
/vol/gcc/sparc-sun-solaris2.11/sys-include   -fchecking=1 -c -g -O2   -W -Wall 
-gnatpg -nostdinc   g-alleve.adb -o g-alleve.o
+===GNAT BUG DETECTED==+ 
| 14.0.0 20230720 (experimental) [master 
506f068e7d01ad2fb107185b8fb204a0ec23785c] (sparc-sun-solaris2.11) GCC error:|
| in update_reg_eliminate, at lra-eliminations.cc:1179 |
| Error detected around g-alleve.adb:4132:8

This is in stage 3.  I haven't investigated further yet.

Rainer

-- 
-----
Rainer Orth, Center for Biotechnology, Bielefeld University


[PATCH] m2, build: Use LDLFAGS for mklink

2023-07-13 Thread Rainer Orth
When trying to bootstrap current trunk on macOS 14.0 beta 3 with Xcode
15 beta 4, the build failed running mklink in stage 2:

unset CC ; m2/boot-bin/mklink -s --langc++ --exit --name m2/mc-boot/main.cc 
/vol/gcc/src/hg/master/darwin/gcc/m2/init/mcinit
dyld[55825]: Library not loaded: /vol/gcc/lib/libstdc++.6.dylib

While it's unclear to me why this only happens on macOS 14, the problem
is clear: unlike other C++ executables, mklink isn't linked with
-static-libstdc++ which is passed in from toplevel in LDFLAGS.

This patch fixes that and allows the build to continue.

Bootstrapped on x86_64-apple-darwin23.0.0, i386-pc-solaris2.11, and
sparc-sun-solaris2.11.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-07-11  Rainer Orth  

gcc/m2:
* Make-lang.in (m2/boot-bin/mklink$(exeext)): Add $(LDFLAGS).

# HG changeset patch
# Parent  b4327a00f1cdf8ce96f0483bbac09cc5f6108218
m2: Use LDLFAGS for mklink

diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in
--- a/gcc/m2/Make-lang.in
+++ b/gcc/m2/Make-lang.in
@@ -1653,7 +1653,7 @@ m2/gm2-compiler-boot/gm2.a: m2/boot-bin/
 
 m2/boot-bin/mklink$(exeext): $(srcdir)/m2/tools-src/mklink.c
 	-test -d $(@D) || $(mkinstalldirs) $(@D)
-	$(CXX) $(CFLAGS) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-compiler-boot -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) $< -o $@
+	$(CXX) $(CFLAGS) $(LDFLAGS) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-compiler-boot -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) $< -o $@
 
 m2/gm2-compiler-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-compiler-boot/%.def $(MCDEPS)
 	-test -d $(@D) || $(mkinstalldirs) $(@D)


  1   2   3   4   5   6   7   8   9   10   >