From patchwork Tue Nov 1 10:57:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 13621 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2881853wru; Tue, 1 Nov 2022 03:57:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qreDBrW/nhdrCx6M60TOnEFS3k4EhdczWvZJyoZ9SkJt5HHTrKAK/LB2mFT+p1k4f96te X-Received: by 2002:a05:6402:1e88:b0:461:a513:f543 with SMTP id f8-20020a0564021e8800b00461a513f543mr18803278edf.183.1667300265787; Tue, 01 Nov 2022 03:57:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667300265; cv=none; d=google.com; s=arc-20160816; b=VRVyKn/j7l1pmUkAIgzo6RhaUpWfY8FmeooXwgNTXj/NwARvug/OjhXW+fSHtshwEC cnB9YyaH+navhAiPU1jyM5mk3E8aSqe4Fm/8m34zEuvHzdIqrJ3j+zO1jp59sQHgynnT ZZJCgtkxTJH9GOqo8Ue1rxeY+eB3UdxKarjMjFhk5Ok3hKRsLI0snyQljxCPC9mF3MXQ Vq9lGnGxmGeyo5lpnFjZpRLHuBVJ0RiEvzTGqpaxH7Qcrpum33geoR11sS776noQ3ivp fdyskCiWrkBAs2TYsK+M30anlb7egeE23Yc3aTdoyVpZKsPazNRlajXI+Di+BnL8WAts RMyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=0Vk7NoJz7xW6wZH8vkFExAByhx4bw1vUd5x9lO7j4uo=; b=coidwFeCv5W9ee7Y6KVZMVdCmghV4ENeUv5Nkv9FpvvWEpEfLF3aHvXyXtF+l9/wsj Fzkfj+dh56uq3yQ4qi3/f1pRpELstrZc5CD8+LMKftLnoKICkD4VuIsdX2lYggOiP6ck weJ3nDcD7FHP1bU2msTMi3+oafrOBTWSY2Ha3sS6Uc22nywV/+mAW/yZL1Pp1cK1yeN4 E7eUyGjsWjyUsYZf4tkXgCwZNHeLk2d4IrDFB3H+jUL7YSl5BfU6oySz90DowFPpC6tW F/4apZKXepm+hS61Bm6Mbpm0dUjv2GGiAb2JEZybIuw5GqhI+D6RKmPcK+nZQ4ogB/Jv EBxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="n/lTM5Ue"; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id o11-20020a170906974b00b00782933fe436si12661977ejy.965.2022.11.01.03.57.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 03:57:45 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="n/lTM5Ue"; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EAD27385735A for ; Tue, 1 Nov 2022 10:57:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EAD27385735A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667300264; bh=0Vk7NoJz7xW6wZH8vkFExAByhx4bw1vUd5x9lO7j4uo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=n/lTM5UeV91IxlI0yL9K/V0cCzQoVOisCTa1C3ZM70vfqKFreTJHNI2g6w/otEqZx v1AbLPCBy3/nORwkzhWJLXj5f3E7yN9uKy24zDQ7zo/AtSbMwqBKK00mqjqc26cfxz RZXKxdroq/pN+OcxOd4JGQOIeKkhtUJ0HB4b91PQ= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 163063858401 for ; Tue, 1 Nov 2022 10:57:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 163063858401 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-624-GcyMnnM3PZi9hj1IeC5oFw-1; Tue, 01 Nov 2022 06:57:31 -0400 X-MC-Unique: GcyMnnM3PZi9hj1IeC5oFw-1 Received: by mail-qk1-f200.google.com with SMTP id i11-20020a05620a404b00b006eeb0791c1aso11838388qko.10 for ; Tue, 01 Nov 2022 03:57:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0Vk7NoJz7xW6wZH8vkFExAByhx4bw1vUd5x9lO7j4uo=; b=v0vgnbgGE4lTc5z23dZFF3qMzrjcY/A2L8oxfdW9bWrV9Lu0aLdMi6IJastjioDFRQ IwV8OFjvSRJp6+PMMfbYfENW4aI5kuPjjIi8BwOBTQlT08zIiQWHmad3XfDrGTZrfwlY N47O8BzVQb5YH+HA0hGfPnCnJmT7v9KphixIIwyj6aa+o9ivrC/brEWTMkHu8ONHHD3U /PW6Wf7aN2OORsE/56VrriiIMkdoNCR1Yfzx8LPL8HEeAz3uXxBn+tsNnegFjyPe6o2y kQEVReo7HKbrYAtW7pjwMxYXis8NCrkg601PdyGldXcnuw2w21I6jy/BEbCp/+hj6tjv 1M3g== X-Gm-Message-State: ACrzQf3d5PaWpUIntoYFuxgyNLZkycVqjXz/E9uKhhEhKU1hULkeY+1z t/hvlwm9bYD6SMDZKzw+cjhTXR4F1vMMx9utDaRuAIHRBOwGr0uwMYqq18s4bgGhIi1Wt1KAfCQ HaQVIzxLbNonnClIkLgLk/sn0uie934B7LJf8xNDT6xFP+Mmb9UjAolw/6UsPoVMyEaI10Q== X-Received: by 2002:a05:620a:74e:b0:6fa:1dc8:3a1f with SMTP id i14-20020a05620a074e00b006fa1dc83a1fmr9919596qki.502.1667300251277; Tue, 01 Nov 2022 03:57:31 -0700 (PDT) X-Received: by 2002:a05:620a:74e:b0:6fa:1dc8:3a1f with SMTP id i14-20020a05620a074e00b006fa1dc83a1fmr9919588qki.502.1667300251010; Tue, 01 Nov 2022 03:57:31 -0700 (PDT) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id 123-20020a370381000000b006e702033b15sm6383178qkd.66.2022.11.01.03.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 03:57:30 -0700 (PDT) To: binutils@sourceware.org Subject: [PUSHED] opcodes/arm: silence compiler warning about uninitialized variable use Date: Tue, 1 Nov 2022 10:57:24 +0000 Message-Id: <20221101105724.1527333-1-aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew Burgess via Binutils From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748291043637668081?= X-GMAIL-MSGID: =?utf-8?q?1748291043637668081?= After I pushed this series: https://sourceware.org/pipermail/binutils/2022-October/123250.html I managed to break .... pretty much all the buildbot builds :/ I've gone ahead and pushed the patch below as an emergency fix which should resolve all the build problems. If anyone disagrees with the fix here, please just let me know and I can put together something inline with any feedback. Sorry for the breakage. Andrew --- The earlier commit: commit 6576bffe6cbbb53c5756b2fccd2593ba69b74cdf Date: Thu Jul 7 13:43:45 2022 +0100 opcodes/arm: add disassembler styling for arm was causing a compiler warning about a possible uninitialized variable usage within opcodes/arm-dis.c. The problem is in print_mve_unpredictable, and relates to the reason variable, which is set by a switch table. Currently the switch table does cover every valid value, though there is no default case. The variable switched on is passed in as an argument to the print_mve_unpredictable function. Looking at how print_mve_unpredictable is used, there is only one use, the second argument is the one that is used for the switch table, looking at how this argument is set, I don't believe it is possible for this argument to take an invalid value. So, I think the compiler warning is a false positive. As such, my proposed solution is to initialize the reason variable to the string "??", this will silence the warning, and the "??" string should never end up being printed. --- opcodes/arm-dis.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c index 6d302ec50ba..101b3f84dfe 100644 --- a/opcodes/arm-dis.c +++ b/opcodes/arm-dis.c @@ -7234,7 +7234,9 @@ print_mve_unpredictable (struct disassemble_info *info, { void *stream = info->stream; fprintf_styled_ftype func = info->fprintf_styled_func; - const char *reason; + /* Initialize REASON to avoid compiler warning about uninitialized + usage, though such usage should be impossible. */ + const char *reason = "??"; switch (unpredict_code) {