From patchwork Tue Apr 16 03:20:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 88518 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0141B3858426 for ; Tue, 16 Apr 2024 03:21:29 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 1C8E23858D32 for ; Tue, 16 Apr 2024 03:20:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1C8E23858D32 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1C8E23858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713237660; cv=none; b=q31Vdtj+1jC2fL+rfXjnIJJBIAl9E/3SE+uJTy5R+kdlskLwmK8W0e2HvltoiTXQ2tnhDfkI/Qr3JIZ6a8WMGTquUEL/oKEf2GhrTMm/M6RiKcja+N1wXicOa2IFSAXAJktgeNIGHBiwE1y7EpiFGqeAczXcSCVuNOdSObtEIio= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713237660; c=relaxed/simple; bh=gBOUiBmvO07Nq8NKAMKZyttX40yRj591kXIKBYW67nY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=OAchxA7HDmy7kWuigM+R1uhHR31wRwHCx/aGh2ZLXyVfqC4yzSNvIa8Dwm/W0LhGvLJNRn0ktz2doJcbzHeNttz2JYPPoQKInz8WVB2M12tsQX/M4o8j5J8ypzCyHeKAlzo0FI/+jgHZiVpDo+xSSVcviEv6SZc7Jrpg5w2IqSA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6ecff9df447so4001366b3a.1 for ; Mon, 15 Apr 2024 20:20:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1713237656; x=1713842456; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:date:organization:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=i294vz66SsKyF1pwTp+8uNb1gc3UIFgOnGaa6fHGQis=; b=WM0GRetshJg1RHP4oC3Lp8ZUjArq7aRhvXb3I445SSngwjCtz/IXCYqjgM4fIhJMio XqyBDjOsOa6Qxexxo4mZm5kWhj8913VoXRYJkRR7bQy4HPhBqVWp8sKG7i9QH/qxxiEv 1WpxuPlq0oXpEnBmVCP8uDN1eJH0QlnQIlABspY2LxlZcTuoDz7gCP5/9XuqsAyPQVeA IZUXoyDhHSj7HuDBKrRL5HqiXuHVe7YnR5D8Qzo1TzZ6hWThaN2ZMsHZldJM7F0ZC6qN mix+XT36zYZORakRU7FkEbdxAgsmVA2WZB0OSkij9OuC2Gpg23CF0lalu0dowCCT1XZM syFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713237656; x=1713842456; h=mime-version:user-agent:message-id:date:organization:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=i294vz66SsKyF1pwTp+8uNb1gc3UIFgOnGaa6fHGQis=; b=sN4/fmt66X5vQNS8J1T9Zhc7B6ijwl2yD7R+KDYftczPTqNo3t7buxPWHnrnknSR3t p7PXQpd7D1b9ehC9NjAJqUe+0pPug9GaOhgJJsTKVbjrTmmLgoq0Wiz9GPNw/zWXDLYn 07M+bfjV49pmPsUn1OH2BgZp7VFaaDHgHq+ScJX3Q6+Za2RiE5RwLchbObAOgH6ewNEG y99CWhH3SwOiKbfgriw9m45toVYmUrWKOkAieitP/tdb2eLRgR2SuEISHBa8q0GFuKiL YT2YbRJaPXCzf2KP5XCNWEYBb3G/wA1rfbYD/D4H5ExDo8E389/wIIr/kQ8gQs/whPFG HZSw== X-Gm-Message-State: AOJu0YywQo5Ly7+uKSbf6+w37tKF2W+wkEqkrPylZLl5KsBUKRILX+NX eETsTXxEQulLjnN4vU+c3C++DiRMmJ05ACsn0HeNFJZlG5f3ZaVoQfMZTndIHJxBGQuhIugB4AO kJA== X-Google-Smtp-Source: AGHT+IFLVzFcRCZnFPRRmz9PmBeEMZB9w5req/xxIfiJn6MWDYgHPIcn9MBZSj8AyTWUPo9M+3vwTw== X-Received: by 2002:a05:6a00:2d20:b0:6ed:4a97:5dec with SMTP id fa32-20020a056a002d2000b006ed4a975decmr16089907pfb.20.1713237655927; Mon, 15 Apr 2024 20:20:55 -0700 (PDT) Received: from free.home ([2804:7f1:218b:5e2:c43b:e0c4:71a:241b]) by smtp.gmail.com with ESMTPSA id gx21-20020a056a001e1500b006e72c8ece23sm7960180pfb.191.2024.04.15.20.20.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 20:20:55 -0700 (PDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 43G3KjY32387169 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 16 Apr 2024 00:20:45 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Cc: Rainer Orth , Mike Stump , Jason Merrill , Nathan Sidwell Subject: [PATCH] [c++] [testsuite] adjust contracts9.C for negative addresses Organization: Free thinker, does not speak for AdaCore Date: Tue, 16 Apr 2024 00:20:45 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, WEIRD_QUOTING autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org 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::fun(10, -6) ]];