]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[c++] [testsuite] adjust contracts9.C for negative addresses
authorAlexandre Oliva <oliva@adacore.com>
Thu, 18 Apr 2024 11:01:35 +0000 (08:01 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Thu, 18 Apr 2024 11:11:51 +0000 (08:11 -0300)
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.

for  gcc/testsuite/ChangeLog

* g++.dg/contracts/contracts9.C: Don't assume string literals
have non-negative addresses.

gcc/testsuite/g++.dg/contracts/contracts9.C

index 09a1a6532c5a090fd185f074c7d9cce929ceea0f..58b60aca32057ef36a84a671a3ee332f37b7be9e 100644 (file)
@@ -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) ]];