public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40594]  New: [4.5 Regression] wrong-code
@ 2009-06-29 17:54 dfranke at gcc dot gnu dot org
  2009-06-29 17:57 ` [Bug fortran/40594] " dfranke at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-06-29 17:54 UTC (permalink / raw)
  To: gcc-bugs

The code I'm going to attach shows strange results with trunk, but works as
expected with 4.4. 

In short, within a TYPE, a LOGICAL component is initialized to .FALSE.
(dummy_atom_init). The calling procedure (dummy_atom_model_init) that checks
the same LOGICAL component sees it as .TRUE. immediately afterwards:

 dummy_atom_init F
 dummy_atom_model_init T
 dummy_atom_init F
 dummy_atom_model_init T

Obviously, the component should be .FALSE. in the calling procedure as well.
The application this was extracted from fails with this kind of error since
r147206.

It is interesting to note that valgrind does not report any issues?!


-- 
           Summary: [4.5 Regression] wrong-code
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dfranke at gcc dot gnu dot org


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


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

* [Bug fortran/40594] [4.5 Regression] wrong-code
  2009-06-29 17:54 [Bug fortran/40594] New: [4.5 Regression] wrong-code dfranke at gcc dot gnu dot org
@ 2009-06-29 17:57 ` dfranke at gcc dot gnu dot org
  2009-06-30 14:28 ` janus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-06-29 17:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dfranke at gcc dot gnu dot org  2009-06-29 17:57 -------
Created an attachment (id=18095)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18095&action=view)
Smallish testcase.

The testcase. Probably not minimal yet, but as close as I can get it now.

Compiled as:
$> rm -f *.mod a.out; gfortran-svn -g -fimplicit-none pr40594.f90 && ./a.out

Fails with:
gcc version 4.5.0 20090628 (experimental) (GCC)

Works with:
gcc version 4.4.1 20090531 (prerelease) (GCC)


-- 


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


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

* [Bug fortran/40594] [4.5 Regression] wrong-code
  2009-06-29 17:54 [Bug fortran/40594] New: [4.5 Regression] wrong-code dfranke at gcc dot gnu dot org
  2009-06-29 17:57 ` [Bug fortran/40594] " dfranke at gcc dot gnu dot org
@ 2009-06-30 14:28 ` janus at gcc dot gnu dot org
  2009-06-30 15:06 ` janus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-06-30 14:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janus at gcc dot gnu dot org  2009-06-30 14:28 -------
Here is a reduced and modified test case. I have marked four lines with a (*),
whose removal results in the correct output (F F), although they seem
completely unrelated. This is pretty strange stuff.


MODULE atom_types

TYPE :: atom_list
  TYPE(atom_private), DIMENSION(:), pointer :: table    ! (*) F F
END TYPE

TYPE :: atom_private
  TYPE(atom_list) :: neighbours         ! (*) F F
  LOGICAL         :: initialized = .true.
END TYPE

TYPE :: atom_model
  TYPE(atom_list) :: atoms      ! (*) F F
  integer         :: dummy
END TYPE

contains

  SUBROUTINE init(this)
    TYPE(atom_private) :: this
    this%initialized = .FALSE.
    print *, "init", this%initialized
  END SUBROUTINE

END MODULE


program pr40594

  USE atom_types
  TYPE(atom_model) :: am
  type(atom_private) :: ap

  am%dummy = 0  ! (*) F F

  call init(ap)
  print *,"main",ap%initialized

END


-- 


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


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

* [Bug fortran/40594] [4.5 Regression] wrong-code
  2009-06-29 17:54 [Bug fortran/40594] New: [4.5 Regression] wrong-code dfranke at gcc dot gnu dot org
  2009-06-29 17:57 ` [Bug fortran/40594] " dfranke at gcc dot gnu dot org
  2009-06-30 14:28 ` janus at gcc dot gnu dot org
@ 2009-06-30 15:06 ` janus at gcc dot gnu dot org
  2009-06-30 16:54 ` dfranke at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-06-30 15:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from janus at gcc dot gnu dot org  2009-06-30 15:06 -------
This patch seems to cure it:

Index: gcc/fortran/trans-types.c
===================================================================
--- gcc/fortran/trans-types.c   (revision 149095)
+++ gcc/fortran/trans-types.c   (working copy)
@@ -1946,7 +1946,13 @@ gfc_get_derived_type (gfc_symbol * deriv
   /* derived->backend_decl != 0 means we saw it before, but its
      components' backend_decl may have not been built.  */
   if (derived->backend_decl)
-    return derived->backend_decl;
+    {
+      /* Its components' backend_decl have been built.  */
+      if (TYPE_FIELDS (derived->backend_decl))
+        return derived->backend_decl;
+      else
+        typenode = derived->backend_decl;
+    }
   else
     {
       /* We see this derived type first time, so build the type node.  */

It is effectively reverting one hunk of r147206, and doesn't even give any
regressions on the proc_ptr_comp_* test cases. (I'm sure there must have been
some reason for this modification, although I have to admit that I cannot
rememeber it ;)


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-06-30 15:06:07
               date|                            |


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


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

* [Bug fortran/40594] [4.5 Regression] wrong-code
  2009-06-29 17:54 [Bug fortran/40594] New: [4.5 Regression] wrong-code dfranke at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-06-30 15:06 ` janus at gcc dot gnu dot org
@ 2009-06-30 16:54 ` dfranke at gcc dot gnu dot org
  2009-06-30 17:06 ` janus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-06-30 16:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dfranke at gcc dot gnu dot org  2009-06-30 16:54 -------
Janus, the patch also fixes the original application.
Thanks for looking into it so quickly!

Please submit for review :)


-- 


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


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

* [Bug fortran/40594] [4.5 Regression] wrong-code
  2009-06-29 17:54 [Bug fortran/40594] New: [4.5 Regression] wrong-code dfranke at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-06-30 16:54 ` dfranke at gcc dot gnu dot org
@ 2009-06-30 17:06 ` janus at gcc dot gnu dot org
  2009-06-30 17:08 ` janus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-06-30 17:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from janus at gcc dot gnu dot org  2009-06-30 17:06 -------
Subject: Bug 40594

Author: janus
Date: Tue Jun 30 17:06:27 2009
New Revision: 149108

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149108
Log:
2009-06-30  Janus Weil  <janus@gcc.gnu.org>

        PR fortran/40594
        * trans-types.c (gfc_get_derived_type): Bugfix, reverting one hunk from
        r147206.


2009-06-30  Janus Weil  <janus@gcc.gnu.org>

        PR fortran/40594
        * gfortran.dg/derived_pointer_recursion_2.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/derived_pointer_recursion_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-types.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/40594] [4.5 Regression] wrong-code
  2009-06-29 17:54 [Bug fortran/40594] New: [4.5 Regression] wrong-code dfranke at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-06-30 17:06 ` janus at gcc dot gnu dot org
@ 2009-06-30 17:08 ` janus at gcc dot gnu dot org
  2009-06-30 17:09 ` janus at gcc dot gnu dot org
  2009-06-30 17:14 ` hjl at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-06-30 17:08 UTC (permalink / raw)
  To: gcc-bugs



-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |janus at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-06-30 15:06:07         |2009-06-30 17:08:25
               date|                            |


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


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

* [Bug fortran/40594] [4.5 Regression] wrong-code
  2009-06-29 17:54 [Bug fortran/40594] New: [4.5 Regression] wrong-code dfranke at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2009-06-30 17:08 ` janus at gcc dot gnu dot org
@ 2009-06-30 17:09 ` janus at gcc dot gnu dot org
  2009-06-30 17:14 ` hjl at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-06-30 17:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from janus at gcc dot gnu dot org  2009-06-30 17:09 -------
Fixed with r149108. Closing.


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug fortran/40594] [4.5 Regression] wrong-code
  2009-06-29 17:54 [Bug fortran/40594] New: [4.5 Regression] wrong-code dfranke at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2009-06-30 17:09 ` janus at gcc dot gnu dot org
@ 2009-06-30 17:14 ` hjl at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: hjl at gcc dot gnu dot org @ 2009-06-30 17:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from hjl at gcc dot gnu dot org  2009-06-30 17:13 -------
Subject: Bug 40594

Author: hjl
Date: Tue Jun 30 17:13:38 2009
New Revision: 149110

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149110
Log:
2009-06-30  H.J. Lu  <hongjiu.lu@intel.com>

        Backport from mainline:
        2009-06-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/40576
        * gfortran.dg/internal_write_1.f90:  New testcase.

        2009-06-30  Janus Weil  <janus@gcc.gnu.org>

        PR fortran/40594
        * gfortran.dg/derived_pointer_recursion_2.f90: New.

Added:
   
branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/derived_pointer_recursion_2.f90
      - copied unchanged from r149109,
trunk/gcc/testsuite/gfortran.dg/derived_pointer_recursion_2.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/internal_write_1.f90
      - copied unchanged from r149109,
trunk/gcc/testsuite/gfortran.dg/internal_write_1.f90
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

end of thread, other threads:[~2009-06-30 17:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-29 17:54 [Bug fortran/40594] New: [4.5 Regression] wrong-code dfranke at gcc dot gnu dot org
2009-06-29 17:57 ` [Bug fortran/40594] " dfranke at gcc dot gnu dot org
2009-06-30 14:28 ` janus at gcc dot gnu dot org
2009-06-30 15:06 ` janus at gcc dot gnu dot org
2009-06-30 16:54 ` dfranke at gcc dot gnu dot org
2009-06-30 17:06 ` janus at gcc dot gnu dot org
2009-06-30 17:08 ` janus at gcc dot gnu dot org
2009-06-30 17:09 ` janus at gcc dot gnu dot org
2009-06-30 17:14 ` hjl 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).