From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10143 invoked by alias); 19 Apr 2010 20:17:32 -0000 Received: (qmail 10124 invoked by uid 22791); 19 Apr 2010 20:17:29 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 19 Apr 2010 20:17:22 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o3JKHH8d026762 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 19 Apr 2010 16:17:17 -0400 Received: from psique.localnet (vpn-237-208.phx2.redhat.com [10.3.237.208]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3JKHGkZ019083; Mon, 19 Apr 2010 16:17:16 -0400 From: Sergio Durigan Junior To: Jan Kratochvil Subject: Re: [PATCH]: New `logical*8' type for Fortran Date: Mon, 19 Apr 2010 20:17:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.32.11-99.fc12.x86_64; KDE/4.4.2; x86_64; ; ) Cc: gdb-patches@sourceware.org References: <201004152001.22206.sergiodj@redhat.com> <201004181848.34931.sergiodj@redhat.com> <20100419025323.GA23818@host0.dyn.jankratochvil.net> In-Reply-To: <20100419025323.GA23818@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_LpLzLlc4U+nvGpU" Message-Id: <201004191717.15145.sergiodj@redhat.com> X-IsSubscribed: yes 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 X-SW-Source: 2010-04/txt/msg00574.txt.bz2 --Boundary-00=_LpLzLlc4U+nvGpU Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-length: 265 On Sunday 18 April 2010 23:53:23, Jan Kratochvil wrote: > patch: **** malformed patch at line 57: type-specifier */ > > I do not defend this policy, though. Ok, I give up (for now). Here is the attached version of the patch. Ok to commit? Regards, -- Sergio --Boundary-00=_LpLzLlc4U+nvGpU Content-Type: text/x-changelog; charset="UTF-8"; name="ChangeLog" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ChangeLog" Content-length: 639 gdb/ChangeLog: 2010-04-18 Jan Kratochvil * f-exp.y: Add new production to recognize the `logical*8' type. (LOGICAL_S8_KEYWORD): New token. * f-lang.c (enum f_primitive_types) : New field. (f_language_arch_info): Handling `logical*8' type. (build_fortran_types): Building `logical*8' type. * f-lang.h (struct builtin_f_type) : New field. gdb/testsuite/ChangeLog: 2010-04-18 Jan Kratochvil Sergio Durigan Junior * gdb.fortran/logical.exp: New testcase. * gdb.fortran/logical.f90: New file. --Boundary-00=_LpLzLlc4U+nvGpU Content-Type: text/x-patch; charset="UTF-8"; name="fortran-logical8.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fortran-logical8.patch" Content-length: 5831 diff --git a/gdb/f-exp.y b/gdb/f-exp.y index e320f2c..abc590e 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -196,6 +196,7 @@ static int parse_number (char *, int, int, YYSTYPE *); /* Special type cases, put in to allow the parser to distinguish different legal basetypes. */ %token INT_KEYWORD INT_S2_KEYWORD LOGICAL_S1_KEYWORD LOGICAL_S2_KEYWORD +%token LOGICAL_S8_KEYWORD %token LOGICAL_KEYWORD REAL_KEYWORD REAL_S8_KEYWORD REAL_S16_KEYWORD %token COMPLEX_S8_KEYWORD COMPLEX_S16_KEYWORD COMPLEX_S32_KEYWORD %token BOOL_AND BOOL_OR BOOL_NOT @@ -606,6 +607,8 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */ { $$ = parse_f_type->builtin_integer_s2; } | CHARACTER { $$ = parse_f_type->builtin_character; } + | LOGICAL_S8_KEYWORD + { $$ = parse_f_type->builtin_logical_s8; } | LOGICAL_KEYWORD { $$ = parse_f_type->builtin_logical; } | LOGICAL_S2_KEYWORD @@ -858,6 +861,7 @@ static const struct token f77_keywords[] = { "integer_2", INT_S2_KEYWORD, BINOP_END }, { "logical_1", LOGICAL_S1_KEYWORD, BINOP_END }, { "logical_2", LOGICAL_S2_KEYWORD, BINOP_END }, + { "logical_8", LOGICAL_S8_KEYWORD, BINOP_END }, { "complex_8", COMPLEX_S8_KEYWORD, BINOP_END }, { "integer", INT_KEYWORD, BINOP_END }, { "logical", LOGICAL_KEYWORD, BINOP_END }, diff --git a/gdb/f-lang.c b/gdb/f-lang.c index b914b49..0bee8f5 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -259,6 +259,7 @@ enum f_primitive_types { f_primitive_type_logical, f_primitive_type_logical_s1, f_primitive_type_logical_s2, + f_primitive_type_logical_s8, f_primitive_type_integer, f_primitive_type_integer_s2, f_primitive_type_real, @@ -289,6 +290,8 @@ f_language_arch_info (struct gdbarch *gdbarch, = builtin->builtin_logical_s1; lai->primitive_type_vector [f_primitive_type_logical_s2] = builtin->builtin_logical_s2; + lai->primitive_type_vector [f_primitive_type_logical_s8] + = builtin->builtin_logical_s8; lai->primitive_type_vector [f_primitive_type_real] = builtin->builtin_real; lai->primitive_type_vector [f_primitive_type_real_s8] @@ -372,6 +375,10 @@ build_fortran_types (struct gdbarch *gdbarch) = arch_boolean_type (gdbarch, gdbarch_short_bit (gdbarch), 1, "logical*2"); + builtin_f_type->builtin_logical_s8 + = arch_boolean_type (gdbarch, gdbarch_long_long_bit (gdbarch), 1, + "logical*8"); + builtin_f_type->builtin_integer = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "integer"); diff --git a/gdb/f-lang.h b/gdb/f-lang.h index b98c556..094d6fa 100644 --- a/gdb/f-lang.h +++ b/gdb/f-lang.h @@ -113,6 +113,7 @@ struct builtin_f_type struct type *builtin_logical; struct type *builtin_logical_s1; struct type *builtin_logical_s2; + struct type *builtin_logical_s8; struct type *builtin_real; struct type *builtin_real_s8; struct type *builtin_real_s16; diff --git a/gdb/testsuite/gdb.fortran/logical.exp b/gdb/testsuite/gdb.fortran/logical.exp new file mode 100644 index 0000000..e9034f7 --- /dev/null +++ b/gdb/testsuite/gdb.fortran/logical.exp @@ -0,0 +1,38 @@ +# Copyright 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# This file was written by Jan Kratochvil . + +set test "logical" +set srcfile ${test}.f90 + +if { [prepare_for_testing "${test}.exp" "${test}" "${srcfile}" {debug f77 quiet}] } { + untested "Could not compile ${srcfile}." + return -1 +} + +if { ![runto MAIN__] } { + perror "Could not run to breakpoint `MAIN__'." + continue +} + +gdb_breakpoint [gdb_get_line_number "stop-here"] +gdb_continue_to_breakpoint "stop-here" ".*stop-here.*" +gdb_test "p l" " = \\.TRUE\\." +gdb_test "p l1" " = \\.TRUE\\." +gdb_test "p l2" " = \\.TRUE\\." +gdb_test "p l4" " = \\.TRUE\\." +gdb_test "p l8" " = \\.TRUE\\." diff --git a/gdb/testsuite/gdb.fortran/logical.f90 b/gdb/testsuite/gdb.fortran/logical.f90 new file mode 100644 index 0000000..2fa93f9 --- /dev/null +++ b/gdb/testsuite/gdb.fortran/logical.f90 @@ -0,0 +1,31 @@ +! Copyright 2010 Free Software Foundation, Inc. +! +! This program is free software; you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation; either version 2 of the License, or +! (at your option) any later version. +! +! This program is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with this program; if not, write to the Free Software +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +! +! This file was written by Jan Kratochvil . + +program test + logical :: l + logical (kind=1) :: l1 + logical (kind=2) :: l2 + logical (kind=4) :: l4 + logical (kind=8) :: l8 + l = .TRUE. + l1 = .TRUE. + l2 = .TRUE. + l4 = .TRUE. + l8 = .TRUE. + l = .FALSE. ! stop-here +end --Boundary-00=_LpLzLlc4U+nvGpU--