Bug 104725 - g++.target/i386/pr35513-1.C etc. FAIL
Summary: g++.target/i386/pr35513-1.C etc. FAIL
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: testsuite (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: 12.0
Assignee: Not yet assigned to anyone
URL:
Keywords: testsuite-fail
Depends on:
Blocks:
 
Reported: 2022-03-01 09:29 UTC by Rainer Orth
Modified: 2022-03-04 00:28 UTC (History)
1 user (show)

See Also:
Host:
Target: i?86-pc-solaris2.11
Build:
Known to work:
Known to fail:
Last reconfirmed: 2022-03-01 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Orth 2022-03-01 09:29:11 UTC
Since 20220209, two tests FAIL on 32-bit Solaris/x86:

+FAIL: g++.target/i386/pr35513-1.C  -std=gnu++14 execution test
+FAIL: g++.target/i386/pr35513-1.C  -std=gnu++17 execution test
+FAIL: g++.target/i386/pr35513-1.C  -std=gnu++20 execution test
+FAIL: g++.target/i386/pr35513-1.C  -std=gnu++98 execution test
+FAIL: g++.target/i386/pr35513-2.C  -std=gnu++14 execution test
+FAIL: g++.target/i386/pr35513-2.C  -std=gnu++17 execution test
+FAIL: g++.target/i386/pr35513-2.C  -std=gnu++20 execution test
+FAIL: g++.target/i386/pr35513-2.C  -std=gnu++98 execution test

The tests SEGV like this:

Thread 2 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1 (LWP 1)]
0x0805112d in _GLOBAL__sub_I__Z9throw_bugv ()
(gdb) bt
#0  0x0805112d in _GLOBAL__sub_I__Z9throw_bugv ()
#1  0xfe6b222e in call_array () from /usr/lib/ld.so.1
#2  0xfe6b23e3 in call_init () from /usr/lib/ld.so.1
#3  0xfe6b10af in setup () from /usr/lib/ld.so.1
#4  0xfe6c3fc0 in _setup () from /usr/lib/ld.so.1
#5  0xfe6a38ff in _rt_boot () from /usr/lib/ld.so.1
#6  0xfeffda18 in ?? ()
#7  0xfeffdbb8 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

This is obviously related to
commit 5c4258d7c78a92ab17c14dec1163d87fc42ff019
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Feb 10 05:42:49 2022 -0800

    x86: Update PR 35513 tests
    
    1. Require linker with GNU_PROPERTY_1_NEEDED support for PR 35513
    run-time tests.
[...]
            PR testsuite/104481
            * g++.target/i386/pr35513-1.C: Require property_1_needed target.
            * g++.target/i386/pr35513-2.C: Likewise.
[...]
            * lib/target-supports.exp (check_compile): Support assembly code.
            (check_effective_target_property_1_needed): New proc.

I honestly don't see how check_effective_target_property_1_needed does test for
linker GNU_PROPERTY_1_NEEDED support, which Solaris ld certainly lacks, thus
the tests shouldn't run in the first place.
Comment 1 H.J. Lu 2022-03-01 14:15:54 UTC
It looks like Solaris linker doesn't support -mno-direct-extern-access.
Did you try GNU linker?

This patch limits tests to Linux:

diff --git a/gcc/testsuite/g++.target/i386/pr35513-1.C b/gcc/testsuite/g++.target/i386/pr35513-1.C
index daa615662c5..82e63277fd2 100644
--- a/gcc/testsuite/g++.target/i386/pr35513-1.C
+++ b/gcc/testsuite/g++.target/i386/pr35513-1.C
@@ -1,4 +1,4 @@
-// { dg-do run { target property_1_needed } }
+// { dg-do run { target { *-*-linux* && property_1_needed } } }
 // { dg-options "-O2 -mno-direct-extern-access" }
 
 #include <iostream>
diff --git a/gcc/testsuite/g++.target/i386/pr35513-2.C b/gcc/testsuite/g++.target/i386/pr35513-2.C
index ecccdaeb666..95782b10cf3 100644
--- a/gcc/testsuite/g++.target/i386/pr35513-2.C
+++ b/gcc/testsuite/g++.target/i386/pr35513-2.C
@@ -1,4 +1,4 @@
-// { dg-do run { target property_1_needed } }
+// { dg-do run { target { *-*-linux* && property_1_needed } } }
 // { dg-options "-O2 -mno-direct-extern-access" }
 
 class Foo 

BTW, does it fail on i686-pc-linux-gnu for you?
Comment 2 ro@CeBiTec.Uni-Bielefeld.DE 2022-03-01 15:07:13 UTC
> --- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
> It looks like Solaris linker doesn't support -mno-direct-extern-access.

Highly unlikely, I'd say.

> Did you try GNU linker?

I do once in a week: when gld is in use, the tests do PASS on solaris

> This patch limits tests to Linux:

Seems quite sensible: GNU_PROPERTY_1_NEEDED is a GNU extension after
all, so the test should be restricted to systems that support it.

> BTW, does it fail on i686-pc-linux-gnu for you?

No: the test PASSes for both x86_64-pc-linux-gnu -m32 and
i686-pc-linux-gnu.
Comment 3 H.J. Lu 2022-03-01 15:30:18 UTC
(In reply to ro@CeBiTec.Uni-Bielefeld.DE from comment #2)
> > --- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
> > It looks like Solaris linker doesn't support -mno-direct-extern-access.
> 
> Highly unlikely, I'd say.
> 
> > Did you try GNU linker?
> 
> I do once in a week: when gld is in use, the tests do PASS on solaris
> 
> > This patch limits tests to Linux:
> 
> Seems quite sensible: GNU_PROPERTY_1_NEEDED is a GNU extension after
> all, so the test should be restricted to systems that support it.

I will check in my patch.

> > BTW, does it fail on i686-pc-linux-gnu for you?
> 
> No: the test PASSes for both x86_64-pc-linux-gnu -m32 and
> i686-pc-linux-gnu.
Comment 4 ro@CeBiTec.Uni-Bielefeld.DE 2022-03-01 15:36:40 UTC
> --- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
[...]
>> > This patch limits tests to Linux:
>> 
>> Seems quite sensible: GNU_PROPERTY_1_NEEDED is a GNU extension after
>> all, so the test should be restricted to systems that support it.
>
> I will check in my patch.

Fine: thanks for the quick fix.
Comment 5 CVS Commits 2022-03-01 15:45:48 UTC
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:673a10aee1aafe0c99bfadc29a7458339bdddb3a

commit r12-7436-g673a10aee1aafe0c99bfadc29a7458339bdddb3a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Mar 1 07:39:33 2022 -0800

    x86: Limit PR 35513 tests to Linux
    
    Limit PR 35513 tests to Linux since they fail on 32-bit Solaris/x86 with
    Solaris linker.
    
            PR testsuite/104725
            * g++.target/i386/pr35513-1.C: Limit to Linux.
            * g++.target/i386/pr35513-2.C: Likewise.
Comment 6 H.J. Lu 2022-03-01 15:50:33 UTC
Fixed.