diff options
| author | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-02-29 22:50:25 +0000 |
|---|---|---|
| committer | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-02-29 22:50:25 +0000 |
| commit | 52179f31f52232daf3ee40f0d33cc48fba91ce03 (patch) | |
| tree | 6b8d4f59dabb468ef7b4fe96a4195f38a77e215b | |
| parent | 4a2f7014a02f75166c378fa399539978ad4b8f0e (diff) | |
| download | ppe42-gcc-52179f31f52232daf3ee40f0d33cc48fba91ce03.tar.gz ppe42-gcc-52179f31f52232daf3ee40f0d33cc48fba91ce03.zip | |
2008-02-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/35059
* expr.c (find_array_element): Modify traversing the constructor to
avoid trying to access NULL memory pointed to by next for the
last element. (find_array_section): Exit while loop if cons->next is
NULL.
* trans-expr.c (gfc_conv_scalar_char_value): Initialize gfc_typespec.
(gfc_conv_function_call): Same.
* decl.c (gfc_match_implicit): Same.
* trans-intrinsic.c (gfc_conv_intrinsic_sr_kind): Same.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132782 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/fortran/ChangeLog | 12 | ||||
| -rw-r--r-- | gcc/fortran/decl.c | 2 | ||||
| -rw-r--r-- | gcc/fortran/expr.c | 27 | ||||
| -rw-r--r-- | gcc/fortran/trans-expr.c | 2 | ||||
| -rw-r--r-- | gcc/fortran/trans-intrinsic.c | 2 |
5 files changed, 32 insertions, 13 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 20e5ae3225c..841c9d4c0d8 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,15 @@ +2008-02-29 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/35059 + * expr.c (find_array_element): Modify traversing the constructor to + avoid trying to access NULL memory pointed to by next for the + last element. (find_array_section): Exit while loop if cons->next is + NULL. + * trans-expr.c (gfc_conv_scalar_char_value): Initialize gfc_typespec. + (gfc_conv_function_call): Same. + * decl.c (gfc_match_implicit): Same. + * trans-intrinsic.c (gfc_conv_intrinsic_sr_kind): Same. + 2008-02-28 Daniel Franke <franke.daniel@gmail.com> PR fortran/31463 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index d8306879d56..892c80a46d3 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -2506,6 +2506,8 @@ gfc_match_implicit (void) int c; match m; + gfc_clear_ts (&ts); + /* We don't allow empty implicit statements. */ if (gfc_match_eos () == MATCH_YES) { diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 0b0fd0936a3..329bc722dba 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1051,18 +1051,19 @@ find_array_element (gfc_constructor *cons, gfc_array_ref *ar, mpz_mul (span, span, tmp); } - if (cons) - { - for (nelemen = mpz_get_ui (offset); nelemen > 0; nelemen--) - { - if (cons->iterator) - { - cons = NULL; - goto depart; - } - cons = cons->next; - } - } + for (nelemen = mpz_get_ui (offset); nelemen > 0; nelemen--) + { + if (cons) + { + if (cons->iterator) + { + cons = NULL; + + goto depart; + } + cons = cons->next; + } + } depart: mpz_clear (delta); @@ -1341,7 +1342,7 @@ find_array_section (gfc_expr *expr, gfc_ref *ref) cons = base; } - while (mpz_cmp (ptr, index) > 0) + while (cons && cons->next && mpz_cmp (ptr, index) > 0) { mpz_add_ui (index, index, one); cons = cons->next; diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index a3484510b55..9b33d378107 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -1275,6 +1275,7 @@ gfc_conv_scalar_char_value (gfc_symbol *sym, gfc_se *se, gfc_expr **expr) if ((*expr)->expr_type == EXPR_CONSTANT) { gfc_typespec ts; + gfc_clear_ts (&ts); *expr = gfc_int_expr ((int)(*expr)->value.character.string[0]); if ((*expr)->ts.kind != gfc_c_int_kind) @@ -2250,6 +2251,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym, stringargs = NULL_TREE; var = NULL_TREE; len = NULL_TREE; + gfc_clear_ts (&ts); if (sym->from_intmod == INTMOD_ISO_C_BINDING) { diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 77bad73d51d..49f2094561f 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -3764,6 +3764,8 @@ gfc_conv_intrinsic_sr_kind (gfc_se *se, gfc_expr *expr) else { gfc_typespec ts; + gfc_clear_ts (&ts); + if (actual->expr->ts.kind != gfc_c_int_kind) { /* The arguments to SELECTED_REAL_KIND are INTEGER(4). */ |

