From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id AAAC0385703C for ; Wed, 28 Apr 2021 20:11:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AAAC0385703C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=joseph_myers@mentor.com IronPort-SDR: 2TJpRsaVCXqe+Rw7vIKOjTOT2ncwySUVC+4X4O7b6fO8h7zEqlTpnc78mPS1hHnH9vaAcRs0li uDN8b7XpfjIIPd0rVOz0nsJxXzcazAWMs2RQN9LlqvudL4lg2KE834vUm1S7NxuHo9rsVeHBck gSNUvYOsK+zZgAkZ/EKgOLENu9d3sdbTUSLIATFZMct0PQVonQXiMetnXWxQ0A/mjVeILEx7Mv pwknBbngswkIO2XdJya6+9+Ns+px0xxocomAFQ79yTJ0LEkK5SW31cNQvviey6V4Z3Kr7ACsHc sl4= X-IronPort-AV: E=Sophos;i="5.82,258,1613462400"; d="scan'208";a="63015648" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 28 Apr 2021 12:11:07 -0800 IronPort-SDR: 6it7L9Ovm2fMZPDQhghlwO70gw3nG+cce+bTUhwTobNE61K9+UpLaeU6lMQ8oJNKg1aJwT7nKe WAgyyKV8mHXQtD/t4psXOoDwRdHLHEEtumcpFSeHCobLI8YmC4P7YF5mhpZUWaHtyoDNjQgFce icMy3Cyi8Oqnb7Q7kl1rsKsCiVO3bx6MflZq14l4A9VND+rxn70i4H5k9BldZKrAmEX36EPZqk UkhJSH2clHD1eJYGZpOEwRSSYxWems5wwqOw7/A+VZiz8Im9b069+EGAbMOSRXhxm3TRymGF7k VRw= Date: Wed, 28 Apr 2021 20:11:02 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: gengqi-linux CC: gcc-patches Subject: Re: About implementation of the Negative property of options. In-Reply-To: Message-ID: References: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3121.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Apr 2021 20:11:10 -0000 On Wed, 28 Apr 2021, gengqi-linux via Gcc-patches wrote: > I have been fixing a bug. It involved the Negative property of options, > and I have some confusion about it. Could you please explain the bug at the *user-visible* level? That is, the particular options passed to the compiler, how those options behave, and how you think they should behave instead. Once we know the *user-visible* issue under discussion, we can consider what the compiler's internal datastructures should look like to achieve the desired behavior (if indeed it is desired). Once we've worked out what the internal datastructures should look like, we can consider how the opt*.awk machinery should generate those datastructures from the .opt files. > Above is the code that handles the ‘Nagetive’ property. I don't see why > the 'idx' should be set -1 when 'RejectNegative'. Presumably because the handling of -1 somewhere in the compiler is considered appropriate for RejectNegative options. If you don't think it is, again, can you give an example at the user-visible level of a RejectNegative option for which that value of -1 results in inappropriate user-visible behavior? Then we can consider several possibilities for where the bug is: * Maybe the handling of -1 is incorrect (but the setting of -1 is correct). * Maybe the handling of -1 is correct (but the setting of -1 is incorrect). * Maybe the option shouldn't be RejectNegative at all, but the existing handling is appropriate for some other RejectNegative options. * Maybe in fact the option is being handled correctly, and changing the handling of -1 would result in it being handled incorrectly. * Maybe in fact the option is being handled correctly, but some of the relevant option-handling code is still conceptually confused and could be simplified without changing anything user-visible. -- Joseph S. Myers joseph@codesourcery.com