From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 914123858C60 for ; Thu, 9 Feb 2023 10:35:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 914123858C60 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 907A13422F; Thu, 9 Feb 2023 10:35:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1675938912; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WLJmnGJD0rG6niPMzyF1ezllL6OEicouZxpkIcQHCJg=; b=mYX9uTmSRU6YcGT6aZujUkYnlNw9OPoghBNLsZCvQyFxyF2o0dnyFAhm/n3ZCo6GqunERJ NRqRv7EC102u1M/+YN91g74dJnN9frFfenmEBUEfQ8/aKiH/o6Zn24dRF6fR1ni22CYdo8 Rv2aWjSNUEaoM2gz468VsLE6pLEIfgw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1675938912; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WLJmnGJD0rG6niPMzyF1ezllL6OEicouZxpkIcQHCJg=; b=tc8/3kbhNXViL1CKRQZMMYqg3JUDiIF0YROyq/qSf9dRGpvWqI8aYzS9IAVRmoE/Z3HY2s PwL5Lh4CwUJKiZCQ== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 41B982C141; Thu, 9 Feb 2023 10:35:12 +0000 (UTC) Date: Thu, 9 Feb 2023 10:35:12 +0000 (UTC) From: Richard Biener To: Qing Zhao cc: Joseph Myers , "gcc-patches@gcc.gnu.org" , "siddhesh@gotplt.org" , "keescook@chromium.org" , sandra@codesourcery.com Subject: Re: [PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832] In-Reply-To: <2AB95191-B5D9-41AC-916A-C57ED20DF55E@oracle.com> Message-ID: References: <20230131141140.3610133-1-qing.zhao@oracle.com> <20230131141140.3610133-2-qing.zhao@oracle.com> <812910BC-870E-4432-870D-538024F1A510@oracle.com> <3B30CFBF-5004-41A4-940D-1F23C010403B@oracle.com> <4E515AA5-2069-497E-A301-EC8ED744E780@oracle.com> <367EBE15-1675-4D29-A9C2-A4A57FA4DB62@oracle.com> <2184ee29-9a36-e85-11c5-81c47aa22055@codesourcery.com> <91678405-D50E-405A-98FB-F3BA6888577E@oracle.com> <2AB95191-B5D9-41AC-916A-C57ED20DF55E@oracle.com> User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="-1609957120-844045914-1675938912=:9226" X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1609957120-844045914-1675938912=:9226 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Wed, 8 Feb 2023, Qing Zhao wrote: > > > > On Feb 7, 2023, at 6:37 PM, Joseph Myers wrote: > > > > On Tue, 7 Feb 2023, Qing Zhao via Gcc-patches wrote: > > > >> Then, this routine (flexible_array_type_p) is mainly for diagnostic purpose. > >> It cannot be used to determine whether the structure/union type recursively > >> include a flexible array member at the end. > >> > >> Is my understanding correct? > > > > My comments were about basic principles of what gets diagnosed, and the > > need for different predicates in different contexts; I wasn't trying to > > assert anything about how that maps onto what functions should be used in > > what contexts. > Okay. > > But I noticed that “flexible_array_type_p” later was moved from FE to > middle-end and put into tree.cc, tree.h as a general utility routine, and to > > /* Determine whether TYPE is a structure with a flexible array member, > or a union containing such a structure (possibly recursively). */ > > However, since this routine does not cover the cases when the structure > with flexible array member was recursively embedded into structures, (which we > agreed that it should be considered as a flexible sized type). > > Therefore, I feel that It might not be proper to include this routine in middle end > (and actually no other places In middle end use this routine so far). > > That’s the reason I asked the previous question. > > It might be better to move the routine “flexible_array_type_p” back from middle-end to > FE for the diagnosis purpose only. It's always dangerous to move functions with such a descriptive name to a place where it suggests wider use is applicable. Also since objc/objc-act.cc has a function with the same name (if that had same content before r10-5097-g4569f8b3652ae1 then the function should have been moved to c-family/ instead). The only "middle-end" use, btw., is in ./config/nios2/nios2.cc, intoduced by said revision and your points probably mean this change was misguided and flexible_array_type_p isn't the thing to fix here. flexible-size _objects_ are clearly denoted by DECL_SIZE being non-constant - though the case of .sdata is quite odd and the issue fixed is probably running into a bug elsewhere ... Sandra? Thanks, Richard. ---1609957120-844045914-1675938912=:9226--