From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26589 invoked by alias); 7 Nov 2013 20:56:06 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 26554 invoked by uid 89); 7 Nov 2013 20:56:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_00,RDNS_NONE,SPAM_SUBJECT,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 07 Nov 2013 20:56:04 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rA7Ktw56025682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 7 Nov 2013 15:55:58 -0500 Received: from barimba (ovpn-113-94.phx2.redhat.com [10.3.113.94]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rA7Ktui2005165 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 7 Nov 2013 15:55:57 -0500 From: Tom Tromey To: Sanimir Agovic Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 07/10] test: evaluate pointers to C99 vla correctly. References: <1382366424-21010-1-git-send-email-sanimir.agovic@intel.com> <1382366424-21010-8-git-send-email-sanimir.agovic@intel.com> Date: Thu, 07 Nov 2013 20:57:00 -0000 In-Reply-To: <1382366424-21010-8-git-send-email-sanimir.agovic@intel.com> (Sanimir Agovic's message of "Mon, 21 Oct 2013 16:40:21 +0200") Message-ID: <87siv8szhf.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-11/txt/msg00209.txt.bz2 >>>>> "Sanimir" == Sanimir Agovic writes: Sanimir> +void Sanimir> +foo (int n, int vla_ptr[n]) Sanimir> +{ Sanimir> + return; /* foo_bp */ Sanimir> +} Sanimir> +gdb_test "print vla_ptr" "\\\(int \\\*\\\) $hex" "print vla_ptr (foo)" Sanimir> +gdb_test "print *vla_ptr" "\\$\\d+ = 2" "print *vla_ptr (foo)" This seems odd to me. I suppose right now gcc claims that 'vla_ptr' has type 'int *'. But I don't see why that is necessarily so. Are compilers required to declare this parameter as an "int *" and not "int[n]"? That is, this test seems dependent on a compiler quirk. The second test could maybe be rephrased as "print vla_ptr\[0\]" and have a well-defined meaning across different styles of DWARF. Sanimir> +gdb_test "print *vla_ptr" "\\$\\d+ = \\\{2, 3, 4, 5, 6\\\}" "print *vla_ptr (vla_func)" Sanimir> +gdb_test "print sizeof(*vla_ptr)" "\\$\\d+ = 20" "print sizeof(*vla_ptr) (vla_func)" Printing plain old "vla" would not be amiss. Perhaps also reasonable would be a "VLA of typedefs" test like: typedef int something; something svla[n]; ... Tom