public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34306]  New: misprinting of derived types
@ 2007-11-30 23:40 dominiq at lps dot ens dot fr
  2007-11-30 23:59 ` [Bug fortran/34306] " dominiq at lps dot ens dot fr
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-11-30 23:40 UTC (permalink / raw)
  To: gcc-bugs

While looking at PR18022, I stumbled over the following problem illustrated by
the reduced code from the original one:

program test_bug

  implicit none

  character(len=2), dimension(4,2) :: tab_c
  character(len=30) :: buf1, buf2

  type :: point
     character(len=2) :: x,y
  end type point
  type(point), dimension(4) :: pts

  tab_c(:,1)(:) = (/'1','2','3','4'/)
  tab_c(:,2)(:) = (/'2','3','4','5'/)

  pts%x =  tab_c(:,1)
  pts%y =  tab_c(:,2)

  if (any(pts%x /= tab_c(:,1)) .or. any(pts%y /= tab_c(:,2))) call abort()

  write (buf1, *) pts
  write (buf2, *) tab_c

  print *, buf1
  print *, buf2

  if (buf1 /= buf2) call abort()

end program test_bug

which gives

  1 2 2 3 3 4 4 5              
  1 2 3 4 2 3 4 5              
Abort


-- 
           Summary: misprinting of derived types
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dominiq at lps dot ens dot fr
 GCC build triplet: i686-apple-darwin9
  GCC host triplet: i686-apple-darwin9
GCC target triplet: i686-apple-darwin9


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/34306] misprinting of derived types
  2007-11-30 23:40 [Bug fortran/34306] New: misprinting of derived types dominiq at lps dot ens dot fr
@ 2007-11-30 23:59 ` dominiq at lps dot ens dot fr
  2007-12-01 20:43 ` jvdelisle at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-11-30 23:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dominiq at lps dot ens dot fr  2007-11-30 23:59 -------
If this may help, I have extracted the following piece from the
-fdump-tree-original:

  {
    struct __st_parameter_dt dt_parm.11;

    dt_parm.11.common.filename = &"pr18022_red.f90"[1]{lb: 1 sz: 1};
    dt_parm.11.common.line = 21;
    dt_parm.11.internal_unit = &buf1[1]{lb: 1 sz: 1};
    dt_parm.11.internal_unit_len = 30;
    dt_parm.11.internal_unit_desc = 0B;
    dt_parm.11.common.unit = 0;
    dt_parm.11.common.flags = 16512;
    _gfortran_st_write (&dt_parm.11);
    {
      integer(kind=4) S.12;

      S.12 = 1;
      while (1)
        {
          if (S.12 > 4) goto L.9;
          {
            struct point * D.853;

            D.853 = &pts[S.12 + -1];
            _gfortran_transfer_character (&dt_parm.11, &D.853->x, 2);
            _gfortran_transfer_character (&dt_parm.11, &D.853->y, 2);
          }
          S.12 = S.12 + 1;
        }
      L.9:;
    }
    _gfortran_st_write_done (&dt_parm.11);
  }
  {
    struct __st_parameter_dt dt_parm.13;

    dt_parm.13.common.filename = &"pr18022_red.f90"[1]{lb: 1 sz: 1};
    dt_parm.13.common.line = 22;
    dt_parm.13.internal_unit = &buf2[1]{lb: 1 sz: 1};
    dt_parm.13.internal_unit_len = 30;
    dt_parm.13.internal_unit_desc = 0B;
    dt_parm.13.common.unit = 0;
    dt_parm.13.common.flags = 16512;
    _gfortran_st_write (&dt_parm.13);
    {
      struct array2_unknown parm.14;

      parm.14.dtype = 178;
      parm.14.dim[0].lbound = 1;
      parm.14.dim[0].ubound = 4;
      parm.14.dim[0].stride = 1;
      parm.14.dim[1].lbound = 1;
      parm.14.dim[1].ubound = 2;
      parm.14.dim[1].stride = 4;
      parm.14.data = (void *) (character(kind=1)[0:][1:2] *) &tab_c[0];
      parm.14.offset = -5;
      _gfortran_transfer_array (&dt_parm.13, &parm.14, 1, 2);
    }
    _gfortran_st_write_done (&dt_parm.13);
  }


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/34306] misprinting of derived types
  2007-11-30 23:40 [Bug fortran/34306] New: misprinting of derived types dominiq at lps dot ens dot fr
  2007-11-30 23:59 ` [Bug fortran/34306] " dominiq at lps dot ens dot fr
@ 2007-12-01 20:43 ` jvdelisle at gcc dot gnu dot org
  2007-12-01 21:22 ` dominiq at lps dot ens dot fr
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-12-01 20:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jvdelisle at gcc dot gnu dot org  2007-12-01 20:43 -------
I get the same results with Sun F95 and Ifort


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/34306] misprinting of derived types
  2007-11-30 23:40 [Bug fortran/34306] New: misprinting of derived types dominiq at lps dot ens dot fr
  2007-11-30 23:59 ` [Bug fortran/34306] " dominiq at lps dot ens dot fr
  2007-12-01 20:43 ` jvdelisle at gcc dot gnu dot org
@ 2007-12-01 21:22 ` dominiq at lps dot ens dot fr
  2007-12-02 20:20 ` terry at chem dot gu dot se
  2007-12-02 20:59 ` jvdelisle at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-12-01 21:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dominiq at lps dot ens dot fr  2007-12-01 21:21 -------
Subject: Re:  misprinting of derived types

> I get the same results with Sun F95 and Ifort

So do g95 and Portland Group Fortran. And I think I understand
now that it is not a bug. What is printed is pts(1)%x, pts(1)%y, pts(2)%x, ...
and not as I thought pts(1)%x, pts(2)%x, ... .

If anyone can confirm this, the PR can be closed as invalid.


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/34306] misprinting of derived types
  2007-11-30 23:40 [Bug fortran/34306] New: misprinting of derived types dominiq at lps dot ens dot fr
                   ` (2 preceding siblings ...)
  2007-12-01 21:22 ` dominiq at lps dot ens dot fr
@ 2007-12-02 20:20 ` terry at chem dot gu dot se
  2007-12-02 20:59 ` jvdelisle at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: terry at chem dot gu dot se @ 2007-12-02 20:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from terry at chem dot gu dot se  2007-12-02 20:20 -------
You're outputting an array of point structures.  First the first element (a
point), then the next, and so on.  Why would you expect a different result?


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/34306] misprinting of derived types
  2007-11-30 23:40 [Bug fortran/34306] New: misprinting of derived types dominiq at lps dot ens dot fr
                   ` (3 preceding siblings ...)
  2007-12-02 20:20 ` terry at chem dot gu dot se
@ 2007-12-02 20:59 ` jvdelisle at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-12-02 20:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jvdelisle at gcc dot gnu dot org  2007-12-02 20:59 -------
Closing.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-12-02 20:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-30 23:40 [Bug fortran/34306] New: misprinting of derived types dominiq at lps dot ens dot fr
2007-11-30 23:59 ` [Bug fortran/34306] " dominiq at lps dot ens dot fr
2007-12-01 20:43 ` jvdelisle at gcc dot gnu dot org
2007-12-01 21:22 ` dominiq at lps dot ens dot fr
2007-12-02 20:20 ` terry at chem dot gu dot se
2007-12-02 20:59 ` jvdelisle at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).