valgrind ./f951 ../../gcc/testsuite/gfortran.dg/enum_5.f90 fails with: ==13267== Invalid read of size 4 ==13267== at 0x3EA2A142A0: __gmpz_cmp (in /usr/lib64/libgmp.so.3.5.0) ==13267== by 0x41F6D8: create_enum_history (decl.c:1186) ==13267== by 0x428F13: enumerator_decl (decl.c:7142) ==13267== by 0x42901B: gfc_match_enumerator_def (decl.c:7194) ==13267== by 0x475267: match_word (parse.c:65) ==13267== by 0x475A80: decode_statement (parse.c:284) ==13267== by 0x4770D8: next_free (parse.c:715) ==13267== by 0x4774A8: next_statement (parse.c:900) ==13267== by 0x478A93: parse_enum (parse.c:2122) ==13267== by 0x4794D8: parse_spec (parse.c:2554) ==13267== by 0x47ADD6: parse_progunit (parse.c:3758) ==13267== by 0x47B75C: gfc_parse_file (parse.c:4146) ==13267== Address 0x5583b24 is 132 bytes inside a block of size 192 free'd ==13267== at 0x4A04D72: free (vg_replace_malloc.c:325) ==13267== by 0x467751: gfc_free (misc.c:51) ==13267== by 0x432061: gfc_free_expr (expr.c:232) ==13267== by 0x4B0E5D: gfc_free_symbol (symbol.c:2430) ==13267== by 0x4B18A2: gfc_undo_symbols (symbol.c:2809) ==13267== by 0x47800D: reject_statement (parse.c:1612) ==13267== by 0x47528E: match_word (parse.c:70) ==13267== by 0x475A80: decode_statement (parse.c:284) ==13267== by 0x4770D8: next_free (parse.c:715) ==13267== by 0x4774A8: next_statement (parse.c:900) ==13267== by 0x478A93: parse_enum (parse.c:2122) ==13267== by 0x4794D8: parse_spec (parse.c:2554) on both 4.4 branch and the trunk. The problem is that on error enum history isn't freed, so it references exprs from rejected statements.
-- Summary: enum_5.f90 ICE under valgrind Product: gcc Version: 4.4.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jakub at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43029