public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45087]  New: -fwhole-program: Miscompiled due to wrong decls
@ 2010-07-26 17:27 burnus at gcc dot gnu dot org
  2010-07-26 21:04 ` [Bug fortran/45087] " burnus at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-26 17:27 UTC (permalink / raw)
  To: gcc-bugs

Follow up to PR 40873. 

There are still some -fwhole-program issues left; for instance: The polyhedron
tests gas_dyn.f90 and test_fpu.f90 do not link


-- 
           Summary: -fwhole-program: Miscompiled due to wrong decls
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
 BugsThisDependsOn: 40873


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


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

* [Bug fortran/45087] -fwhole-program: Miscompiled due to wrong decls
  2010-07-26 17:27 [Bug fortran/45087] New: -fwhole-program: Miscompiled due to wrong decls burnus at gcc dot gnu dot org
@ 2010-07-26 21:04 ` burnus at gcc dot gnu dot org
  2010-07-28  9:32 ` burnus at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-26 21:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2010-07-26 21:03 -------
Looking at the reduced test case for gas_dyn.f90, it looks like a duplicate of
PR 44945:

module ints
   INTERFACE
      SUBROUTINE NOZZLE()
      END SUBROUTINE NOZZLE
   END INTERFACE
end module ints

      SUBROUTINE NOZZLE()
      END SUBROUTINE NOZZLE
      program CORTESA 
      USE INTS
      CALL NOZZLE ()
      END program CORTESA


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |44945


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


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

* [Bug fortran/45087] -fwhole-program: Miscompiled due to wrong decls
  2010-07-26 17:27 [Bug fortran/45087] New: -fwhole-program: Miscompiled due to wrong decls burnus at gcc dot gnu dot org
  2010-07-26 21:04 ` [Bug fortran/45087] " burnus at gcc dot gnu dot org
@ 2010-07-28  9:32 ` burnus at gcc dot gnu dot org
  2010-07-28 12:35 ` burnus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-28  9:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2010-07-28 09:32 -------
Patch. It fixes also test_fpu.f90  - however, for gas_dyn.f90 it causes a
segfault:

==24597== Invalid read of size 8
==24597==    at 0x5A8DF3: ggc_set_mark (ggc-page.c:600)
==24597==    by 0x73CD54: gt_ggc_mx_eh_status (gtype-desc.c:714)
==24597==    by 0x73DA25: gt_ggc_mx_function (gtype-desc.c:943)
==24597==    by 0x553410: gt_ggc_mx_lang_tree_node (gt-fortran-f95-lang.h:293)
==24597==    by 0x73D94D: gt_ggc_m_P9tree_node4htab (gtype-desc.c:2544)
==24597==    by 0x553EAD: gt_ggc_m_P17module_htab_entry4htab
(gtype-fortran.h:98)

Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c    (revision 162619)
+++ gcc/fortran/trans-decl.c    (working copy)
@@ -1409,7 +1409,7 @@ gfc_get_extern_function_decl (gfc_symbol
   gsym =  gfc_find_gsymbol (gfc_gsym_root, sym->name);

   if (gfc_option.flag_whole_file
-       && !sym->attr.use_assoc
+       && (!sym->attr.use_assoc || sym->attr.if_source != IFSRC_DECL)
        && !sym->backend_decl
        && gsym && gsym->ns
        && ((gsym->type == GSYM_SUBROUTINE) || (gsym->type == GSYM_FUNCTION))


-- 


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


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

* [Bug fortran/45087] -fwhole-program: Miscompiled due to wrong decls
  2010-07-26 17:27 [Bug fortran/45087] New: -fwhole-program: Miscompiled due to wrong decls burnus at gcc dot gnu dot org
  2010-07-26 21:04 ` [Bug fortran/45087] " burnus at gcc dot gnu dot org
  2010-07-28  9:32 ` burnus at gcc dot gnu dot org
@ 2010-07-28 12:35 ` burnus at gcc dot gnu dot org
  2010-07-28 13:14 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-28 12:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2010-07-28 12:35 -------
Minimal test case, compile with:
  gfortran --param ggc-min-expand=0 --param ggc-min-heapsize=0

module INTS
  interface
    subroutine NEXT
    end subroutine NEXT
    subroutine VALUE()
    end subroutine VALUE
  end interface
end module INTS

subroutine NEXT
end subroutine NEXT

subroutine VALUE()
  use INTS, only: NEXT
  CALL NEXT
end subroutine VALUE


-- 


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


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

* [Bug fortran/45087] -fwhole-program: Miscompiled due to wrong decls
  2010-07-26 17:27 [Bug fortran/45087] New: -fwhole-program: Miscompiled due to wrong decls burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-07-28 12:35 ` burnus at gcc dot gnu dot org
@ 2010-07-28 13:14 ` burnus at gcc dot gnu dot org
  2010-07-28 13:52 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-28 13:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2010-07-28 13:14 -------
(In reply to comment #3)
> Minimal test case, compile with:
>   gfortran --param ggc-min-expand=0 --param ggc-min-heapsize=0

The problems seems to be that one tries to free the NEXT twice - once for the
symbol in VALUE and once as global procedure; this can be seen by the value
0xa5a5a5a5a5a5a5a5 in the dump - and by looking at the place where it crashes,
namely: gt_ggc_mx_function; the cleanup is done for the module, i.e.
gt_ggc_m_P17module_htab_entry4htab.
[Actually, it could also be that one frees "VALUE" twice - I have not verified
that it is NEXT.]

I thought something like the following would help - but it does _not_:

--- trans-decl.c        (revision 162619)
+++ trans-decl.c        (working copy)
@@ -3409,6 +3409,9 @@ gfc_create_module_variable (gfc_symbol *
   if (sym->attr.entry)
     return;

+  if (sym->attr.if_source != IFSRC_DECL)
+    return;
+
   /* Make sure we convert the types of the derived types from iso_c_binding
      into (void *).  */
   if (sym->attr.flavor != FL_PROCEDURE && sym->attr.is_iso_c


-- 


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


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

* [Bug fortran/45087] -fwhole-program: Miscompiled due to wrong decls
  2010-07-26 17:27 [Bug fortran/45087] New: -fwhole-program: Miscompiled due to wrong decls burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-07-28 13:14 ` burnus at gcc dot gnu dot org
@ 2010-07-28 13:52 ` burnus at gcc dot gnu dot org
  2010-07-28 20:34 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-28 13:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2010-07-28 13:51 -------
(In reply to comment #3)
> Minimal test case, compile with:

There is something odd: If one has the order

  subroutine VALUE()
  subroutine NEXT

it actually works; one then goes

   gfc_create_function_decl for VALUE
   gfc_get_extern_function_decl for NEXT
     call gfc_create_function_decl for NEXT

while for the opposite order it fails:

   gfc_create_function_decl for NEXT
   gfc_create_function_decl for VALUE
   gfc_get_extern_function_decl for NEXT

In both cases the backend_decl is used in gfc_get_extern_function_decl. And in
all cases it seems as if the the module's next's gsym->...->backend_decl ==
NULL.


-- 


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


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

* [Bug fortran/45087] -fwhole-program: Miscompiled due to wrong decls
  2010-07-26 17:27 [Bug fortran/45087] New: -fwhole-program: Miscompiled due to wrong decls burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2010-07-28 13:52 ` burnus at gcc dot gnu dot org
@ 2010-07-28 20:34 ` burnus at gcc dot gnu dot org
  2010-07-29 10:26 ` mikael at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-28 20:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from burnus at gcc dot gnu dot org  2010-07-28 20:34 -------
Patch: http://gcc.gnu.org/ml/fortran/2010-07/msg00430.html


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |burnus at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-07-28 20:34:41
               date|                            |


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


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

* [Bug fortran/45087] -fwhole-program: Miscompiled due to wrong decls
  2010-07-26 17:27 [Bug fortran/45087] New: -fwhole-program: Miscompiled due to wrong decls burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2010-07-28 20:34 ` burnus at gcc dot gnu dot org
@ 2010-07-29 10:26 ` mikael at gcc dot gnu dot org
  2010-07-29 21:08 ` burnus at gcc dot gnu dot org
  2010-07-29 21:08 ` burnus at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: mikael at gcc dot gnu dot org @ 2010-07-29 10:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from mikael at gcc dot gnu dot org  2010-07-29 10:26 -------
(In reply to comment #6)
> Patch: http://gcc.gnu.org/ml/fortran/2010-07/msg00430.html
> 
Regressing, see PR45125.


-- 


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


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

* [Bug fortran/45087] -fwhole-program: Miscompiled due to wrong decls
  2010-07-26 17:27 [Bug fortran/45087] New: -fwhole-program: Miscompiled due to wrong decls burnus at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2010-07-29 10:26 ` mikael at gcc dot gnu dot org
@ 2010-07-29 21:08 ` burnus at gcc dot gnu dot org
  2010-07-29 21:08 ` burnus at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-29 21:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from burnus at gcc dot gnu dot org  2010-07-29 21:07 -------
Subject: Bug 45087

Author: burnus
Date: Thu Jul 29 21:07:34 2010
New Revision: 162696

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162696
Log:
2010-07-29  Tobias Burnus  <burnus@net-b.de>

        PR fortran/45087
        PR fortran/45125
        * trans-decl.c (gfc_get_extern_function_decl): Correctly handle
        external procedure declarations in modules.
        (gfc_get_symbol_decl): Modify assert.

2010-07-29  Tobias Burnus  <burnus@net-b.de>

        PR fortran/45087
        PR fortran/45125
        * gfortran.dg/whole_file_25.f90: New.
        * gfortran.dg/whole_file_26.f90: New.
        * gfortran.dg/whole_file_27.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/whole_file_25.f90
    trunk/gcc/testsuite/gfortran.dg/whole_file_26.f90
    trunk/gcc/testsuite/gfortran.dg/whole_file_27.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/45087] -fwhole-program: Miscompiled due to wrong decls
  2010-07-26 17:27 [Bug fortran/45087] New: -fwhole-program: Miscompiled due to wrong decls burnus at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2010-07-29 21:08 ` burnus at gcc dot gnu dot org
@ 2010-07-29 21:08 ` burnus at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-29 21:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from burnus at gcc dot gnu dot org  2010-07-29 21:08 -------
FIXED on the trunk (4.6).


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-07-29 21:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-26 17:27 [Bug fortran/45087] New: -fwhole-program: Miscompiled due to wrong decls burnus at gcc dot gnu dot org
2010-07-26 21:04 ` [Bug fortran/45087] " burnus at gcc dot gnu dot org
2010-07-28  9:32 ` burnus at gcc dot gnu dot org
2010-07-28 12:35 ` burnus at gcc dot gnu dot org
2010-07-28 13:14 ` burnus at gcc dot gnu dot org
2010-07-28 13:52 ` burnus at gcc dot gnu dot org
2010-07-28 20:34 ` burnus at gcc dot gnu dot org
2010-07-29 10:26 ` mikael at gcc dot gnu dot org
2010-07-29 21:08 ` burnus at gcc dot gnu dot org
2010-07-29 21:08 ` burnus 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).