public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-10026] [c++] [testsuite] adjust contracts9.C for negative addresses
Date: Thu, 18 Apr 2024 11:15:37 +0000 (GMT)	[thread overview]
Message-ID: <20240418111537.D31E33858C35@sourceware.org> (raw)

https://gcc.gnu.org/g:ce2dfc57b4562fef0d279697d96f672bc903e853

commit r14-10026-gce2dfc57b4562fef0d279697d96f672bc903e853
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Thu Apr 18 08:01:35 2024 -0300

    [c++] [testsuite] adjust contracts9.C for negative addresses
    
    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.

Diff:
---
 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 09a1a6532c5..58b60aca320 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) ]];

                 reply	other threads:[~2024-04-18 11:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240418111537.D31E33858C35@sourceware.org \
    --to=aoliva@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).