From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667300252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0Vk7NoJz7xW6wZH8vkFExAByhx4bw1vUd5x9lO7j4uo=; b=cFC10DQP4hzmGQLypA4DiclU9kkYqFqD7e1VyHCeqYcVW+io4OfKj2ZW6PGckYM/ymI4hA sJFc/X1YpCdtmUjZrt/Oa/cjo0N1vtmI6pGls+g3yN0dFxHqJEKRpE7/D/RM1q5MKbfwBQ oVHdfE5+8B0q7DDOlCGUVVI6rKKirpU= 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-Google-Smtp-Source: AMsMyM6khqt6SAyaAyYpbgXQqoVEWqMqUr7vuPPGYWUWKSVU2HnYQ1kjLuwhwnAXR8vDaEGVI5QRnQ== 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) From: Andrew Burgess To: binutils@sourceware.org Cc: Andrew Burgess 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 List-Id: 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) { -- 2.25.4