[J3] [EXTERNAL] [BULK] Is this conforming?

Robert Corbett rpcorbett at att.net
Wed Jun 4 05:02:20 UTC 2025


 Tom's reply is correct.
To amplify Tom's response, paragraph 2of subclause 10.1.4 states
      if a function reference causes      definition or undefinition of      an actual argument of the      function, that argument or any      associated entities shall not      appear elsewhere in the same      statement.
The actual argument i1 appears threetimes in the assignment statement.
If the two references of the functionnewLB are replaced by scalar integervariables set to the values of thefunction references in separateassignment statements preceding theassignment statement shown in yourexample and the segfaults are stillsignaled, there is a good chance thatthe implementation is not conformant.
Bob Corbett
    On Tuesday, June 3, 2025 at 12:07:58 PM PDT, Clune, Thomas L. (GSFC-6101) via J3 <j3 at mailman.j3-fortran.org> wrote:  
 
 <!--#yiv6747094867 filtered {}#yiv6747094867 filtered {}#yiv6747094867 filtered {}#yiv6747094867 filtered {}#yiv6747094867 filtered {}#yiv6747094867 p.yiv6747094867MsoNormal, #yiv6747094867 li.yiv6747094867MsoNormal, #yiv6747094867 div.yiv6747094867MsoNormal {margin:0in;font-size:10.0pt;font-family:"Aptos", sans-serif;}#yiv6747094867 p.yiv6747094867MsoListParagraph, #yiv6747094867 li.yiv6747094867MsoListParagraph, #yiv6747094867 div.yiv6747094867MsoListParagraph {margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.5in;font-size:10.0pt;font-family:"Aptos", sans-serif;}#yiv6747094867 span.yiv6747094867EmailStyle19 {font-family:"Aptos", sans-serif;color:windowtext;}#yiv6747094867 .yiv6747094867MsoChpDefault {font-size:10.0pt;}#yiv6747094867 filtered {}#yiv6747094867 div.yiv6747094867WordSection1 {}#yiv6747094867 filtered {}#yiv6747094867 filtered {}#yiv6747094867 filtered {}#yiv6747094867 filtered {}#yiv6747094867 filtered {}#yiv6747094867 filtered {}#yiv6747094867 filtered {}#yiv6747094867 filtered {}#yiv6747094867 filtered {}#yiv6747094867 filtered {}#yiv6747094867 ol {margin-bottom:0in;}#yiv6747094867 ul {margin-bottom:0in;}-->
Hi Daniel,
 
  
 
Your LHS is a slice of i1, but i1 has not been allocated yet …
 
  
    
   - Tom
 
  
 
| 

  | 

  | 
Thomas Clune
 
Lead, Software Infrastructure
 
Global Modeling and Assimilation Office
 
NASA Goddard Space Flight Center
 
MS 610.1
 
8800 Greenbelt RD, Greenbelt, MD 20771
 
Thomas.L.Clune at nasa.gov
  |


  
 
  
 
From: J3 <j3-bounces at mailman.j3-fortran.org> on behalf of Daniel Chen via J3 <j3 at mailman.j3-fortran.org>
Date: Tuesday, June 3, 2025 at 3:02 PM
To: General J3 interest list <j3 at mailman.j3-fortran.org>
Cc: Daniel Chen <cdchen at ca.ibm.com>
Subject: [EXTERNAL] [BULK] [J3] Is this conforming?
 
| 
CAUTION:This email originated from outside of NASA.  Please take care when clicking links or opening attachments.  Use the "Report Message" button to report suspicious messages to the NASA SOC.
  |





 
Hello,

Is the following code conforming?

```
module m
 
    contains
 
 
 
    integer function newLB (i1)
 
        integer, allocatable :: i1(:)
 
 
 
        allocatable newLB
 
 
 
        i1 = [(i, i=1,5)]
 
 
 
        newLB = ubound(i1,1) -2
 
    end function
 
end module
 
 
 
use m
 
    integer, allocatable :: i1(:)
 
 
 
    i1(newLB(i1): newLB(i1)+2) = [1,2,3]
 
end
```

It seems OK to me as the standard requires the evaluation of all the `expr` within the `variable` to be done before any part of the `variable` is defined. But most of the compilers that I have access to segfault on this.

Thanks,
Daniel
   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20250604/1c001e1b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 25179 bytes
Desc: not available
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20250604/1c001e1b/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 275 bytes
Desc: not available
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20250604/1c001e1b/attachment-0001.png>


More information about the J3 mailing list