From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id DD0653834C23 for ; Wed, 14 Dec 2022 08:19:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DD0653834C23 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x62c.google.com with SMTP id w23so2539985ply.12 for ; Wed, 14 Dec 2022 00:19:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=0VNRHl8Gs5GnZCXRB4G6FRb70xW7DsbJZ7mhfRBT2f0=; b=DoKCATMwa2hXp+kPDh7JmJKL8z5kJNoGQzx3QcRoC6d5dZLgmucxbyF9eV8yvsZaWb JEm2z7ziTjAdxGNtC+SFhfZ6iuADaRdHX3ZOcE9eOHV8RXgnP1batbKxQ5PDTMiNQ7eC L5fBIMkjTFS8Qf2ubIQoV2Ny3G/mMQzZWCdi5G7wFDa03z5Qxy9AkCngtVW2c9I0xcE4 CPTEfMSenFbT2nJ5XZNHRDyJY1LJdbY1yIK6TBmxmbySWHAiRB/msFj66z6JekAdFj3L 5PCuSTY54siOaH46pakgkjcgcSlEKR3hfc/cGPjbJh1k39fTa3nFjsCOjijHAtkx7HJU v0og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0VNRHl8Gs5GnZCXRB4G6FRb70xW7DsbJZ7mhfRBT2f0=; b=OybSVsUWV3gV97vaj9+I9JVgaGyKRgsQ4Nup6DXyjqMP1cC2v9Ec9ryligD6eI2H4B rcW/EbzggY+4GL00tvayydPF0vwRoAsZA34jkyT4N4w67SBbCxfKnRCQK4xfIeAzcMrg g5iMilrA0y1a4kA+EQhVCrkOAEbeUQqzL/4aKCd1/HI5rwo3dsHX1JDoDCTPuztRy3QC pF9ulzdtDRawODPmhTqZuk86E7QsvX8g3AXAHo+GfdFIxsgqksf2tZYLzpY75NQjSN/r CaZxtjkMBPrFTOXO8gS1T1S5a6KUpHVVkpZ/O1OE8eYwwnWS9HxjNmF7biphGP6+J4Os 2hDA== X-Gm-Message-State: ANoB5plLLDhHGcVR87Eg9T2uZqmJO4xW0aeNd7nTJwRxV9gkO0LxlGdA M+gjWZl3oamEpNsLjJKgROj0uZEMeIk= X-Google-Smtp-Source: AA0mqf6UjHxUPSjLPOtmC+JNdS6inWDHKqPH74zccnpLIFHnr3HdDQ811VOJvy2mO1pH1NRO+XNc6g== X-Received: by 2002:a05:6a20:6922:b0:9f:3197:bfa1 with SMTP id q34-20020a056a20692200b0009f3197bfa1mr39226931pzj.7.1671005995762; Wed, 14 Dec 2022 00:19:55 -0800 (PST) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:4609:e944:d667:9f00]) by smtp.gmail.com with ESMTPSA id k1-20020aa79721000000b00574f83c5d51sm8854784pfg.198.2022.12.14.00.19.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Dec 2022 00:19:55 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id EC79E1142CF2; Wed, 14 Dec 2022 18:49:52 +1030 (ACDT) Date: Wed, 14 Dec 2022 18:49:52 +1030 From: Alan Modra To: Jan Beulich Cc: binutils@sourceware.org Subject: Re: x86: generate template sets data at build time Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3027.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: On Wed, Dec 14, 2022 at 08:40:37AM +0100, Jan Beulich wrote: > On 14.12.2022 06:14, Alan Modra wrote: > >> + /* Type checks to compensate for the conversion through void * which > >> + occurs during hash table insertion / lookup. */ > >> + (void)(sets == ¤t_templates->start); > >> + (void)(end == ¤t_templates->end); > > > > This results in asan complaining about "member access within null > > pointer of type 'const templates'". > > Interesting. How can it know that current_templates is still NULL? It is instrumented and hits the error at runtime. > (I guess one can't expect it to realize that with the cast to void > this doesn't really stand a chance of exhibiting UB; technically > the compiler _may_ generate code for this nevertheless, and that > code _may_ do anything due to it being UB.) It's also not clear to > me what to do to work around the issue: Assign to current_templates > instead, followed by assigning back NULL after the checks? (This > would feel like clutter to me.) Are there other "standard" ways of > working around such border line asan complaints? Yes, check for NULL before doing the operation. In this case I'm inclined to just delete the type checking. -- Alan Modra Australia Development Lab, IBM