From patchwork Thu Aug 15 16:56:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1147716 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-507077-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="bsk3Y0Qf"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="b7UQKrGN"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 468Xfr5WyJz9sN6 for ; Fri, 16 Aug 2019 02:56:50 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=u0l9MAmmSjRIJnxsZipn1e6WZUzw3p+kCOSOsXaXbGnSmbsbnn4YG AA1ecxywvXb67fdH0XDpQJAAXXJw5E9+pgaBm4a2UBFKomHBo+qPbQQayhtIIraV y83KHcZdFtKl6B0OHEmUvl5GwYm6U4gdE1hZ3R/mQruKNUSeX0LDBo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; s= default; bh=f8IyaNizYmmAJ/p69/uddiQWLLw=; b=bsk3Y0Qf7gM91ks6zEXq zjh71n9B4BYGxwgApzj2NN/L1kBTk4F/9U5jGU0Ml2jXKecP7L4E5QK1KIGwA2+3 qJB6tTkteGB86BzxEDiAorN8ORAyb4/+8/WkRLfeMxkTobLVWWF1oWW6ifZOedlj enU4cnZ5NkysIxJqF+EyvmY= Received: (qmail 61376 invoked by alias); 15 Aug 2019 16:56:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 61006 invoked by uid 89); 15 Aug 2019 16:56:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=datum, HX-Languages-Length:2530 X-HELO: mail-qt1-f177.google.com Received: from mail-qt1-f177.google.com (HELO mail-qt1-f177.google.com) (209.85.160.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 15 Aug 2019 16:56:40 +0000 Received: by mail-qt1-f177.google.com with SMTP id t12so3018491qtp.9 for ; Thu, 15 Aug 2019 09:56:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:message-id:date:user-agent:mime-version :content-language; bh=WEhY50hVlK3BcaQqjroq9NTm++II3s+Fqk7esSU9LH8=; b=b7UQKrGNma4ngJtbDArZMYY1owRCEVdGczMjEmXfRXaEgCeEBdrkhpknYgbjuhojVt i5fJ9bC3v3m5DtJCtBwBLOdVL9pODuWVUYVp7ROaR+t6Vc/bf3rXaDkEEP+KVDZAjI9C 1aUDhb7S52eoBdSIEUqoL2XtnohWEWDxdrknRaRc3uZigF20MBKGq0Z4cxwzUs1VuH00 zZWWmAAomJUSYIQ2ojWqBbt2u7/glm320HXz3Xr235NeL+EeJSkV7dkqCne0FygM7Ruh Pj2/deFQKOWRniFJjxWCAEsP5v9tksCxF2vxUHEHrUyREaeP0r+FWeoL3tmA4Q2eF0HG 6gsg== Received: from [192.168.0.41] (97-118-116-95.hlrn.qwest.net. [97.118.116.95]) by smtp.gmail.com with ESMTPSA id f22sm1622428qkk.45.2019.08.15.09.56.36 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Thu, 15 Aug 2019 09:56:36 -0700 (PDT) From: Martin Sebor Subject: [PATCH] make clear TYPE_SIZE may be non-constant or null To: gcc-patches Message-ID: <5cd8de93-060d-3117-6600-4afad233571c@gmail.com> Date: Thu, 15 Aug 2019 10:56:35 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 X-IsSubscribed: yes The comment for DECL_SIZE makes it clear it may be non-constant but not that it may be null. The comment for TYPE_SIZE mentions neither. The attached update adds a few sentences to make these caveats clear. If no one has any suggestions I'll commit it as obvious today or tomorrow. Thanks Martin gcc/ChangeLog: * tree.def (TYPE_SIZE): Clarify. * tree.h (TYPE_SIZE, TYPE_SIZE_UNIT, DECL_SIZE): Add comments. Index: gcc/tree.def =================================================================== --- gcc/tree.def (revision 274541) +++ gcc/tree.def (working copy) @@ -77,7 +77,10 @@ DEFTREECODE (BLOCK, "block", tcc_exceptional, 0) /* Each data type is represented by a tree node whose code is one of the following: */ /* Each node that represents a data type has a component TYPE_SIZE - containing a tree that is an expression for the size in bits. + that evaluates either to a tree that is a (potentially non-constant) + expression representing the type size in bits, or to a null pointer + when the size of the type is unknown (for example, for incomplete + types such as arrays of unspecified bound). The TYPE_MODE contains the machine mode for values of this type. The TYPE_POINTER_TO field contains a type for a pointer to this type, or zero if no such has been created yet. Index: gcc/tree.h =================================================================== --- gcc/tree.h (revision 274541) +++ gcc/tree.h (working copy) @@ -1952,7 +1952,10 @@ class auto_suppress_location_wrappers so they must be checked as well. */ #define TYPE_UID(NODE) (TYPE_CHECK (NODE)->type_common.uid) +/* Type size in bits as a tree expression. Need not be constant + and may be null. */ #define TYPE_SIZE(NODE) (TYPE_CHECK (NODE)->type_common.size) +/* Likewise, type size in bytes. */ #define TYPE_SIZE_UNIT(NODE) (TYPE_CHECK (NODE)->type_common.size_unit) #define TYPE_POINTER_TO(NODE) (TYPE_CHECK (NODE)->type_common.pointer_to) #define TYPE_REFERENCE_TO(NODE) (TYPE_CHECK (NODE)->type_common.reference_to) @@ -2480,7 +2483,7 @@ extern machine_mode vector_type_mode (const_tree); #define DECL_INITIAL(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.initial) /* Holds the size of the datum, in bits, as a tree expression. - Need not be constant. */ + Need not be constant and may be null. */ #define DECL_SIZE(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.size) /* Likewise for the size in bytes. */ #define DECL_SIZE_UNIT(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.size_unit)