public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/38907] [4.3/4.4 Regression ] ICE when contained function has same name as module function and used in expression
Date: Sun, 18 Jan 2009 22:28:00 -0000	[thread overview]
Message-ID: <20090118222755.21424.qmail@sourceware.org> (raw)
In-Reply-To: <bug-38907-15620@http.gcc.gnu.org/bugzilla/>



------- Comment #3 from burnus at gcc dot gnu dot org  2009-01-18 22:27 -------
Confirm. Thanks for the report!

Valgrind shows:

==20941== Conditional jump or move depends on uninitialised value(s)
==20941==    at 0x46C602: gfc_resolve_expr (resolve.c:4353)
==20941==    by 0x46BC22: gfc_resolve_expr (resolve.c:3057)
==20941==    by 0x472944: resolve_code (resolve.c:6676)

==20941== Use of uninitialised value of size 8
==20941==    at 0x46C608: gfc_resolve_expr (resolve.c:4353)

==20941== Invalid read of size 8
==20941==    at 0x46C608: gfc_resolve_expr (resolve.c:4353)

That line is:

  4349            gfc_match_rvalue (&expr);
  4350            gfc_clear_error ();
  4351            gfc_buffer_error (0);
  4352
  4353            gcc_assert (expr && sym == expr->symtree->n.sym);

I added some debug printfs and valgrind shows invalid reads for:
  expr == NULL
and
  expr->symtree
where the latter results in a segfault.

I think the problem occurs if gfc_match_rvalue does not match. Then the
argument "&expr" will remain unmodified.

If one applies the following patch, the compilation will fail with the bogus
error

          RDA(1,2) = + S_REAL_SUM_I(1.0,2.0)
                                   1
Error: Unclassifiable statement at (1)


--- resolve.c   (Revision 143486)
+++ resolve.c
@@ -4348,3 +4348,4 @@ check_host_association (gfc_expr *e)
    only integers and vectors can be involved.  */
-         gfc_match_rvalue (&expr);
+         if (gfc_match_rvalue (&expr) == MATCH_YES)
+           {
          gfc_clear_error ();
@@ -4359,2 +4360,3 @@ check_host_association (gfc_expr *e)
          gfc_current_locus = temp_locus;
+           }
        }


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |32834
              nThis|                            |
           Keywords|                            |ice-on-valid-code
      Known to work|4.2.5                       |4.2.5 4.3.1
            Summary|[regression 4.3/4.4] ICE    |[4.3/4.4 Regression ] ICE
                   |when contained function has |when contained function has
                   |same name as module function|same name as module function
                   |and used in expression      |and used in expression
   Target Milestone|---                         |4.3.4


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


  parent reply	other threads:[~2009-01-18 22:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-18 21:21 [Bug fortran/38907] New: " dick dot hendrickson at gmail dot com
2009-01-18 21:44 ` [Bug fortran/38907] " kargl at gcc dot gnu dot org
2009-01-18 21:47 ` [Bug fortran/38907] [regression 4.3/4.4] " kargl at gcc dot gnu dot org
2009-01-18 21:47 ` kargl at gcc dot gnu dot org
2009-01-18 22:28 ` burnus at gcc dot gnu dot org [this message]
2009-01-19 22:34 ` [Bug fortran/38907] [4.3/4.4 Regression ] " mikael at gcc dot gnu dot org
2009-01-19 22:40 ` dominiq at lps dot ens dot fr
2009-01-19 23:08 ` pault at gcc dot gnu dot org
2009-01-20 19:48 ` mikael at gcc dot gnu dot org
2009-01-20 21:57 ` pault at gcc dot gnu dot org
2009-01-20 21:59 ` [Bug fortran/38907] [4.3 " pault at gcc dot gnu dot org
2009-01-26  6:16 ` pault at gcc dot gnu dot org
2009-01-26  6:16 ` pault at gcc dot gnu dot org

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=20090118222755.21424.qmail@sourceware.org \
    --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).