- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
cd1, cdo and cd2 are array with 2 elements. while i want to assign cd2 by
cd2 = cdo - cd1
cd2 got an empty value as the video shows, it means I even can't write the value, when I run
write(*,*)cd2
It will be empty.
However
If i run
do i=1,2
cd2(i) = cdo(i) - cd1(i)
enddo
It works fine.
The compiler is
Intel® Fortran Compiler Classic for applications running on Intel(R) 64, version 2021.9.0 Package ID: w_oneAPI_2023.1.0.46319
and the CPU is Ryzen 9 6900.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I checked the above code, i find I assign a array of shape of 3 to a array of shape of 2. This operation leaded to the failure.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well the video doesn't show it has being empty it has very small values. We cannot tell what the result should be from the video as far as I can tell. That array operation is so basic to Fortran code the 100's of us on this site would be all screaming about it if that didn't work! So we can only assuming you are interpreting things incorrectly or that something bizarre is happing. I would suggest on the line before setting cd2 =0.0 and run your debug case again to see if things are clearer. Do you have any level of optimisation on? That is not good with debug builds. Another cause could be memory corruption due to some faulty code elsewhere in the program. We would normally say make a small complete test program that shows the problem but I would bet big money that you won't be able to replicate the problem in the small code or that you see the problem cause during doing it. We all suffer 'code blindness' from time to time where we are looking so hard we do not see the obvious problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I checked the above code, i find I assign a array of shape of 3 to a array of shape of 2. This operation leaded to the failure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page