From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95771 invoked by alias); 17 Sep 2015 14:19:28 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 95714 invoked by uid 89); 17 Sep 2015 14:19:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 17 Sep 2015 14:19:26 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id CE5652961E; Thu, 17 Sep 2015 10:19:24 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id YpQb2HeZwLao; Thu, 17 Sep 2015 10:19:24 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 9CED129616; Thu, 17 Sep 2015 10:19:24 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 086BB46975; Thu, 17 Sep 2015 07:19:23 -0700 (PDT) Date: Thu, 17 Sep 2015 14:19:00 -0000 From: Joel Brobecker To: Senthil Kumar Selvaraj Cc: gdb@sourceware.org Subject: Re: sizeof evaluates expression to compute size? Message-ID: <20150917141923.GP4680@adacore.com> References: <20150916144109.GB14658@jaguar.corp.atmel.com> <20150916145632.GA19688@adacore.com> <20150917140949.GA2332@jaguar.corp.atmel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150917140949.GA2332@jaguar.corp.atmel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-09/txt/msg00013.txt.bz2 > Evaluation works fine without the cast to char* > >>> print sizeof(pFoo->arr) > $2 = 10 Ah, it's the cast that's causing it! I don't remember exactly what the limitations where in terms of trying to limit those inferior memory allocations. Perhaps it is a bug indeed. Perhaps a limitation we'll have to live with. Your example is not very meaningful, at the moment. You could just do "print sizeof (char *)" for instance. That will give you an answer that's different from what the actual size of your component is (4 or 8 vs 10). -- Joel