This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/31994] conjg(transpose(a)) produces wrong answer.



------- Comment #5 from fxcoudert at gcc dot gnu dot org  2007-05-20 15:40 -------
For some reason, the scalarization of conjg(transpose()) is messed up. The
following code:

  complex :: a(1,1), b(1,1)
  a = 0
  b = conjg(transpose(a))
  print *, b(1,1)
  end

ends up as folllows:

      int4 D.1015;
      int4 S.2;

      D.1015 = atmp.1.dim[0].stride;
      S.2 = 1;
      while (1)
        {
          if (S.2 > 1) goto L.2;
          {
            int4 D.1018;
            int4 D.1017;
            int4 S.3;

            D.1017 = parm.0.offset + atmp.1.dim[1].stride * S.2;
            D.1018 = S.2 + -2;
            S.3 = 1;
            while (1)
              {
                if (S.3 > 1) goto L.1;
                b[S.3 + D.1018] = CONJ_EXPR <(*(complex4[0:] *)
parm.0.data)[S.3 * D.1015 + D.1017]>;
                S.3 = S.3 + 1;
              }
            L.1:;
          }
          S.2 = S.2 + 1;
        }
      L.2:;

This makes D.1017 be 1, while it should be -1 (or so I think). What is more
confusing is that I can't trigger this scalarization bug with other intrinsics
such as MAX (code below), nor can I understand what is CONJG-specific here...

The following works as expected:

  integer :: a(1,1), b(1,1)
  a = 0
  b = max(transpose(a),a)
  print *, b(1,1)
  end

Maybe there is something to investigate in the difference between these two
codes.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]