From patchwork Tue Sep 15 21:33:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 8717 Received: (qmail 104677 invoked by alias); 15 Sep 2015 21:34:01 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 104646 invoked by uid 89); 15 Sep 2015 21:34:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-pa0-f74.google.com Received: from mail-pa0-f74.google.com (HELO mail-pa0-f74.google.com) (209.85.220.74) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 15 Sep 2015 21:33:59 +0000 Received: by pacii12 with SMTP id ii12so14793079pac.1 for ; Tue, 15 Sep 2015 14:33:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:message-id:date:subject:from:to :content-type; bh=Orlgdf/03uH1J9jlx+c4VEpE6BmZIMPK0d3OM2Tg88w=; b=YKWv5dYUuDWBsGMAV5NziaIMpXnVc1gPtt/B1iFygxkjj8yDrHq63yoi/qTnRL1Tsd fzGuYoVQ1IIf+mfkIU0I9uOrVoILGnusLl2ZvL5y/v/QMG/BEsMO51leSbwQo1kF9ewS kkjrtAvdh5+6eBrQukiml6+DqEkoQH5mX3wSuSkl9YeB+lGmqcHbi3CRFzsf6M5Q6z/E Y9hEt+bvslCm9ZzCCGWFCYQhH5ium1nPPHEwCc3JQ2jYsmU3jcyTq1Qw4RA9Xk0xFVDi bBt2lJbMFhtJ/jt/2Qmw/rS4Ui4pK/crobPOBABIScBV+iFv/zcPB9ZA/gsUmVq+ifug GFxQ== X-Gm-Message-State: ALoCoQlI2VFfUSlb+Ysx1mQIKC/JCALVVeYug32wsz8NAVk7pacELTXYncP3E0dRFyGxN9UE5Ehsp7zFwDTWNQF40Kg7GKECcyWpyoGHm3cJb8+p/CjcaNgjF+8JNtKdgCXNIpmS+AHMPkh8iRn0HLg2+Sozw/cQ24+0lZ6eqVeKL0ZN367jyeA= MIME-Version: 1.0 X-Received: by 10.66.199.67 with SMTP id ji3mr20673124pac.17.1442352838057; Tue, 15 Sep 2015 14:33:58 -0700 (PDT) Message-ID: <001a1136b7ac8deb34051fcff0ec@google.com> Date: Tue, 15 Sep 2015 21:33:58 +0000 Subject: [PATCH] gcore.c (array_func): Add reference to static_array. From: Doug Evans To: gdb-patches@sourceware.org X-IsSubscribed: yes Hi. This test fails with clang because it discards static_array, it's unreferenced anywhere. Is there a preferred way to handle this? The current way is chosen for portability (instead of, say, an attribute). 2015-09-15 Doug Evans * gdb.base/gcore.c (array_func): Add reference to static_array. diff --git a/gdb/testsuite/gdb.base/gcore.c b/gdb/testsuite/gdb.base/gcore.c index d6acc1f..b6d8d54 100644 --- a/gdb/testsuite/gdb.base/gcore.c +++ b/gdb/testsuite/gdb.base/gcore.c @@ -46,6 +46,8 @@ array_func () un_initialized_array[i] = extern_array[i] + 8; local_array[i] = extern_array[i] + 12; } + /* Reference static_array so that clang doesn't discard it. */ + (void) static_array[0]; terminal_func (); }