Commit 22aef73f by Francois-Xavier Coudert Committed by François-Xavier Coudert

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
parent 28fe1c40
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>
......
......@@ -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 */
......
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
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment