keiths / rpms / gdb

Forked from rpms/gdb 2 days ago
Clone
8c4c91e
--- a/gdb/f-exp.y
8c4c91e
+++ b/gdb/f-exp.y
8c4c91e
@@ -196,6 +196,7 @@ static int parse_number (char *, int, int, YYSTYPE *);
8c4c91e
 /* Special type cases, put in to allow the parser to distinguish different
8c4c91e
    legal basetypes.  */
8c4c91e
 %token INT_KEYWORD INT_S2_KEYWORD LOGICAL_S1_KEYWORD LOGICAL_S2_KEYWORD 
8c4c91e
+%token LOGICAL_S8_KEYWORD 
8c4c91e
 %token LOGICAL_KEYWORD REAL_KEYWORD REAL_S8_KEYWORD REAL_S16_KEYWORD 
8c4c91e
 %token COMPLEX_S8_KEYWORD COMPLEX_S16_KEYWORD COMPLEX_S32_KEYWORD 
8c4c91e
 %token BOOL_AND BOOL_OR BOOL_NOT   
8c4c91e
@@ -606,6 +607,8 @@ typebase  /* Implements (approximately): (type-qualifier)* type-specifier */
8c4c91e
 			{ $$ = parse_f_type->builtin_integer_s2; }
8c4c91e
 	|	CHARACTER 
8c4c91e
 			{ $$ = parse_f_type->builtin_character; }
8c4c91e
+	|	LOGICAL_S8_KEYWORD
8c4c91e
+			{ $$ = parse_f_type->builtin_logical_s8;}
8c4c91e
 	|	LOGICAL_KEYWORD 
8c4c91e
 			{ $$ = parse_f_type->builtin_logical; }
8c4c91e
 	|	LOGICAL_S2_KEYWORD
8c4c91e
@@ -858,6 +861,7 @@ static const struct token f77_keywords[] =
8c4c91e
   { "integer_2", INT_S2_KEYWORD, BINOP_END },
8c4c91e
   { "logical_1", LOGICAL_S1_KEYWORD, BINOP_END },
8c4c91e
   { "logical_2", LOGICAL_S2_KEYWORD, BINOP_END },
8c4c91e
+  { "logical_8", LOGICAL_S8_KEYWORD, BINOP_END },
8c4c91e
   { "complex_8", COMPLEX_S8_KEYWORD, BINOP_END },
8c4c91e
   { "integer", INT_KEYWORD, BINOP_END },
8c4c91e
   { "logical", LOGICAL_KEYWORD, BINOP_END },
8c4c91e
--- a/gdb/f-lang.c
8c4c91e
+++ b/gdb/f-lang.c
8c4c91e
@@ -259,6 +245,7 @@ enum f_primitive_types {
8c4c91e
   f_primitive_type_logical,
8c4c91e
   f_primitive_type_logical_s1,
8c4c91e
   f_primitive_type_logical_s2,
8c4c91e
+  f_primitive_type_logical_s8,
8c4c91e
   f_primitive_type_integer,
8c4c91e
   f_primitive_type_integer_s2,
8c4c91e
   f_primitive_type_real,
8c4c91e
@@ -289,6 +276,8 @@ f_language_arch_info (struct gdbarch *gdbarch,
8c4c91e
     = builtin->builtin_logical_s1;
8c4c91e
   lai->primitive_type_vector [f_primitive_type_logical_s2]
8c4c91e
     = builtin->builtin_logical_s2;
8c4c91e
+  lai->primitive_type_vector [f_primitive_type_logical_s8]
8c4c91e
+    = builtin->builtin_logical_s8;
8c4c91e
   lai->primitive_type_vector [f_primitive_type_real]
8c4c91e
     = builtin->builtin_real;
8c4c91e
   lai->primitive_type_vector [f_primitive_type_real_s8]
8c4c91e
@@ -372,6 +361,10 @@ build_fortran_types (struct gdbarch *gdbarch)
8c4c91e
     = arch_boolean_type (gdbarch, gdbarch_short_bit (gdbarch), 1,
8c4c91e
 			 "logical*2");
8c4c91e
 
8c4c91e
+  builtin_f_type->builtin_logical_s8
8c4c91e
+    = arch_boolean_type (gdbarch, gdbarch_long_long_bit (gdbarch), 1,
8c4c91e
+			 "logical*8");
8c4c91e
+
8c4c91e
   builtin_f_type->builtin_integer
8c4c91e
     = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0,
8c4c91e
 			 "integer");
8c4c91e
--- a/gdb/f-lang.h
8c4c91e
+++ b/gdb/f-lang.h
8c4c91e
@@ -113,6 +80,7 @@ struct builtin_f_type
8c4c91e
   struct type *builtin_logical;
8c4c91e
   struct type *builtin_logical_s1;
8c4c91e
   struct type *builtin_logical_s2;
8c4c91e
+  struct type *builtin_logical_s8;
8c4c91e
   struct type *builtin_real;
8c4c91e
   struct type *builtin_real_s8;
8c4c91e
   struct type *builtin_real_s16;
8c4c91e
--- /dev/null
8c4c91e
+++ b/gdb/testsuite/gdb.fortran/logical.exp
8c4c91e
@@ -0,0 +1,44 @@
8c4c91e
+# Copyright 2007 Free Software Foundation, Inc.
8c4c91e
+
8c4c91e
+# This program is free software; you can redistribute it and/or modify
8c4c91e
+# it under the terms of the GNU General Public License as published by
8c4c91e
+# the Free Software Foundation; either version 2 of the License, or
8c4c91e
+# (at your option) any later version.
8c4c91e
+# 
8c4c91e
+# This program is distributed in the hope that it will be useful,
8c4c91e
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
8c4c91e
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8c4c91e
+# GNU General Public License for more details.
8c4c91e
+# 
8c4c91e
+# You should have received a copy of the GNU General Public License
8c4c91e
+# along with this program; if not, write to the Free Software
8c4c91e
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
8c4c91e
+
8c4c91e
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
8c4c91e
+
8c4c91e
+set testfile "logical"
8c4c91e
+set srcfile ${testfile}.f90
8c4c91e
+set binfile ${objdir}/${subdir}/${testfile}
8c4c91e
+
8c4c91e
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
8c4c91e
+    untested "Couldn't compile ${srcfile}"
8c4c91e
+    return -1
8c4c91e
+}
8c4c91e
+
8c4c91e
+gdb_exit
8c4c91e
+gdb_start
8c4c91e
+gdb_reinitialize_dir $srcdir/$subdir
8c4c91e
+gdb_load ${binfile}
8c4c91e
+
8c4c91e
+if ![runto MAIN__] then {
8c4c91e
+    perror "couldn't run to breakpoint MAIN__"
8c4c91e
+    continue
8c4c91e
+}
8c4c91e
+
8c4c91e
+gdb_breakpoint [gdb_get_line_number "stop-here"]
8c4c91e
+gdb_continue_to_breakpoint "stop-here"
8c4c91e
+gdb_test "p l" " = \\.TRUE\\."
8c4c91e
+gdb_test "p l1" " = \\.TRUE\\."
8c4c91e
+gdb_test "p l2" " = \\.TRUE\\."
8c4c91e
+gdb_test "p l4" " = \\.TRUE\\."
8c4c91e
+gdb_test "p l8" " = \\.TRUE\\."
8c4c91e
diff --git a/gdb/testsuite/gdb.fortran/logical.f90 b/gdb/testsuite/gdb.fortran/logical.f90
8c4c91e
new file mode 100644
8c4c91e
index 0000000..4229304
8c4c91e
--- /dev/null
8c4c91e
+++ b/gdb/testsuite/gdb.fortran/logical.f90
8c4c91e
@@ -0,0 +1,33 @@
8c4c91e
+! Copyright 2008 Free Software Foundation, Inc.
8c4c91e
+!
8c4c91e
+! This program is free software; you can redistribute it and/or modify
8c4c91e
+! it under the terms of the GNU General Public License as published by
8c4c91e
+! the Free Software Foundation; either version 2 of the License, or
8c4c91e
+! (at your option) any later version.
8c4c91e
+!
8c4c91e
+! This program is distributed in the hope that it will be useful,
8c4c91e
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
8c4c91e
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8c4c91e
+! GNU General Public License for more details.
8c4c91e
+!
8c4c91e
+! You should have received a copy of the GNU General Public License
8c4c91e
+! along with this program; if not, write to the Free Software
8c4c91e
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
8c4c91e
+!
8c4c91e
+! Ihis file is the Fortran source file for dynamic.exp.
8c4c91e
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
8c4c91e
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
8c4c91e
+
8c4c91e
+program test
8c4c91e
+  logical :: l
8c4c91e
+  logical (kind=1) :: l1
8c4c91e
+  logical (kind=2) :: l2
8c4c91e
+  logical (kind=4) :: l4
8c4c91e
+  logical (kind=8) :: l8
8c4c91e
+  l = .TRUE.
8c4c91e
+  l1 = .TRUE.
8c4c91e
+  l2 = .TRUE.
8c4c91e
+  l4 = .TRUE.
8c4c91e
+  l8 = .TRUE.
8c4c91e
+  l = .FALSE.					! stop-here
8c4c91e
+end