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
This commit is contained in:
Francois-Xavier Coudert 2007-05-06 22:56:52 +00:00 committed by François-Xavier Coudert
parent 28fe1c4032
commit 22aef73f17
4 changed files with 26 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2007-05-07 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/31764
* simplify.c (gfc_simplify_new_line): NEW_LINE can be simplified
even for non constant arguments.
2007-05-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>

View File

@ -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 */

View File

@ -1,3 +1,8 @@
2007-05-07 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/31764
* gfortran.dg/new_line.f90: Add new checks.
2007-05-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/31201

View File

@ -3,5 +3,18 @@
! PR fortran/28585
program new_line_check
implicit none
if(achar(10) /= new_line('a')) call abort()
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