aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorTobias Burnus <burnus@gcc.gnu.org>2007-08-29 15:08:55 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2007-08-29 15:08:55 +0200
commitad4a2f64b9bf7a77e8db1ddcb4ef5275f1897ac4 (patch)
tree13f2de74f89f6097aa95ac4bda69a46d83215792 /gcc/fortran
parent4376b7cf2b7d906c1952205ec3242e689f84f671 (diff)
downloadgcc-ad4a2f64b9bf7a77e8db1ddcb4ef5275f1897ac4.zip
gcc-ad4a2f64b9bf7a77e8db1ddcb4ef5275f1897ac4.tar.gz
gcc-ad4a2f64b9bf7a77e8db1ddcb4ef5275f1897ac4.tar.bz2
re PR fortran/33215 (Bind(C): Bugs with empty "name=": Creates wrong result and accepts invalid)
2007-08-29 Christopher D. Rickett <crickett@lanl.gov> PR fortran/33215 * decl.c (build_sym): Pass number of identifiers on line to set_binding_label. (set_binding_label): Verify that only one identifier given if NAME= specified, even if the given binding label has zero length. (gfc_match_bind_c): Remove declaration for has_name_equals because it hides the static global one that is needed. 2007-08-29 Christopher D. Rickett <crickett@lanl.gov> PR fortran/33215 * gfortran.dg/binding_label_tests_15.f03: New test case. * gfortran.dg/binding_label_tests_16.f03: Ditto. From-SVN: r127898
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog10
-rw-r--r--gcc/fortran/decl.c22
2 files changed, 21 insertions, 11 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index b523e8a..7e5a7d8 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,13 @@
+2007-08-28 Christopher D. Rickett <crickett@lanl.gov>
+
+ PR fortran/33215
+ * decl.c (build_sym): Pass number of identifiers on line to
+ set_binding_label.
+ (set_binding_label): Verify that only one identifier given if
+ NAME= specified, even if the given binding label has zero length.
+ (gfc_match_bind_c): Remove declaration for has_name_equals because
+ it hides the static global one that is needed.
+
2007-08-29 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
* trans-array.c (gfc_grow_array): Use gfc_call_realloc.
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 70098b4..8b35662 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -980,9 +980,10 @@ build_sym (const char *name, gfc_charlen *cl,
{
if (sym->binding_label[0] == '\0')
{
- /* Here, we're not checking the numIdents (the last param).
- This could be an error we're letting slip through! */
- if (set_binding_label (sym->binding_label, sym->name, 1) == FAILURE)
+ /* Set the binding label and verify that if a NAME= was specified
+ then only one identifier was in the entity-decl-list. */
+ if (set_binding_label (sym->binding_label, sym->name,
+ num_idents_on_line) == FAILURE)
return FAILURE;
}
}
@@ -2847,15 +2848,15 @@ cleanup:
try
set_binding_label (char *dest_label, const char *sym_name, int num_idents)
{
- if (curr_binding_label[0] != '\0')
+ if (num_idents > 1 && has_name_equals)
{
- if (num_idents > 1 || num_idents_on_line > 1)
- {
- gfc_error ("Multiple identifiers provided with "
- "single NAME= specifier at %C");
- return FAILURE;
- }
+ gfc_error ("Multiple identifiers provided with "
+ "single NAME= specifier at %C");
+ return FAILURE;
+ }
+ if (curr_binding_label[0] != '\0')
+ {
/* Binding label given; store in temp holder til have sym. */
strncpy (dest_label, curr_binding_label,
strlen (curr_binding_label) + 1);
@@ -4084,7 +4085,6 @@ gfc_match_bind_c (gfc_symbol *sym)
char binding_label[GFC_MAX_SYMBOL_LEN + 1];
match double_quote;
match single_quote;
- int has_name_equals = 0;
/* Initialize the flag that specifies whether we encountered a NAME=
specifier or not. */