* [PATCH] [c++] [testsuite] adjust contracts9.C for negative addresses
@ 2024-04-16 3:20 Alexandre Oliva
2024-04-16 22:25 ` Mike Stump
0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Oliva @ 2024-04-16 3:20 UTC (permalink / raw)
To: gcc-patches; +Cc: Rainer Orth, Mike Stump, Jason Merrill, Nathan Sidwell
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?
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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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) ]];
--
Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/
Free Software Activist GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] [c++] [testsuite] adjust contracts9.C for negative addresses
2024-04-16 3:20 [PATCH] [c++] [testsuite] adjust contracts9.C for negative addresses Alexandre Oliva
@ 2024-04-16 22:25 ` Mike Stump
0 siblings, 0 replies; 2+ messages in thread
From: Mike Stump @ 2024-04-16 22:25 UTC (permalink / raw)
To: Alexandre Oliva; +Cc: gcc-patches, Rainer Orth, Jason Merrill, Nathan Sidwell
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-16 22:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-16 3:20 [PATCH] [c++] [testsuite] adjust contracts9.C for negative addresses Alexandre Oliva
2024-04-16 22:25 ` Mike Stump
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).