public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jb at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/51522] ICE in gfortran 4.6.2, x86_64
Date: Sun, 05 Feb 2012 21:04:00 -0000	[thread overview]
Message-ID: <bug-51522-4-140FReydBo@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-51522-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from Janne Blomqvist <jb at gcc dot gnu.org> 2012-02-05 21:04:18 UTC ---
So the complete valgrind error message I get (with the comment #4 testcase
fixed per Tobias instructions in comment #6) is:

==14281== Invalid read of size 4
==14281==    at 0x528B66: resolve_symbol (resolve.c:10559)
==14281==    by 0x545EF0: do_traverse_symtree (symbol.c:3386)
==14281==    by 0x532503: resolve_types (resolve.c:13859)
==14281==    by 0x527473: gfc_resolve (resolve.c:13959)
==14281==    by 0x528C18: resolve_symbol (resolve.c:12715)
==14281==    by 0x545EF0: do_traverse_symtree (symbol.c:3386)
==14281==    by 0x532503: resolve_types (resolve.c:13859)
==14281==    by 0x527473: gfc_resolve (resolve.c:13959)
==14281==    by 0x51ABBC: gfc_parse_file (parse.c:4594)
==14281==    by 0x557315: gfc_be_parse_file (f95-lang.c:250)
==14281==    by 0x909CDC: do_compile (toplev.c:557)
==14281==    by 0x90A853: toplev_main (toplev.c:2014)
==14281==  Address 0x5ca8700 is 32 bytes inside a block of size 304 free'd
==14281==    at 0x4C270BD: free (vg_replace_malloc.c:366)
==14281==    by 0x546E91: gfc_undo_symbols (symbol.c:2898)
==14281==    by 0x514F5A: reject_statement (parse.c:1743)
==14281==    by 0x515A54: decode_statement (parse.c:316)
==14281==    by 0x516D8C: next_statement (parse.c:778)
==14281==    by 0x51801D: parse_spec (parse.c:2379)
==14281==    by 0x51A9BD: gfc_parse_file (parse.c:4297)
==14281==    by 0x557315: gfc_be_parse_file (f95-lang.c:250)
==14281==    by 0x909CDC: do_compile (toplev.c:557)
==14281==    by 0x90A853: toplev_main (toplev.c:2014)
==14281==    by 0x5712C4C: (below main) (libc-start.c:226)
==14281== 
==14281== Invalid read of size 8
==14281==    at 0x52869D: resolve_symbol (resolve.c:12726)
==14281==    by 0x545EF0: do_traverse_symtree (symbol.c:3386)
==14281==    by 0x532503: resolve_types (resolve.c:13859)
==14281==    by 0x527473: gfc_resolve (resolve.c:13959)
==14281==    by 0x528C18: resolve_symbol (resolve.c:12715)
==14281==    by 0x545EF0: do_traverse_symtree (symbol.c:3386)
==14281==    by 0x532503: resolve_types (resolve.c:13859)
==14281==    by 0x527473: gfc_resolve (resolve.c:13959)
==14281==    by 0x51ABBC: gfc_parse_file (parse.c:4594)
==14281==    by 0x557315: gfc_be_parse_file (f95-lang.c:250)
==14281==    by 0x909CDC: do_compile (toplev.c:557)
==14281==    by 0x90A853: toplev_main (toplev.c:2014)
==14281==  Address 0x5ca87e0 is 256 bytes inside a block of size 304 free'd
==14281==    at 0x4C270BD: free (vg_replace_malloc.c:366)
==14281==    by 0x546E91: gfc_undo_symbols (symbol.c:2898)
==14281==    by 0x514F5A: reject_statement (parse.c:1743)
==14281==    by 0x515A54: decode_statement (parse.c:316)
==14281==    by 0x516D8C: next_statement (parse.c:778)
==14281==    by 0x51801D: parse_spec (parse.c:2379)
==14281==    by 0x51A9BD: gfc_parse_file (parse.c:4297)
==14281==    by 0x557315: gfc_be_parse_file (f95-lang.c:250)
==14281==    by 0x909CDC: do_compile (toplev.c:557)
==14281==    by 0x90A853: toplev_main (toplev.c:2014)
==14281==    by 0x5712C4C: (below main) (libc-start.c:226)

So the problem seems to be that when we hit the error in the interface
declaration, we call gfc_undo_symbols() -> gfc_release_symbol() ->
gfc_free_symbol() -> free(), but then we go and dereference pointers to this
freed memory.

Unfortunately I'm not really familiar enough with this part of the codebase to
know how to fix it properly.


  parent reply	other threads:[~2012-02-05 21:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-12 23:09 [Bug fortran/51522] New: " adrian at llnl dot gov
2011-12-12 23:25 ` [Bug fortran/51522] " dominiq at lps dot ens.fr
2012-01-09 13:30 ` burnus at gcc dot gnu.org
2012-01-09 13:40 ` dominiq at lps dot ens.fr
2012-01-31 16:11 ` dominiq at lps dot ens.fr
2012-02-02 19:08 ` jb at gcc dot gnu.org
2012-02-03 10:50 ` burnus at gcc dot gnu.org
2012-02-03 22:36 ` jb at gcc dot gnu.org
2012-02-04  0:20 ` dominiq at lps dot ens.fr
2012-02-05 21:04 ` jb at gcc dot gnu.org [this message]
2015-10-10 12:57 ` dominiq at lps dot ens.fr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-51522-4-140FReydBo@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).