From 22aef73f17b09c1805aee5bb4a64f1e012bec49d Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Sun, 6 May 2007 22:56:52 +0000 Subject: [PATCH] re PR fortran/31764 (NEW_LINE with array argument) PR fortran/31764 * simplify.c (gfc_simplify_new_line): NEW_LINE can be simplified even for non constant arguments. * gfortran.dg/new_line.f90: Add new checks. From-SVN: r124482 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/simplify.c | 5 ----- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/new_line.f90 | 17 +++++++++++++++-- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8d15bf2dcb7..04220ab80a2 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2007-05-07 Francois-Xavier Coudert + + PR fortran/31764 + * simplify.c (gfc_simplify_new_line): NEW_LINE can be simplified + even for non constant arguments. + 2007-05-06 Jerry DeLisle Francois-Xavier Coudert diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 9df2e812c1d..ed62ee34da4 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -2641,13 +2641,8 @@ gfc_simplify_new_line (gfc_expr *e) { gfc_expr *result; - if (e->expr_type != EXPR_CONSTANT) - return NULL; - result = gfc_constant_result (BT_CHARACTER, e->ts.kind, &e->where); - result->value.character.string = gfc_getmem (2); - result->value.character.length = 1; result->value.character.string[0] = '\n'; result->value.character.string[1] = '\0'; /* For debugger */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 36cec0d7f32..da85bb5cf46 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-05-07 Francois-Xavier Coudert + + PR fortran/31764 + * gfortran.dg/new_line.f90: Add new checks. + 2007-05-06 Jerry DeLisle PR fortran/31201 diff --git a/gcc/testsuite/gfortran.dg/new_line.f90 b/gcc/testsuite/gfortran.dg/new_line.f90 index 355ca30209b..aacabc69f6e 100644 --- a/gcc/testsuite/gfortran.dg/new_line.f90 +++ b/gcc/testsuite/gfortran.dg/new_line.f90 @@ -2,6 +2,19 @@ ! Checks Fortran 2003's new_line intrinsic function ! PR fortran/28585 program new_line_check - implicit none - if(achar(10) /= new_line('a')) call abort() + implicit none + character(len=10) :: a1 + character(len=10) :: a2(2) + character(len=10), parameter :: a3 = "1234567890" + character(len=10), parameter :: a4(2) = "1234567890" + character(len=10), parameter :: a5(2) = repeat("1234567890",2) + + if(achar(10) /= new_line('a')) call abort + + if (iachar(new_line(a1)) /= 10) call abort + if (iachar(new_line(a2)) /= 10) call abort + if (iachar(new_line(a3)) /= 10) call abort + if (iachar(new_line(a4)) /= 10) call abort + if (iachar(new_line(a5)) /= 10) call abort + end program new_line_check