diff mbox

[testsuite] Fix g++.dg/pr67989.C test failure when running with -march or -mcpu

Message ID 3386607.mP52vVFFoV@hardin.shanghai.arm.com
State New
Headers show

Commit Message

Thomas Preudhomme Jan. 8, 2016, 9:33 a.m. UTC
On Thursday, January 07, 2016 10:26:28 AM Richard Earnshaw wrote:
> On 07/01/16 09:15, Kyrill Tkachov wrote:
> > In this case perhaps we should go the route of just removing the
> > target-specific option
> > altogether.
> > 
> > Richard, that's the approach you recommended, right?
> 
> Yes.
> 
> I think if you really need to test a specific set of target flags, then
> it might be acceptable to have a duplicate of the test in dg.target/arm
> (but please put a comment in the (arm version of the) test to explain
> why it has been duplicated.

What about the following:


*** gcc/testsuite/ChangeLog ***

2016-01-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * g++.dg/pr67989.C: Remove ARM-specific option.
        * gcc.target/arm/pr67989.C: New file.


+}


Is this ok for stage3?

Best regards,

Thomas

Comments

Bernd Schmidt Jan. 11, 2016, 3:57 p.m. UTC | #1
On 01/08/2016 10:33 AM, Thomas Preud'homme wrote:
> 2016-01-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>
>
>          * g++.dg/pr67989.C: Remove ARM-specific option.
>          * gcc.target/arm/pr67989.C: New file.

I checked some other arm tests and they have things like

/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { 
"-march=*" } { "-march=armv4t" } } */
/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { 
"-mthumb" } { "" } } */

Do you need the same in your testcase?


Bernd
Thomas Preudhomme Jan. 12, 2016, 7:55 a.m. UTC | #2
On Monday, January 11, 2016 04:57:18 PM Bernd Schmidt wrote:
> On 01/08/2016 10:33 AM, Thomas Preud'homme wrote:
> > 2016-01-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >          * g++.dg/pr67989.C: Remove ARM-specific option.
> >          * gcc.target/arm/pr67989.C: New file.
> 
> I checked some other arm tests and they have things like
> 
> /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } {
> "-march=*" } { "-march=armv4t" } } */
> /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } {
> "-mthumb" } { "" } } */
> 
> Do you need the same in your testcase?

That was the first approach I took but Kyrill suggested me to use arm_arch_v4t 
and arm_arch_v4t_ok machinery instead. It should take care about whether the 
architecture can be selected.

Best regards,

Thomas
Bernd Schmidt Jan. 13, 2016, 5:39 p.m. UTC | #3
On 01/12/2016 08:55 AM, Thomas Preud'homme wrote:
> On Monday, January 11, 2016 04:57:18 PM Bernd Schmidt wrote:
>> On 01/08/2016 10:33 AM, Thomas Preud'homme wrote:
>>> 2016-01-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>
>>>
>>>           * g++.dg/pr67989.C: Remove ARM-specific option.
>>>           * gcc.target/arm/pr67989.C: New file.
>>
>> I checked some other arm tests and they have things like
>>
>> /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } {
>> "-march=*" } { "-march=armv4t" } } */
>> /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } {
>> "-mthumb" } { "" } } */
>>
>> Do you need the same in your testcase?
>
> That was the first approach I took but Kyrill suggested me to use arm_arch_v4t
> and arm_arch_v4t_ok machinery instead. It should take care about whether the
> architecture can be selected.

Hmm, the ones I looked at did use dg-add-options, but not the 
corresponding _ok requirement. So I think this is OK.


Bernd
Thomas Preudhomme Jan. 18, 2016, 3:33 a.m. UTC | #4
On Wednesday, January 13, 2016 06:39:20 PM Bernd Schmidt wrote:
> On 01/12/2016 08:55 AM, Thomas Preud'homme wrote:
> > On Monday, January 11, 2016 04:57:18 PM Bernd Schmidt wrote:
> >> On 01/08/2016 10:33 AM, Thomas Preud'homme wrote:
> >>> 2016-01-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> >>> 
> >>>           * g++.dg/pr67989.C: Remove ARM-specific option.
> >>>           * gcc.target/arm/pr67989.C: New file.
> >> 
> >> I checked some other arm tests and they have things like
> >> 
> >> /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } {
> >> "-march=*" } { "-march=armv4t" } } */
> >> /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } {
> >> "-mthumb" } { "" } } */
> >> 
> >> Do you need the same in your testcase?
> > 
> > That was the first approach I took but Kyrill suggested me to use
> > arm_arch_v4t and arm_arch_v4t_ok machinery instead. It should take care
> > about whether the architecture can be selected.
> 
> Hmm, the ones I looked at did use dg-add-options, but not the
> corresponding _ok requirement. So I think this is OK.

Just to make sure: ok as in OK to commit as is?

Best regards,

Thomas
Thomas Preudhomme Jan. 27, 2016, 6:35 a.m. UTC | #5
Ping?

On Monday, January 18, 2016 11:33:47 AM Thomas Preud'homme wrote:
> On Wednesday, January 13, 2016 06:39:20 PM Bernd Schmidt wrote:
> > On 01/12/2016 08:55 AM, Thomas Preud'homme wrote:
> > > On Monday, January 11, 2016 04:57:18 PM Bernd Schmidt wrote:
> > >> On 01/08/2016 10:33 AM, Thomas Preud'homme wrote:
> > >>> 2016-01-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > >>> 
> > >>>           * g++.dg/pr67989.C: Remove ARM-specific option.
> > >>>           * gcc.target/arm/pr67989.C: New file.
> > >> 
> > >> I checked some other arm tests and they have things like
> > >> 
> > >> /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } {
> > >> "-march=*" } { "-march=armv4t" } } */
> > >> /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } {
> > >> "-mthumb" } { "" } } */
> > >> 
> > >> Do you need the same in your testcase?
> > > 
> > > That was the first approach I took but Kyrill suggested me to use
> > > arm_arch_v4t and arm_arch_v4t_ok machinery instead. It should take care
> > > about whether the architecture can be selected.
> > 
> > Hmm, the ones I looked at did use dg-add-options, but not the
> > corresponding _ok requirement. So I think this is OK.
> 
> Just to make sure: ok as in OK to commit as is?
> 
> Best regards,
> 
> Thomas
Mike Stump Jan. 27, 2016, 8:01 p.m. UTC | #6
On Jan 26, 2016, at 10:35 PM, Thomas Preud'homme <thomas.preudhomme@foss.arm.com> wrote:
> On Monday, January 18, 2016 11:33:47 AM Thomas Preud'homme wrote:
>> On Wednesday, January 13, 2016 06:39:20 PM Bernd Schmidt wrote:
>>> On 01/12/2016 08:55 AM, Thomas Preud'homme wrote:
>>>> On Monday, January 11, 2016 04:57:18 PM Bernd Schmidt wrote:
>>>>> On 01/08/2016 10:33 AM, Thomas Preud'homme wrote:
>>>>>> 2016-01-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>
>>>>>> 
>>>>>>          * g++.dg/pr67989.C: Remove ARM-specific option.
>>>>>>          * gcc.target/arm/pr67989.C: New file.
>>>>> 
>>>>> I checked some other arm tests and they have things like
>>>>> 
>>>>> /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } {
>>>>> "-march=*" } { "-march=armv4t" } } */
>>>>> /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } {
>>>>> "-mthumb" } { "" } } */
>>>>> 
>>>>> Do you need the same in your testcase?
>>>> 
>>>> That was the first approach I took but Kyrill suggested me to use
>>>> arm_arch_v4t and arm_arch_v4t_ok machinery instead. It should take care
>>>> about whether the architecture can be selected.
>>> 
>>> Hmm, the ones I looked at did use dg-add-options, but not the
>>> corresponding _ok requirement. So I think this is OK.
>> 
>> Just to make sure: ok as in OK to commit as is?

Ok.
diff mbox

Patch

diff --git a/gcc/testsuite/g++.dg/pr67989.C b/gcc/testsuite/g++.dg/pr67989.C
index 
90261c450b4b9429fb989f7df62f3743017c7363..c3023557d31a21aead717fd58483c82e3e74da95 
100644
--- a/gcc/testsuite/g++.dg/pr67989.C
+++ b/gcc/testsuite/g++.dg/pr67989.C
@@ -1,6 +1,5 @@ 
 /* { dg-do compile } */
 /* { dg-options "-std=c++11 -O2" } */
-/* { dg-additional-options "-marm -march=armv4t" { target arm*-*-* } } */
 
 __extension__ typedef unsigned long long int uint64_t;
 namespace std __attribute__ ((__visibility__ ("default")))
diff --git a/gcc/testsuite/gcc.target/arm/pr67989.C b/gcc/testsuite/
gcc.target/arm/pr67989.C
new file mode 100644
index 
0000000000000000000000000000000000000000..0006924e24f698711e1e501d09b5098049522ad6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr67989.C
@@ -0,0 +1,82 @@ 
+/* { dg-do compile } */
+/* { dg-options "-std=c++11 -O2" } */
+/* { dg-require-effective-target arm_arch_v4t_ok } */
+/* { dg-add-options arm_arch_v4t } */
+/* { dg-additional-options "-marm" } */
+
+/* Duplicate version of the test in g++.dg to be able to run this test only 
if
+   ARMv4t in ARM execution state can be targetted.  Newer architecture don't
+   expose the bug this testcase was written for.  */
+
+
+__extension__ typedef unsigned long long int uint64_t;
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+  typedef enum memory_order
+  {
+    memory_order_seq_cst
+  } memory_order;
+}
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+  template < typename _Tp > struct atomic
+  {
+    static constexpr int _S_min_alignment
+      = (sizeof (_Tp) & (sizeof (_Tp) - 1)) || sizeof (_Tp) > 16
+      ? 0 : sizeof (_Tp);
+    static constexpr int _S_alignment
+      = _S_min_alignment > alignof (_Tp) ? _S_min_alignment : alignof (_Tp);
+      alignas (_S_alignment) _Tp _M_i;
+    operator  _Tp () const noexcept
+    {
+      return load ();
+    }
+    _Tp load (memory_order __m = memory_order_seq_cst) const noexcept
+    {
+      _Tp tmp;
+        __atomic_load (&_M_i, &tmp, __m);
+    }
+  };
+}
+
+namespace lldb_private
+{
+  namespace imp
+  {
+  }
+  class Address;
+}
+namespace lldb
+{
+  typedef uint64_t addr_t;
+  class SBSection
+  {
+  };
+  class SBAddress
+  {
+    void SetAddress (lldb::SBSection section, lldb::addr_t offset);
+      lldb_private::Address & ref ();
+  };
+}
+namespace lldb_private
+{
+  class Address
+  {
+  public:
+    const Address & SetOffset (lldb::addr_t offset)
+    {
+      bool changed = m_offset != offset;
+    }
+    std::atomic < lldb::addr_t > m_offset;
+  };
+}
+
+using namespace lldb;
+using namespace lldb_private;
+void
+SBAddress::SetAddress (lldb::SBSection section, lldb::addr_t offset)
+{
+  Address & addr = ref ();
+  addr.SetOffset (offset);