------- Additional Comments From coudert at clipper dot ens dot fr  2005-01-06 
21:52 -------
Playing with this test case to produce a minimal example, I found lots of
differents sources that crash at runtime, for different levels of optimization
(some at 1 and 2 but not 0 and 3, some only for 0, etc). The following code may
be the easiest to debug:

program intrinsic_transpose
   integer, dimension (3, 3) :: b
   complex(kind=4), dimension (2, 2) :: e

   b = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
   e = reshape ((/(1.0,2.0), (3.0, 4.0), (5.0, 6.0), (7.0, 8.0)/), (/2, 2/))
   e = transpose (e);
end program


This ones crashes with -O0 and -O1, but not -O2. Typical of a memory corruption
problem, if you remove the 'b = ...' line (or if the compiler removes it for
you, as I guess is done for -O2), the problem disappears. I can reproduce it on
solaris2.8 too (but not for -O0, though... how I hate memory corruption!)

GDB backtrace is still the same:
Starting program: /users/01/chimie/coudert/tmp/a.out 

Program received signal SIGSEGV, Segmentation fault.
*_gfortran_transpose_8 (ret=Variable "ret" is not available.
)
    at ../../../gcc/libgfortran/generated/transpose_i8.c:81
81      ../../../gcc/libgfortran/generated/transpose_i8.c: No such file or
directory.
        in ../../../gcc/libgfortran/generated/transpose_i8.c

As optimiztion is not in cause any more, I guess looking at flags will be no
use. I don't know if gdb is to be believed, but the code around line 81 in
transpose_i8.c is:

  rptr = ret->data;
  sptr = source->data;

  for (y=0; y < ycount; y++)
    {
      for (x=0; x < xcount; x++)
        {
          *rptr = *sptr; /* This is line 81 */

          sptr += sxstride;
          rptr += rystride;
        }
        sptr += systride - (sxstride * xcount);
        rptr += rxstride - (rystride * xcount);
    }

Looks like it could be that. I'll be running a modified version of the library
to determine if it's at that point later tonight. As I have absolutely no
knowledge about compilers, please feel free to help!

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|intrinsic_transpose.f90     |intrinsic_transpose.f90
                   |runtime crash at -O1        |runtime crash


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19294

Reply via email to