From ffa61a5ee88bced356a16485bdf5702d7ee04b1a Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Mon, 13 Jul 2009 08:26:38 +0200 Subject: [PATCH] re PR fortran/40588 (Small bug in match_charkind_name) 2009-07-12 Tobias Burnus Philippe Marguinaud PR fortran/40588 * primary.c (match_charkind_name): Fix condition for $ matching. PR libfortran/22423 * libgfortran.h: Typedef the GFC_DTYPE_* enum. 2009-07-12 Tobias Burnus PR libfortran/22423 * io/io.h (namelist_type): Use the proper enum for GFC_DTYPE_*. * intrinsics/iso_c_binding.c (c_f_pointer_u0): Make sure variable is initialized to silence warning. Co-Authored-By: Philippe Marguinaud From-SVN: r149545 --- gcc/fortran/ChangeLog | 9 ++++++++ gcc/fortran/libgfortran.h | 5 +++-- gcc/fortran/primary.c | 2 +- libgfortran/ChangeLog | 9 +++++++- libgfortran/intrinsics/iso_c_binding.c | 30 +++++++++++++++++--------- libgfortran/io/io.h | 2 +- 6 files changed, 42 insertions(+), 15 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ec4502fc0f4..220693141b9 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2009-07-12 Tobias Burnus + Philippe Marguinaud + + PR fortran/40588 + * primary.c (match_charkind_name): Fix condition for $ matching. + + PR libfortran/22423 + * libgfortran.h: Typedef the GFC_DTYPE_* enum. + 2009-07-11 Tobias Burnus PR fortran/33197 diff --git a/gcc/fortran/libgfortran.h b/gcc/fortran/libgfortran.h index a18fdce2e88..d66020717a4 100644 --- a/gcc/fortran/libgfortran.h +++ b/gcc/fortran/libgfortran.h @@ -110,7 +110,7 @@ libgfortran_error_codes; #define GFC_DTYPE_TYPE_MASK 0x38 #define GFC_DTYPE_SIZE_SHIFT 6 -enum +typedef enum { GFC_DTYPE_UNKNOWN = 0, GFC_DTYPE_INTEGER, @@ -120,5 +120,6 @@ enum GFC_DTYPE_COMPLEX, GFC_DTYPE_DERIVED, GFC_DTYPE_CHARACTER -}; +} +dtype; diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 8013cc86d1e..0d52c6c0940 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -832,7 +832,7 @@ match_charkind_name (char *name) if (!ISALNUM (c) && c != '_' - && (gfc_option.flag_dollar_ok && c != '$')) + && (c != '$' || !gfc_option.flag_dollar_ok)) break; *name++ = c; diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 6ffd83d40ec..932c85efd7c 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,8 +1,15 @@ +2009-07-12 Tobias Burnus + + PR libfortran/22423 + * io/io.h (namelist_type): Use the proper enum for GFC_DTYPE_*. + * intrinsics/iso_c_binding.c (c_f_pointer_u0): Make sure + variable is initialized to silence warning. + 2009-07-10 Steven G. Kargl * c99_functions.c (ccoshf, ccosh, ccoshl, ctanhf, ctanh, ctanl): Fix errant minus. - + 2009-07-08 Jerry DeLisle PR libfortran/40330 diff --git a/libgfortran/intrinsics/iso_c_binding.c b/libgfortran/intrinsics/iso_c_binding.c index bb25e3e2d4f..0dd7449df6d 100644 --- a/libgfortran/intrinsics/iso_c_binding.c +++ b/libgfortran/intrinsics/iso_c_binding.c @@ -113,26 +113,36 @@ ISO_C_BINDING_PREFIX (c_f_pointer_u0) (void *c_ptr_in, /* Have to allow for the SHAPE array to be any valid kind for an INTEGER type. */ + switch (size) + { #ifdef HAVE_GFC_INTEGER_1 - if (size == 1) - ub = *((GFC_INTEGER_1 *) p); + case 1: + ub = *((GFC_INTEGER_1 *) p); + break; #endif #ifdef HAVE_GFC_INTEGER_2 - if (size == 2) - ub = *((GFC_INTEGER_2 *) p); + case 2: + ub = *((GFC_INTEGER_2 *) p); + break; #endif #ifdef HAVE_GFC_INTEGER_4 - if (size == 4) - ub = *((GFC_INTEGER_4 *) p); + case 4: + ub = *((GFC_INTEGER_4 *) p); + break; #endif #ifdef HAVE_GFC_INTEGER_8 - if (size == 8) - ub = *((GFC_INTEGER_8 *) p); + case 8: + ub = *((GFC_INTEGER_8 *) p); + break; #endif #ifdef HAVE_GFC_INTEGER_16 - if (size == 16) - ub = *((GFC_INTEGER_16 *) p); + case 16: + ub = *((GFC_INTEGER_16 *) p); + break; #endif + default: + internal_error (NULL, "c_f_pointer_u0: Invalid size"); + } p += source_stride; if (i == 0) diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index 088969a0fca..2a077629a6d 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -163,7 +163,7 @@ format_hash_entry; typedef struct namelist_type { /* Object type, stored as GFC_DTYPE_xxxx. */ - bt type; + dtype type; /* Object name. */ char * var_name;