Commit ef7e861a by Tobias Burnus Committed by Tobias Burnus

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
parent 3101faab
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> 2007-08-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/32972 PR fortran/32972
......
...@@ -3409,12 +3409,10 @@ got_specific: ...@@ -3409,12 +3409,10 @@ got_specific:
(4) A reference to an elemental standard intrinsic function, (4) A reference to an elemental standard intrinsic function,
where each argument is an initialization expression */ where each argument is an initialization expression */
if (gfc_init_expr if (gfc_init_expr && isym->elemental && flag
&& isym->elemental && gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Elemental function "
&& (expr->ts.type != BT_INTEGER || expr->ts.type != BT_CHARACTER) "as initialization expression with non-integer/non-"
&& gfc_notify_std (GFC_STD_F2003, "Extension: Evaluation of " "character arguments at %L", &expr->where) == FAILURE)
"nonstandard initialization expression at %L",
&expr->where) == FAILURE)
return MATCH_ERROR; return MATCH_ERROR;
return MATCH_YES; return MATCH_YES;
......
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> 2007-08-24 Richard Guenther <rguenther@suse.de>
PR middle-end/33166 PR middle-end/33166
! { 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
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
! initialization expression, even if -std=f95 was used ! initialization expression, even if -std=f95 was used
! { dg-do compile } ! { dg-do compile }
! { dg-options "-std=f95" } ! { 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" } real, parameter :: three = 27.0**(1.0/3.0) ! { dg-error "Noninteger exponent in an initialization expression" }
end end
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