From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45033 invoked by alias); 4 Mar 2016 18:59:11 -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 45020 invoked by uid 89); 4 Mar 2016 18:59:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 04 Mar 2016 18:59:09 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 731553122; Fri, 4 Mar 2016 18:59:08 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u24Ix5iA004225 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 4 Mar 2016 13:59:07 -0500 Date: Fri, 04 Mar 2016 18:59:00 -0000 From: Jan Kratochvil To: Pedro Alves Cc: Neven Sajko , gdb@sourceware.org Subject: Re: Printing a 2D array in a C program Message-ID: <20160304185904.GA17723@host1.jankratochvil.net> References: <20160304144231.GA7767@host1.jankratochvil.net> <20160304174859.GA15741@host1.jankratochvil.net> <56D9D2D3.4020706@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56D9D2D3.4020706@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016-03/txt/msg00012.txt.bz2 On Fri, 04 Mar 2016 19:24:19 +0100, Pedro Alves wrote: > It's a C gotcha, but I don't think it's a bug. Essentially, a parameter > declared as an array is really treated as a pointer parameter. I did not look it up but I expected the standard probably says something like that, this is also why clang matches the gcc behavior. But GDB could try to be more helpful displaying the data. For example DWARF could have the pointer there at its type for sizeof and similar but additionally there could be some new GNU attribute for printing the data. Just I did not file it as I think C++ is more appropriate for such (or all) cases where it already just works. Jan