------- Comment #4 from mikael dot morin at tele2 dot fr 2008-10-23 14:37 ------- (In reply to comment #3) > I am not 100% sure that the following is due to the patch in comment #1, There is already something wrong on trunk, but I agree that the patch makes it worse. As a side note I'm really impressed by how fast you found a not-working case to my slowly and laboriously prepared code.
I've been playing a bit with the testcase on trunk. This: write(*,*) foo([1]+i) produces this code fragment: integer(kind=8) A.4[2]; struct array1_integer(kind=8) atmp.3; atmp.3.dtype = 521; atmp.3.dim[0].stride = 1; atmp.3.dim[0].lbound = 0; atmp.3.dim[0].ubound = 1; atmp.3.data = (void *) &A.4; atmp.3.offset = 0; while this: write(*,*) foo(i+[1]) produces this code fragment: integer(kind=8) A.4[1]; struct array1_integer(kind=8) atmp.3; atmp.3.dtype = 521; atmp.3.dim[0].stride = 1; atmp.3.dim[0].lbound = 0; atmp.3.dim[0].ubound = 0; atmp.3.data = (void *) &A.4; atmp.3.offset = 0; As you can see, the first case's array temporary has a size of 2, while it should be of size 1. The code however is correct as only the first element of the array is used. With the patch, it is... wrong. To be continued. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36091