From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by sourceware.org (Postfix) with ESMTPS id 3F64C3858D37 for ; Thu, 27 Apr 2023 19:35:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3F64C3858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-32b437f4607so23364025ab.1 for ; Thu, 27 Apr 2023 12:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1682624126; x=1685216126; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9XXShzMcRfYihkesaHQeOVaXmNYlOwuvJip4K50xonc=; b=XDeBI7LxX3DyZ9U0idsTy1CdumUH7n3BiSpepG239JkUfhNZh9mJlbIw4GLnR5CCB4 a4e8Nc4WT7yE7R3FC9XyfBIbOlWwhbN49IfG49kyiiSI+ktnDfIAnpvYe2d3kew61OcM 9PTPGnUaWVBcfva4e4TkKqSntX14xP0Cg4DxUKkKYaCYyC1GaZD1CJfGR57C7auey6QE BT8UkFkiw4MRP1rfp0zmx+UV45TPMSkaMqEV9V3wJTQqy3gM7peeVCQpj24Kw7B5hgZV YO+giPLzlVRvWgJW7Kn+sO1yxKd1z+wwqF1j+KUpt20CiAvpU9ePCp5aO0YGxJdamqls dmmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682624126; x=1685216126; 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=9XXShzMcRfYihkesaHQeOVaXmNYlOwuvJip4K50xonc=; b=T2VsbdF+ey2sWczhYdwl26Q3dTxKHMSOf3bji+I13WwVOgPyxV/fdhpSqHggbKHiRJ KCXO+EZaBbebZrwpKy1j5jsdVT0CKMheetXyn3BnNHcB2/WnaN49Ja0E6Oq/EMOhwx3d PrtiFTVsLEjjgrmmek5vD+qZiz6ADA4B+qmKitf40+N16Idw23ofmE98aahulG88/Vob MKWn6OG6JF2QUi091ThNqW9npqJzbEMGmJYEEAhF6TnYxRzS4ykx0wVRSGuvPAPBvThC She2M7qwk/Wc8vXlRGGCuoFU7zhkRrvE36cvFIQ14qAFxkx6xYk1CkhOwQI6VBer8Ay5 m1oQ== X-Gm-Message-State: AC+VfDxWQg3GdNiheySXSBUlcG1YtRlScv5rZrfkp8Z1ToQECwEkmyAl 5cToi/MMPvaiRZIAipo5duB4GscpRMKV9+hWueqd7A== X-Google-Smtp-Source: ACHHUZ6/puHNgWl2fM2/u/f0suklOD/SSRV5mcGAEIcd7rmsXpXZ8tLb1nj/9EASj577ohfxT6WbeQ== X-Received: by 2002:a05:6e02:5cd:b0:325:b96e:6701 with SMTP id l13-20020a056e0205cd00b00325b96e6701mr2229807ils.2.1682624126426; Thu, 27 Apr 2023 12:35:26 -0700 (PDT) Received: from localhost.localdomain (71-211-191-82.hlrn.qwest.net. [71.211.191.82]) by smtp.gmail.com with ESMTPSA id v5-20020a927a05000000b003261b6acc8asm5009338ilc.79.2023.04.27.12.35.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 12:35:25 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Do not change type in get_discrete_low_bound Date: Thu, 27 Apr 2023 13:35:15 -0600 Message-Id: <20230427193515.1060101-1-tromey@adacore.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.4 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,T_SCC_BODY_TEXT_LINE 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: get_discrete_low_bound has this code: /* Set unsigned indicator if warranted. */ if (low >= 0) type->set_is_unsigned (true); It's bad to modify a type in a getter like this, so this patch removes this code. FWIW I looked and this code has been there since at least 1999 (it was in the initial sourceware import). Types in general would benefit from const-ification, which would probably reveal more code like this, but I haven't attempted that. Regression tested on x86-64 Fedora 36. --- gdb/gdbtypes.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 6af59351b76..c8d5314bce7 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1084,10 +1084,6 @@ get_discrete_low_bound (struct type *type) low = type->field (i).loc_enumval (); } - /* Set unsigned indicator if warranted. */ - if (low >= 0) - type->set_is_unsigned (true); - return low; } else -- 2.39.1