Hi Jakub,

>>> +   { dg-output-file target-cdtor-2.output { xfail *-*-solaris2* } }
>>
>> This looks wrong to me, the original dg-output has different effective
>> targets, but there is just one output file, so it will either fail
>> for offload_device, or fail without that.
>
> drats, I just blindly copied the Linux output into *.output, ignoring
> the offload_device cases ;-(
>
> Here's what I've done now: I use two output files, one without target
> offload_device (xfail'ed on Solaris), one with it.  The offload_device
> file doesn't need to care about Solaris: this case will never happen.
>
> AFAICS we don't have to worry about different newline conventions:
> dg-output-file resp. gcc-dg.exp's ${tool}_load use gets to read the
> file, which discards newlines.  I'm uncertain if there can be multiple
> newlines, though, which are allowed by the original patterns.

while this approach avoids skipping the whole test so the test would
XPASS if the issue is fixed, it's harder to read because the output is
partially duplicated between the two *.output files.

So this revision finally skips the test.

Ok for trunk now?

---------------------------------------------------------------------------

The libgomp.c++/target-cdtor-2.C test FAILs on Solaris:

FAIL: libgomp.c++/target-cdtor-2.C output pattern test

Compared to the Linux output

~S, 5, 1
[...]
finiDH1, 1

the Solaris output has a different order:

finiDH1, 1
[...]
~S, 5, 1

This is another instance of the long-standing PR c++/81337.  As detailed
there, the relative order of ~S::S() and __attribute__((destructor()))
functions isn't guaranteed.  Since xfail'ing the dg-output parts isn't
practical, this patch skips the whole test on Solaris.

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

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


2025-12-16  Rainer Orth  <[email protected]>

        libgomp:
        PR c++/81337
        * testsuite/libgomp.c++/target-cdtor-2.C: Skip on Solaris.
        Fix comments.

# HG changeset patch
# Parent  08ef12c32aac0de955f2bae818debf33a345502d
libgomp: xfail libgomp.c++/target-cdtor-2.C on Solaris [PR81337]

diff --git a/libgomp/testsuite/libgomp.c++/target-cdtor-2.C b/libgomp/testsuite/libgomp.c++/target-cdtor-2.C
--- a/libgomp/testsuite/libgomp.c++/target-cdtor-2.C
+++ b/libgomp/testsuite/libgomp.c++/target-cdtor-2.C
@@ -1,10 +1,12 @@
 /* Offloaded 'constructor' and 'destructor' functions, and C++ objects construction and destruction.  */
 
 /* { dg-require-effective-target init_priority } */
+/* { dg-skip-if "PR c++/81337: destructor ordering" { *-*-solaris2* } } */
 
-/* { dg-additional-options -fdump-tree-optimized-raw-asmname }
-   { dg-additional-options -foffload-options=-fdump-tree-optimized-raw-asmname } */
-// { dg-additional-options "-Wno-deprecated-openmp" }
+/* { dg-additional-options -fdump-tree-optimized-raw-asmname } */
+/* { dg-additional-options -foffload-options=-fdump-tree-optimized-raw-asmname } */
+/* { dg-additional-options "-Wno-deprecated-openmp" } */
+
 #include <omp.h>
 #include <vector>
 

Reply via email to