------- Comment #2 from burnus at gcc dot gnu dot org 2008-03-25 16:37 ------- Failing is: XCA(NF1:NF10:MF1) = XDA(NF1:NF2:MF3) !fails that is: XCA(1:10:-1) = XDA(1:2:-3)
The problem is that (1:2:-3) is not regarded as empty range but as containing one element: size(XDA(1:2:-3)) prints "1" and also -fbounds-check gives an error. In the source, the problem is: D.963 = (nf2-nf1)/mf3 ! This is: (2-1)/-3 = 0 S.1 = 0; while (1) { if (S.1 > D.963) goto L.3; // xca[...] = xda[...] assignment The assignment is executed once as "S.1 > D.963" is initially "0 > 0". Note: Ensure that the patch also fixes -fbounds-check. Related program, which also fails (I thought we fixed this; this seems to be a libgfortran problem): integer xda(20) integer, volatile :: n n = 1 print *, size(XDA(n:2:-3)) ! should print 0, prints 1 END -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |wrong-code Last reconfirmed|0000-00-00 00:00:00 |2008-03-25 16:37:47 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35682