Message ID | or4jc2f0xe.fsf@lxoliva.fsfla.org |
---|---|
State | New |
Headers | show |
Series | [c++,testsuite] adjust contracts9.C for negative addresses | expand |
On Apr 15, 2024, at 8:20 PM, Alexandre Oliva <oliva@adacore.com> wrote: > > The test expected the address of a literal string, converted to long > long, to yield a positive value. That expectation doesn't necessarily > hold, and the test fails where it doesn't. > > Adjust the test to use a pointer that will compare as expected. > > Regstrapped on x86_64-linux-gnu. Also tested with gcc-13 on arm-, > aarch64-, x86- and x86_64-vxworks7r2. Ok to install? Ok.
diff --git a/gcc/testsuite/g++.dg/contracts/contracts9.C b/gcc/testsuite/g++.dg/contracts/contracts9.C index 09a1a6532c5a0..58b60aca32057 100644 --- a/gcc/testsuite/g++.dg/contracts/contracts9.C +++ b/gcc/testsuite/g++.dg/contracts/contracts9.C @@ -27,7 +27,7 @@ int main() { fun1(1, -1); fun1(-1, 1.0); - fun1(-1, "test"); + fun1(-1, (const char *)0x1234); [[ assert: fun1(-1, -5) ]]; [[ assert: test<int>::fun(10, -6) ]];