This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/38907] [4.3/4.4 Regression ] ICE when contained function has same name as module function and used in expression
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Jan 2009 22:27:55 -0000
- Subject: [Bug fortran/38907] [4.3/4.4 Regression ] ICE when contained function has same name as module function and used in expression
- References: <bug-38907-15620@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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