aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@netcologne.de>2015-06-04 18:55:29 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2015-06-04 18:55:29 +0000
commit172f0ce5ab5fa74a5695cf855c9ba7c4e98c754a (patch)
treea0495acfb0cbb7d3ee7d28f41f79a808937a429f
parentecb9f2236c92410b0517c8ab9906c5e007f24570 (diff)
downloadgcc-172f0ce5ab5fa74a5695cf855c9ba7c4e98c754a.zip
gcc-172f0ce5ab5fa74a5695cf855c9ba7c4e98c754a.tar.gz
gcc-172f0ce5ab5fa74a5695cf855c9ba7c4e98c754a.tar.bz2
re PR fortran/58749 (PACK(ADJUSTL([" a"," b"]), [.TRUE.,.FALSE.]) causes an internal compiler error)
2015-06-04 Thomas Koenig <tkoenig@netcologne.de> PR fortran/58749 * iresolve.c (gfc_resolve_adjustl): If string has a charlen, copy it to the function. (gfc_resolve_adjustr): Likewise. 2015-06-04 Thomas Koenig <tkoenig@netcologne.de> PR fortran/58749 * gfortran.dg/adjustl_1.f90: New test. From-SVN: r224137
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/iresolve.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/adjustl_1.f908
4 files changed, 26 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 33cdf8f..b446e90 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2015-06-04 Thomas Koenig <tkoenig@netcologne.de>
+
+ PR fortran/58749
+ * iresolve.c (gfc_resolve_adjustl): If string has a charlen,
+ copy it to the function.
+ (gfc_resolve_adjustr): Likewise.
+
2015-06-04 Andrew MacLeod <amacleod@redhat.com>
* convert.c: Adjust includes for restructured coretypes.h.
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index 735dcc7..b6b0fc1 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -215,6 +215,9 @@ gfc_resolve_adjustl (gfc_expr *f, gfc_expr *string)
{
f->ts.type = BT_CHARACTER;
f->ts.kind = string->ts.kind;
+ if (string->ts.u.cl)
+ f->ts.u.cl = gfc_new_charlen (gfc_current_ns, string->ts.u.cl);
+
f->value.function.name = gfc_get_string ("__adjustl_s%d", f->ts.kind);
}
@@ -224,6 +227,9 @@ gfc_resolve_adjustr (gfc_expr *f, gfc_expr *string)
{
f->ts.type = BT_CHARACTER;
f->ts.kind = string->ts.kind;
+ if (string->ts.u.cl)
+ f->ts.u.cl = gfc_new_charlen (gfc_current_ns, string->ts.u.cl);
+
f->value.function.name = gfc_get_string ("__adjustr_s%d", f->ts.kind);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a64729a..4b35e72 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-04 Thomas Koenig <tkoenig@netcologne.de>
+
+ PR fortran/58749
+ * gfortran.dg/adjustl_1.f90: New test.
+
2015-06-04 Jan Hubicka <hubicka@ucw.cz>
* gcc.dg/lto/c-compatible-types_0.c: New testcase.
diff --git a/gcc/testsuite/gfortran.dg/adjustl_1.f90 b/gcc/testsuite/gfortran.dg/adjustl_1.f90
new file mode 100644
index 0000000..1238da8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/adjustl_1.f90
@@ -0,0 +1,8 @@
+! { dg-do run }
+! PR 52749 - this used to ICE.
+! Original test case by Stefan Mauerberger.
+PROGRAM test
+ character(len=10) :: u
+ WRITE(unit=u,fmt='(3A)') PACK(ADJUSTL([" a", " b"]), [.TRUE., .FALSE.])
+ if (u .ne. 'a ') call abort
+END PROGRAM test