re PR fortran/33178 (-std=f95: SIGN with integer arguments rejected as initialization expression)

2007-08-24  Tobias Burnus  <burnus@net-b.de>

	PR fortran/33178
	* intrinsic.c (gfc_intrinsic_func_interface): Fix initialization
	expression check.

2007-08-24  Tobias Burnus  <burnus@net-b.de>

	PR fortran/33178
	* gfortran.dg/initialization_4.f90: Update dg-error.
	* gfortran.dg/initialization_13.f90: New.

From-SVN: r127786
This commit is contained in:
Tobias Burnus 2007-08-24 21:26:42 +02:00 committed by Tobias Burnus
parent 3101faab46
commit ef7e861a0f
5 changed files with 29 additions and 7 deletions

View file

@ -1,3 +1,9 @@
2007-08-24 Tobias Burnus <burnus@net-b.de>
PR fortran/33178
* intrinsic.c (gfc_intrinsic_func_interface): Fix initialization
expression check.
2007-08-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/32972

View file

@ -3409,12 +3409,10 @@ got_specific:
(4) A reference to an elemental standard intrinsic function,
where each argument is an initialization expression */
if (gfc_init_expr
&& isym->elemental
&& (expr->ts.type != BT_INTEGER || expr->ts.type != BT_CHARACTER)
&& gfc_notify_std (GFC_STD_F2003, "Extension: Evaluation of "
"nonstandard initialization expression at %L",
&expr->where) == FAILURE)
if (gfc_init_expr && isym->elemental && flag
&& gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Elemental function "
"as initialization expression with non-integer/non-"
"character arguments at %L", &expr->where) == FAILURE)
return MATCH_ERROR;
return MATCH_YES;

View file

@ -1,3 +1,9 @@
2007-08-24 Tobias Burnus <burnus@net-b.de>
PR fortran/33178
* gfortran.dg/initialization_4.f90: Update dg-error.
* gfortran.dg/initialization_13.f90: New.
2007-08-24 Richard Guenther <rguenther@suse.de>
PR middle-end/33166

View file

@ -0,0 +1,12 @@
! { dg-do compile }
! { dg-options "-std=f95" }
!
! PR fortran/33178
!
! Initialization expressions:
! Fortran 95: Elemental functions w/ integer/character arguments
! Fortran 2003: restriction lifted
!
integer :: a = sign(1,1) ! Ok F95
real :: b = sign(1.,1.) ! { dg-error "Fortran 2003: Elemental function as initialization expression" }
end

View file

@ -2,6 +2,6 @@
! initialization expression, even if -std=f95 was used
! { dg-do compile }
! { dg-options "-std=f95" }
real, parameter :: pi = 4.0*Atan(1.0) ! { dg-error "Evaluation of nonstandard initialization expression" }
real, parameter :: pi = 4.0*Atan(1.0) ! { dg-error "Fortran 2003: Elemental function as initialization expression" }
real, parameter :: three = 27.0**(1.0/3.0) ! { dg-error "Noninteger exponent in an initialization expression" }
end