- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This little snippet:
[fortran]PROGRAM RealParametersLeftOutInTheCold IMPLICIT NONE REAL, PARAMETER :: my_list_of_useful_numbers(1) = [ 4 * ATAN(1.0) ] !**** PRINT *, my_list_of_useful_numbers END PROGRAM RealParametersLeftOutInTheCold [/fortran]causes 12.0.4 with relevant options to whine:
[plain]>ifort /check:all /warn:all /stand:f03 RealParametersLeftOutInTheCold.f90 Intel Visual Fortran Compiler XE for applications running on IA-32, Version 12.0.4.196 Build 20110427 Copyright (C) 1985-2011 Intel Corporation. All rights reserved. RealParametersLeftOutInTheCold.f90(3): warning #6009: Fortran 2003 specifies th at an elemental intrinsic function here be of type integer or character and each argument must be an initialization expr of type integer or character . [ATAN] REAL, PARAMETER :: my_list_of_useful_numbers(1) = [ 4 * ATAN(1.0) ] ----------------------------------------------------------^ ...[/plain]but I don't think Fortran 2003 specifies any such thing.
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This appears to be a Fortran 2003 feature that is only partially implemented.
The IFort-12 documentation (search for "constant expression" and choose the first find, "initialization expressions") lists the restriction that terms in the initialization expression be integers, characters, and intrinsic functions returning these types of constants.
The IFort-12 documentation (search for "constant expression" and choose the first find, "initialization expressions") lists the restriction that terms in the initialization expression be integers, characters, and intrinsic functions returning these types of constants.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had thought that ATAN was already supported there, but I will check.
The standards errors can sometimes be misleading - there is a check for non-standard features, and then it uses the "level" you specified in the option in the message. If the check has not been updated to reflect the current standard, it can give results such as this.
The standards errors can sometimes be misleading - there is a check for non-standard features, and then it uses the "level" you specified in the option in the message. If the check has not been updated to reflect the current standard, it can give results such as this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The compiler support for real's in constant-expressions seems ok - it is just the warning that is faulty.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry I cannot try this here (yet)
PROGRAMRealParametersLeftOutInTheCold
USE IFPORT
IMPLICITNONE
REAL,PARAMETER::my_list_of_useful_numbers(1)=[4.0*ATAN(1.0)]
Or
PROGRAMRealParametersLeftOutInTheCold
USE IFPORT
IMPLICITNONE
REAL,PARAMETER::atan_one=ATAN(1.0)
REAL,PARAMETER::my_list_of_useful_numbers(1)=[4.0*atan_one]
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The only problem here is the faulty standards warning. The compiler still accepts the expression.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page