[Patch, fortran] [1/5] PR 45648: Inline transpose part 2: Support transposed descriptor whilst getting array bounds

Tobias Burnus burnus@net-b.de
Tue Sep 21 15:04:00 GMT 2010


  On 09/21/2010 04:46 PM, Paul Richard Thomas wrote:
> The loop takes dim from 0 to ndim-1.  Therefore the condition of the
> gcc_assert is always going to be satisfied.

I disagree. The assert triggers

a) If ndim < 1 (and the loop is never entered)

b) If one does not have an early exit - as Daniel pointed out:

#include <stdio.h>
main () {
  int i;
  for (i = 0; i < 5; i++)
    ;
  printf("%d\n", i);
  return 0;
}

Running the program prints "5".

Tobias

> On 9/21/10, Daniel Kraft<d@domob.eu>  wrote:
>> Paul Richard Thomas wrote:
>>> +	  for (dim = 0; dim<  ndim; dim++)
>>> +	    if (info->dim[dim] == n)
>>> +	      break;
>>> +	  gcc_assert (dim<  ndim);
>> This seems like checking the loop is exited early in any case.  (But
>> I've no idea about the rest of the patch.)



More information about the Fortran mailing list