From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21483 invoked by alias); 18 Jan 2009 22:28:08 -0000 Received: (qmail 21425 invoked by uid 48); 18 Jan 2009 22:27:55 -0000 Date: Sun, 18 Jan 2009 22:28:00 -0000 Message-ID: <20090118222755.21424.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/38907] [4.3/4.4 Regression ] ICE when contained function has same name as module function and used in expression In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-01/txt/msg02054.txt.bz2 ------- 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