From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125038 invoked by alias); 18 May 2017 18:55:06 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 122613 invoked by uid 89); 18 May 2017 18:55:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=hist, Warns X-HELO: mail-it0-f41.google.com Received: from mail-it0-f41.google.com (HELO mail-it0-f41.google.com) (209.85.214.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 18 May 2017 18:55:01 +0000 Received: by mail-it0-f41.google.com with SMTP id o5so105954210ith.1 for ; Thu, 18 May 2017 11:55:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=8BwfhY6wFAocZVIp/rsJqllM74KyoAGs/TEYHSciXGQ=; b=Ggha6KqKjXxWGtLiyw3E+ukx5yNRz8QU25yZ+cUCoE4FOc2+c3d0Xci68DtNsjQvaC RHVyH1SKbUQ9A6hkUFd5iW+qLg7yRWZh/tKo2gMPUC7Ed3SP3IOWTBniO0Cl73PdaZma 8fGUQFFwcbciXyJlDhlM+vzjEojxvJd/YMivErRESl3Eve8l83nYxoM4aDCMGjeT4Dmo FfC7u2Rs/d7V9e3KT5KeLgdThhAnrlXhbV3fhuyB2oDhDNBzH1HcovfAPddV0PTdH2fr 8sLLqtvCaCloKWzdczEkgLYWipAKFAivt89BhEJDDUxWLDdpCDKQA4mdCA5tT+c5IfTt R/5g== X-Gm-Message-State: AODbwcDxWRLbuPeMsKpy7VXatpersMgsbnwz4bb8d57yc/8akim3dxcM j8XnQJfxw1JWob5LVy9NdbO3DuemDor/sXPQDA== X-Received: by 10.36.79.6 with SMTP id c6mr6491365itb.45.1495133702577; Thu, 18 May 2017 11:55:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.25.5 with HTTP; Thu, 18 May 2017 11:55:02 -0700 (PDT) From: Prathamesh Kulkarni Date: Thu, 18 May 2017 18:56:00 -0000 Message-ID: Subject: PR80806 To: gcc Patches , Richard Biener Content-Type: multipart/mixed; boundary="001a11447e0a3cc318054fd0f1fa" X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg01494.txt.bz2 --001a11447e0a3cc318054fd0f1fa Content-Type: text/plain; charset="UTF-8" Content-length: 1809 Hi, The attached patch tries to fix PR80806 by warning when a variable is set using memset (and friends) but not used. I chose to warn in dse pass since dse would detect if the variable passed as 1st argument is a dead store. Does this approach look OK ? There were following fallouts observed during bootstrap build: * double-int.c (div_and_round_double): Warning emitted 'den' set but not used for following call to memset: memset (den, 0, sizeof den); I assume the warning is correct since there's immediately call to: encode (den, lden, hden); and encode overwrites all the contents of den. Should the above call to memset be removed from the source ? * tree-streamer.c (streamer_check_handled_ts_structures) The function defines a local array bool handled_p[LAST_TS_ENUM]; and the warning is emitted for: memset (&handled_p, 0, sizeof (handled_p)); That's because the function then initializes each element of the array handled_p to true making the memset call redundant. I am not sure if warning for the above case is a good idea ? The call to memset() seems deliberate, to initialize all elements to 0, and later assert checks if all the elements were explicitly set to true. * value-prof.c (free_hist): Warns for the call to memset: static int free_hist (void **slot, void *data ATTRIBUTE_UNUSED) { histogram_value hist = *(histogram_value *) slot; free (hist->hvalue.counters); if (flag_checking) memset (hist, 0xab, sizeof (*hist)); free (hist); return 1; } Assuming flag_checking was true, the call to memset would be dead anyway since it would be immediately freed ? Um, I don't understand the purpose of memset in the above function. * testsuite fallout I verified regressing test-cases were not false positives and added -Wno-unused-but-set-variable. Thanks, Prathamesh --001a11447e0a3cc318054fd0f1fa Content-Type: text/plain; charset="US-ASCII"; name="pr80806-5.diff" Content-Disposition: attachment; filename="pr80806-5.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_j2urwgbs0 Content-length: 6410 ZGlmZiAtLWdpdCBhL2djYy90ZXN0c3VpdGUvYy1jKystY29tbW9uL1dzaXpl b2YtcG9pbnRlci1tZW1hY2Nlc3MyLmMgYi9nY2MvdGVzdHN1aXRlL2MtYysr LWNvbW1vbi9Xc2l6ZW9mLXBvaW50ZXItbWVtYWNjZXNzMi5jCmluZGV4IDg5 NWE1MGUyNjc3Li42Y2JjYzQxOTk3NiAxMDA2NDQKLS0tIGEvZ2NjL3Rlc3Rz dWl0ZS9jLWMrKy1jb21tb24vV3NpemVvZi1wb2ludGVyLW1lbWFjY2VzczIu YworKysgYi9nY2MvdGVzdHN1aXRlL2MtYysrLWNvbW1vbi9Xc2l6ZW9mLXBv aW50ZXItbWVtYWNjZXNzMi5jCkBAIC0xLDcgKzEsNyBAQAogLyogVGVzdCAt V3NpemVvZi1wb2ludGVyLW1lbWFjY2VzcyB3YXJuaW5ncy4gICovCiAvKiB7 IGRnLWRvIGNvbXBpbGUgfSAqLwotLyogeyBkZy1vcHRpb25zICItV2FsbCAt TzIgLVduby1zaXplb2YtYXJyYXktYXJndW1lbnQgLWZ0cmFjay1tYWNyby1l eHBhbnNpb249MCIgfSAqLwotLyogeyBkZy1vcHRpb25zICItV2FsbCAtTzIg LVduby1zaXplb2YtYXJyYXktYXJndW1lbnQgLVduby1jKystY29tcGF0IC1m dHJhY2stbWFjcm8tZXhwYW5zaW9uPTAiIHt0YXJnZXQgY30gfSAqLworLyog eyBkZy1vcHRpb25zICItV2FsbCAtTzIgLVduby1zaXplb2YtYXJyYXktYXJn dW1lbnQgLVduby11bnVzZWQtYnV0LXNldC12YXJpYWJsZSAtZnRyYWNrLW1h Y3JvLWV4cGFuc2lvbj0wIiB9ICovCisvKiB7IGRnLW9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