public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45797] New: ICE (segfault) with   gfortran.dg/derived_constr_func_1.f90
@ 2010-09-26 15:12 burnus at gcc dot gnu.org
  2011-02-18 21:57 ` [Bug fortran/45797] ICE (segfault): Invalid read in gfc_use_derived mikael at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-09-26 15:12 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: ICE (segfault) with
                    gfortran.dg/derived_constr_func_1.f90
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


The ICE is in the following line of gfc_use_derived
  if (sym->components != NULL || sym->attr.zero_comp)

valgrind outputs the following. I checked with GCC 4.4 and 4.5 that those also
ICE.


[...]
gfortran.dg/derived_constr_func_1.f90:14.11:

  type(foo) function constructor()
           1
Error: PROCEDURE attribute of 'foo' conflicts with DERIVED attribute at (1)
==27731== Invalid read of size 8
==27731==    at 0x549D99: gfc_use_derived (symbol.c:1934)
==27731==    by 0x5214FA: match_variable (primary.c:3043)
==27731==    by 0x5062E4: gfc_match (match.c:1115)
==27731==    by 0x50706A: gfc_match_assignment (match.c:1292)
==27731==    by 0x5188D9: match_word (parse.c:65)


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

* [Bug fortran/45797] ICE (segfault): Invalid read in gfc_use_derived
  2010-09-26 15:12 [Bug fortran/45797] New: ICE (segfault) with gfortran.dg/derived_constr_func_1.f90 burnus at gcc dot gnu.org
@ 2011-02-18 21:57 ` mikael at gcc dot gnu.org
  2011-03-01 15:58 ` dominiq at lps dot ens.fr
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mikael at gcc dot gnu.org @ 2011-02-18 21:57 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #2 from Mikael Morin <mikael at gcc dot gnu.org> 2011-02-18 21:26:55 UTC ---
quick fix

diff --git a/symbol.c b/symbol.c
index 71aa518..ac274d6 100644
--- a/symbol.c
+++ b/symbol.c
@@ -1939,6 +1939,10 @@ gfc_use_derived (gfc_symbol *sym)
   gfc_symtree *st;
   int i;

+  /* Something went bad earlier, bail out.  */
+  if (sym == NULL)
+    return NULL;
+
   if (sym->components != NULL || sym->attr.zero_comp)
     return sym;               /* Already defined.  */


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

* [Bug fortran/45797] ICE (segfault): Invalid read in gfc_use_derived
  2010-09-26 15:12 [Bug fortran/45797] New: ICE (segfault) with gfortran.dg/derived_constr_func_1.f90 burnus at gcc dot gnu.org
  2011-02-18 21:57 ` [Bug fortran/45797] ICE (segfault): Invalid read in gfc_use_derived mikael at gcc dot gnu.org
@ 2011-03-01 15:58 ` dominiq at lps dot ens.fr
  2011-03-04 23:49 ` mikael at gcc dot gnu.org
  2013-01-04 13:24 ` mikael at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: dominiq at lps dot ens.fr @ 2011-03-01 15:58 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.03.01 15:57:58
     Ever Confirmed|0                           |1

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-03-01 15:57:58 UTC ---
The patch in comment #2 fixes the ICE, but yields several more errors:

[macbook] f90/bug% gfc pr45797.f90
pr45797.f90:10.10:

  type foo
          1
Error: PROCEDURE attribute of 'foo' conflicts with DERIVED attribute at (1)
pr45797.f90:12.5:

  end type
     1
Error: Expecting END MODULE statement at (1)
pr45797.f90:14.11:

  type(foo) function constructor()
           1
Error: PROCEDURE attribute of 'foo' conflicts with DERIVED attribute at (1)
pr45797.f90:15.4:

    constructor%bar = 1
    1
Error: Unclassifiable statement at (1)
pr45797.f90:14.2:

  type(foo) function constructor()
  1
Error: The type for function 'constructor' at (1) is not accessible
pr45797.f90:19.13:

    type(foo) :: f
             1
Error: PROCEDURE attribute of 'foo' conflicts with DERIVED attribute at (1)
pr45797.f90:21.9:

    if (f%bar /= 1) call abort ()
         1
Error: Syntax error in IF-expression at (1)
pr45797.f90:23.9:

    if (f%bar /= 2) call abort ()
         1
Error: Syntax error in IF-expression at (1)
pr45797.f90:25.9:

    if (f%bar /= 22) call abort ()
         1
Error: Syntax error in IF-expression at (1)
pr45797.f90:22.8:

    f = foo(2)
        1
Error: There is no specific function for the generic 'foo' at (1)
pr45797.f90:24.8:

    f = foo(bar=22)
        1
Error: There is no specific function for the generic 'foo' at (1)
pr45797.f90:37.15:

  interface bar
               1
Error: DERIVED attribute of 'bar' conflicts with PROCEDURE attribute at (1)
pr45797.f90:38.4:

    procedure constructor
    1
Error: Unclassifiable statement at (1)
pr45797.f90:39.5:

  end interface
     1
Error: Expecting END MODULE statement at (1)
pr45797.f90:57.16:

  use foo_module
                1
Fatal Error: Can't open module file 'foo_module.mod' for reading at (1): No
such file or directory

compared to

pr45797.f90:10.10:

  type foo
          1
Error: PROCEDURE attribute of 'foo' conflicts with DERIVED attribute at (1)
pr45797.f90:12.5:

  end type
     1
Error: Expecting END MODULE statement at (1)
pr45797.f90:14.11:

  type(foo) function constructor()
           1
Error: PROCEDURE attribute of 'foo' conflicts with DERIVED attribute at (1)
f951: internal compiler error: Segmentation fault


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

* [Bug fortran/45797] ICE (segfault): Invalid read in gfc_use_derived
  2010-09-26 15:12 [Bug fortran/45797] New: ICE (segfault) with gfortran.dg/derived_constr_func_1.f90 burnus at gcc dot gnu.org
  2011-02-18 21:57 ` [Bug fortran/45797] ICE (segfault): Invalid read in gfc_use_derived mikael at gcc dot gnu.org
  2011-03-01 15:58 ` dominiq at lps dot ens.fr
@ 2011-03-04 23:49 ` mikael at gcc dot gnu.org
  2013-01-04 13:24 ` mikael at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mikael at gcc dot gnu.org @ 2011-03-04 23:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> 2011-03-04 23:49:27 UTC ---
(In reply to comment #3)
> The patch in comment #2 fixes the ICE, but yields several more errors:
Yes, because without the patch gfortran was killed before finishing parsing
(and throwing more errors).


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

* [Bug fortran/45797] ICE (segfault): Invalid read in gfc_use_derived
  2010-09-26 15:12 [Bug fortran/45797] New: ICE (segfault) with gfortran.dg/derived_constr_func_1.f90 burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-03-04 23:49 ` mikael at gcc dot gnu.org
@ 2013-01-04 13:24 ` mikael at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mikael at gcc dot gnu.org @ 2013-01-04 13:24 UTC (permalink / raw)
  To: gcc-bugs


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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |4.7.2, 4.8.0
         Resolution|                            |FIXED

--- Comment #5 from Mikael Morin <mikael at gcc dot gnu.org> 2013-01-04 13:24:29 UTC ---
This has been fixed.


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

end of thread, other threads:[~2013-01-04 13:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-26 15:12 [Bug fortran/45797] New: ICE (segfault) with gfortran.dg/derived_constr_func_1.f90 burnus at gcc dot gnu.org
2011-02-18 21:57 ` [Bug fortran/45797] ICE (segfault): Invalid read in gfc_use_derived mikael at gcc dot gnu.org
2011-03-01 15:58 ` dominiq at lps dot ens.fr
2011-03-04 23:49 ` mikael at gcc dot gnu.org
2013-01-04 13:24 ` mikael at gcc dot gnu.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).