- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
the following code appears to be valid, but ifort rejects it:
program ifort_sum_param implicit none real, parameter :: a(3) = [ 1., 2., 3. ] real, parameter :: b = sum (a) print *, b end
I get:
% ifort -V ifort-sum.f90 Intel(R) Fortran Compiler XE for applications running on IA-32, Version 15.0.3.187 Build 20150407 Copyright (C) 1985-2015 Intel Corporation. All rights reserved. FOR NON-COMMERCIAL USE ONLY Intel(R) Fortran 15.0-1812 ifort-sum.f90(4): error #6263: This intrinsic function is invalid in constant expressions. [SUM] real, parameter :: b = sum (a) -------------------------^ compilation aborted for ifort-sum.f90 (code 1)
As far as I can tell, and by looking at the F2008 standard, section 7.1.12 (constant expression), there is no exclusion for SUM() to be used here.
The above code is accepted by the GNU and Cray compilers.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It works in the 16.0 beta compiler; we hadn't quite gotten to that one for the 15.0 stream.
--Lorri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This was also discussed in https://software.intel.com/en-us/forums/topic/495001 where a longer list of transformational intrinsics was tested. I exchanged emails with Steve on this topic roughly 2/9/15 but can't recall whether it got a case number or not. Good to see that some of them at least will be fixed in 16.0.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
All of the intrinsic functions that F2003 says are valid in initialization expressions should work in 16.0. We have an open issue on IEEE_SELECTED_REAL_KIND from IEEE_ARITHMETIC, but we're working on that.
![](/skins/images/B7BA37F9CE4B52FF7CAE1FB0388839C8/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page