diff options
author | dfranke <dfranke@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-22 22:18:28 +0000 |
---|---|---|
committer | dfranke <dfranke@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-22 22:18:28 +0000 |
commit | 2b37ae69226134385e44103d922fe050a43b64bb (patch) | |
tree | ccbe60c206a371af87a720afe69089d642dff136 /gcc | |
parent | d618d2f45b791a5c2d909eb8a0ac281ed43bafe3 (diff) | |
download | gcc-2b37ae69226134385e44103d922fe050a43b64bb.tar.gz |
gcc/fortran:
2007-12-22 Daniel Franke <franke.daniel@gmail.com>
PR fortran/34559
* simplify.c (gfc_simplify_repeat): Added safeguard for empty string
literals.
gcc/testsuite:
2007-12-22 Daniel Franke <franke.daniel@gmail.com>
PR fortran/34559
* gfortran.dg/repeat_6.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131139 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/simplify.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/repeat_6.f90 | 13 |
4 files changed, 28 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a5bf542ac1f..79c23de1090 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2007-12-22 Daniel Franke <franke.daniel@gmail.com> + + PR fortran/34559 + * simplify.c (gfc_simplify_repeat): Added safeguard for empty + string literals. + 2007-12-22 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/34549 @@ -26,6 +32,7 @@ * module.c (read_module): Check sym->module is there before using it in a string comparison. +>>>>>>> .r131138 2007-12-20 Tobias Burnus <burnus@net-b.de> PR fortran/34482 diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index be0b18f89ff..1641586457e 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -3128,7 +3128,9 @@ gfc_simplify_repeat (gfc_expr *e, gfc_expr *n) if (e->expr_type != EXPR_CONSTANT) return NULL; - if (len || mpz_sgn (e->ts.cl->length->value.integer) != 0) + if (len || + (e->ts.cl->length && + mpz_sgn (e->ts.cl->length->value.integer)) != 0) { const char *res = gfc_extract_int (n, &ncop); gcc_assert (res == NULL); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f079ae640ad..a6816d48bc0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-12-22 Daniel Franke <franke.daniel@gmail.com> + + PR fortran/34559 + * gfortran.dg/repeat_6.f90: New test. + 2007-12-22 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/34549 diff --git a/gcc/testsuite/gfortran.dg/repeat_6.f90 b/gcc/testsuite/gfortran.dg/repeat_6.f90 new file mode 100644 index 00000000000..308941f9a2d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/repeat_6.f90 @@ -0,0 +1,13 @@ +! { dg-do run } +! +! PR34559 -- ICE on empty string literals +! +! Contributed by Tobias Burnus <burnus@gcc.gnu.org> +! + + character(len=200) :: string = "a" // repeat ("", 3) & + // repeat ("xxx", 0) & + // repeat ("string", 2) + + if (string /= "astringstring") CALL abort() +end |