Problem with array constructor

Hello all,

I have come across a problem with array constructors. The following code does not compile correctly in my opinion:

program main
integer :: n(2,1)
n(:,1) = (/ 2,2 /)
write(,) ( sum( (/ (n(l,i),l=1,2) /) ),i=1,1)
write(,) (/ ( sum( (/ (n(l,i),l=1,2) /) ),i=1,1) /)
j = maxval((/ ( sum( (/ (n(l,i),l=1,2) /) ),i=1,1) /))
write(,) j
end

It should write
4
4
4
but it writes
4
0
0
I think the “0” here is, in fact, undefined.

Thank you.

Best
cfried

We have replicated this issue and we have assigned it TPR 23745.

I do not have a workaround, as even -O0 fails.

thanks,
dave

I don’t have much knowledge in this, though it seems to be a mistake in the following code:

n(:,1) = (/ 2,2 /)

Did you check it?

I will be available at custom academic dissertations help. You can feel free to contact whenever I’m not available here.

I’m sure that the above mentioned code must be changed. Do not hesitate to share if I’m wrong with it.

% more test.f90
program main
integer :: n(2,1)
n(:,1) = (/ 2,2 /)
print , “N=”,n
write(
,) ( sum( (/ (n(l,i),l=1,2) /) ),i=1,1)
write(
,) (/ ( sum( (/ (n(l,i),l=1,2) /) ),i=1,1) /)
j = maxval((/ ( sum( (/ (n(l,i),l=1,2) /) ),i=1,1) /))
write(
,*) j
end

% pgf90 -o test test.f90
% test
N= 2 2
4
0
0


looks like the array assignment was correct, but the other lines failed.

Dear all,

I just wanted to inform myself if this bug has been worked upon yet. According to the Technical Problem Reports of the recent release, this is not the case.

It actually looks like a serious bug. Array constructors were introduced already in Fortran 90. On the other hand, it does not look difficult to debug, and the testcase is very simple.

Thank you.

Best wishes
Christoph

Christoph,

TPR 23745 has not been fixed in the 17.4 release. That does not mean no progress has been made, nor does it mean we don’t see it as
important.

If we believe we have corrected the problem, it will be after a large number of tests pass, and the fix has not affected the many areas compilation affects.

dave

Dear all,

it is nearly two years now. Any news about TPR 23745?

Best wishes
Christoph