public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/25095] Disallowed intrinsic in initialization statement
       [not found] <bug-25095-4@http.gcc.gnu.org/bugzilla/>
@ 2023-08-22 19:29 ` anlauf at gcc dot gnu.org
  2023-08-26 17:00 ` anlauf at gcc dot gnu.org
  1 sibling, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-08-22 19:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25095

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #8 from anlauf at gcc dot gnu.org ---
(In reply to Jürgen Reuter from comment #7)
> Indeed, ifort and PGI fortran flag this as an error in the implied DO
> expression. Nagfor flags it just as an extension.

Actually, current nagfor flags it as:

% nagfor pr25095.f90 -f2003
NAG Fortran Compiler Release 7.1(Hanzomon) Build 7101
Extension(F2008): pr25095.f90, line 2: Function reference in DATA-implied-DO
[NAG Fortran Compiler normal termination, 1 warning]

and is silent for -f2008 or -f2018 .

The F2018 (and similarly F2008) text is slightly clearer here:

! C881 (R841) In an array-element or scalar-structure-component that is a
! data-i-do-object, any subscript shall be a constant expression, and any
! primary within that subscript that is a data-i-do-variable shall be a
! DO variable of this data-implied-do or of a containing data-implied-do.

and then

! 10.1.12 Constant expression
!
! (5) a reference to an elemental standard intrinsic function, where each
! argument is a constant expression,
!
! (11) a data-i-do-variable within a data-implied-do,
!
! and Note 1

and among the standard intrinsic procedures:

! 16.9.136 MODULO (A, P)

So this is more likely an ifort and PGI/Nvidia bug on the one hand, and
on the other the question whether we care for a diagnostic for -std=f95 .

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/25095] Disallowed intrinsic in initialization statement
       [not found] <bug-25095-4@http.gcc.gnu.org/bugzilla/>
  2023-08-22 19:29 ` [Bug fortran/25095] Disallowed intrinsic in initialization statement anlauf at gcc dot gnu.org
@ 2023-08-26 17:00 ` anlauf at gcc dot gnu.org
  1 sibling, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-08-26 17:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25095

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P5
           Severity|normal                      |enhancement
           Keywords|accepts-invalid             |diagnostic

--- Comment #9 from anlauf at gcc dot gnu.org ---
Intel will fix their compiler to accept the code:

https://community.intel.com/t5/Intel-Fortran-Compiler/Data-implied-do-rejected-for-non-trivial-subscript-expression/m-p/1517334#M167869

The code in comment#0 is valid since at least F2008, maybe F2003, and only
clearly invalid in F95.

I suggest to close this PR, possibly as WONTFIX, unless someone really wants
to implement a (IMHO) warning of little practical importance as of today.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/25095] Disallowed intrinsic in initialization statement
  2005-11-26 18:06 [Bug fortran/25095] New: better diagnostic needed jv244 at cam dot ac dot uk
                   ` (4 preceding siblings ...)
  2007-10-07 19:49 ` tobi at gcc dot gnu dot org
@ 2008-01-04 11:08 ` dfranke at gcc dot gnu dot org
  5 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-01-04 11:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dfranke at gcc dot gnu dot org  2008-01-04 10:10 -------
*** Bug 34664 has been marked as a duplicate of this bug. ***


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25095


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/25095] Disallowed intrinsic in initialization statement
  2005-11-26 18:06 [Bug fortran/25095] New: better diagnostic needed jv244 at cam dot ac dot uk
                   ` (3 preceding siblings ...)
  2007-10-07 19:43 ` tobi at gcc dot gnu dot org
@ 2007-10-07 19:49 ` tobi at gcc dot gnu dot org
  2008-01-04 11:08 ` dfranke at gcc dot gnu dot org
  5 siblings, 0 replies; 8+ messages in thread
From: tobi at gcc dot gnu dot org @ 2007-10-07 19:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from tobi at gcc dot gnu dot org  2007-10-07 19:49 -------
(In reply to comment #4)
> E.g. the following is legal:

iff PRECISION(X) <= 350 :-)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25095


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/25095] Disallowed intrinsic in initialization statement
  2005-11-26 18:06 [Bug fortran/25095] New: better diagnostic needed jv244 at cam dot ac dot uk
                   ` (2 preceding siblings ...)
  2007-05-21 19:07 ` dfranke at gcc dot gnu dot org
@ 2007-10-07 19:43 ` tobi at gcc dot gnu dot org
  2007-10-07 19:49 ` tobi at gcc dot gnu dot org
  2008-01-04 11:08 ` dfranke at gcc dot gnu dot org
  5 siblings, 0 replies; 8+ messages in thread
From: tobi at gcc dot gnu dot org @ 2007-10-07 19:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from tobi at gcc dot gnu dot org  2007-10-07 19:43 -------
E.g. the following is legal:
   INTEGER :: I(350)
   INTEGER, PARAMETER :: K(500) = (/ i, i=1,500 /)
   REAL :: X
   DATA I(4+K(PRECISION(X))) / 1 /
whereas
   DATA I(PRECISION(X)) / 1 /
isn't.


-- 

tobi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tobi at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25095


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/25095] Disallowed intrinsic in initialization statement
  2005-11-26 18:06 [Bug fortran/25095] New: better diagnostic needed jv244 at cam dot ac dot uk
  2006-06-04  9:52 ` [Bug fortran/25095] Disallowed intrinsic in initialization statement fxcoudert at gcc dot gnu dot org
  2006-06-04 10:43 ` jv244 at cam dot ac dot uk
@ 2007-05-21 19:07 ` dfranke at gcc dot gnu dot org
  2007-10-07 19:43 ` tobi at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-05-21 19:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dfranke at gcc dot gnu dot org  2007-05-21 20:07 -------
Confirmed by majority vote.

$> ifort -warn all pr25095.f90
fortcom: Error: pr25095.f90, line 2: This expression cannot be evaluated.  
[MODULO]
DATA (i(MODULO(j,5)),j=1,4) /4*0/
--------^
fortcom: Info: pr25095.f90, line 1: This variable has not been used.   [I]
INTEGER :: i(10), j
-----------^
compilation aborted for pr25095.f90 (code 1)


$> sunf95 -w4 pr25095.f90

DATA (i(MODULO(j,5)),j=1,4) /4*0/
        ^
"pr25095.f90", Line = 2, Column = 9: ERROR: This function name must not appear
in a DATA statement expression.

f90comp: 3 SOURCE LINES
f90comp: 1 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 0 ANSI


$> gfortran-svn -v
gcc version 4.3.0 20070517 (experimental)

still accepts this code.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-05-21 20:07:27
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25095


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/25095] Disallowed intrinsic in initialization statement
  2005-11-26 18:06 [Bug fortran/25095] New: better diagnostic needed jv244 at cam dot ac dot uk
  2006-06-04  9:52 ` [Bug fortran/25095] Disallowed intrinsic in initialization statement fxcoudert at gcc dot gnu dot org
@ 2006-06-04 10:43 ` jv244 at cam dot ac dot uk
  2007-05-21 19:07 ` dfranke at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: jv244 at cam dot ac dot uk @ 2006-06-04 10:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jv244 at cam dot ac dot uk  2006-06-04 10:42 -------
(In reply to comment #1)
> .. and
> each operation shall be intrinsic

> Now, MODULO is found under 13.5 (Standard generic intrinsic procedures) 

But MODULO is not an intrinsic operation (these are defined in 7.1.2)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25095


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/25095] Disallowed intrinsic in initialization statement
  2005-11-26 18:06 [Bug fortran/25095] New: better diagnostic needed jv244 at cam dot ac dot uk
@ 2006-06-04  9:52 ` fxcoudert at gcc dot gnu dot org
  2006-06-04 10:43 ` jv244 at cam dot ac dot uk
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-06-04  9:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2006-06-04 09:52 -------
By F2003: "C561 (R528) In an array-element or a scalar-structure-component that
is a data-i-do-object , any subscript shall be an expression whose primaries
are either constants, subobjects of constants, or 
DO variables  of this data-implied-do or the containing data-implied-dos, and
each operation shall be intrinsic."

Now, MODULO is found under 13.5 (Standard generic intrinsic procedures) so, by
my reading of the standard, this is allowed. And the F95 standard seems to have
exactly the same wording.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
           Keywords|                            |accepts-invalid


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25095


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-08-26 17:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-25095-4@http.gcc.gnu.org/bugzilla/>
2023-08-22 19:29 ` [Bug fortran/25095] Disallowed intrinsic in initialization statement anlauf at gcc dot gnu.org
2023-08-26 17:00 ` anlauf at gcc dot gnu.org
2005-11-26 18:06 [Bug fortran/25095] New: better diagnostic needed jv244 at cam dot ac dot uk
2006-06-04  9:52 ` [Bug fortran/25095] Disallowed intrinsic in initialization statement fxcoudert at gcc dot gnu dot org
2006-06-04 10:43 ` jv244 at cam dot ac dot uk
2007-05-21 19:07 ` dfranke at gcc dot gnu dot org
2007-10-07 19:43 ` tobi at gcc dot gnu dot org
2007-10-07 19:49 ` tobi at gcc dot gnu dot org
2008-01-04 11:08 ` dfranke at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).