User account creation filtered due to spam.

Bug 47204 - [4.6 Regression] [OOP] ICE: SIGSEGV in gfc_free_namespace (symbol.c:3323) on invalid code
Summary: [4.6 Regression] [OOP] ICE: SIGSEGV in gfc_free_namespace (symbol.c:3323) on ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2011-01-07 11:01 UTC by Zdenek Sojka
Modified: 2011-01-13 16:40 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.5.3
Known to fail: 4.6.0
Last reconfirmed: 2011-01-07 15:58:08


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2011-01-07 11:01:09 UTC
----- testcase.f03 -----
    select type (a)
------------------------

Compiler output:
$ gfortran testcase.f03                                       
Error: Unexpected end of file in 'testcase.f03'
==8750== Invalid read of size 8
==8750==    at 0x590EC2: gfc_free_namespace (symbol.c:3304)
==8750==    by 0x5917EF: gfc_symbol_done_2 (symbol.c:3347)
==8750==    by 0x553588: gfc_done_2 (misc.c:294)
==8750==    by 0x55EC11: unexpected_eof (parse.c:1845)
==8750==    by 0x562F5C: parse_executable (parse.c:3101)
==8750==    by 0x5637C1: parse_progunit (parse.c:3939)
==8750==    by 0x5643DD: gfc_parse_file (parse.c:4348)
==8750==    by 0x59CB45: gfc_be_parse_file (f95-lang.c:250)
==8750==    by 0x93A477: toplev_main (toplev.c:579)
==8750==    by 0x6369BBC: (below main) (in /lib64/libc-2.11.2.so)
==8750==  Address 0x6f16bf0 is 0 bytes inside a block of size 2,552 free'd
==8750==    at 0x4C25E0D: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==8750==    by 0x550695: gfc_free_case_list (match.c:4361)
==8750==    by 0x58BE7C: gfc_free_statements (st.c:230)
==8750==    by 0x590EC1: gfc_free_namespace (symbol.c:3302)
==8750==    by 0x5917EF: gfc_symbol_done_2 (symbol.c:3347)
==8750==    by 0x553588: gfc_done_2 (misc.c:294)
==8750==    by 0x55EC11: unexpected_eof (parse.c:1845)
==8750==    by 0x562F5C: parse_executable (parse.c:3101)
==8750==    by 0x5637C1: parse_progunit (parse.c:3939)
==8750==    by 0x5643DD: gfc_parse_file (parse.c:4348)
==8750==    by 0x59CB45: gfc_be_parse_file (f95-lang.c:250)
==8750==    by 0x93A477: toplev_main (toplev.c:579)
==8750==    by 0x6369BBC: (below main) (in /lib64/libc-2.11.2.so)

(many invalid reads follow, final crash is caused by double free)

f951: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


Tested revisions:
r168552 - crash
r165699 - crash
r161659 - crash
r158095 - OK
4.5 r168062 - OK
Comment 1 H.J. Lu 2011-01-07 15:58:08 UTC
It is caused by revision 159217:

http://gcc.gnu.org/ml/gcc-cvs/2010-05/msg00268.html
Comment 2 Paul Thomas 2011-01-07 17:48:16 UTC
(In reply to comment #1)
> It is caused by revision 159217:
> 
> http://gcc.gnu.org/ml/gcc-cvs/2010-05/msg00268.html

HJ,

Could you add the testcase source please?

Thanks

Paul
Comment 3 Jerry DeLisle 2011-01-07 17:52:22 UTC
Paul,

I think its the one liner at the top of the PR, comment #0
Comment 4 Mikael Morin 2011-01-07 20:26:09 UTC
Looks like a duplicate of PR45848. 

Happy new year folks!
Comment 5 Tobias Burnus 2011-01-13 16:32:43 UTC
Author: burnus
Date: Thu Jan 13 16:32:33 2011
New Revision: 168753

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168753
Log:
2011-01-13  Tobias Burnus  <burnus@net-b.de>
            Mikael Morin  <mikael@gcc.gnu.org>

        PR fortran/45848
        PR fortran/47204
        * gfortran.h (gfc_code): Move union ext's case_list into
        the struct block.
        * dump-parse-tree.c (show_code_node): Adapt by prefixing
        * case_list
        by "block.".
        * frontend-passes.c (gfc_code_walker): Ditto.
        * match.c (gfc_match_goto, gfc_match_call, gfc_match_case,
        gfc_match_type_is, gfc_match_class_is): Ditto.
        * resolve.c (resolve_select, resolve_select_type): Ditto.
        * st.c (gfc_free_statement): Ditto.
        * trans-stmt.c (gfc_trans_integer_select,
        * gfc_trans_logical_select,
        gfc_trans_character_select): Ditto.
        * parse.c (resolve_all_program_units): For error recovery, avoid
        segfault is proc_name is NULL.

2011-01-13  Tobias Burnus  <burnus@net-b.de>
            Mikael Morin  <mikael@gcc.gnu.org>

        PR fortran/45848
        PR fortran/47204
        * gfortran.dg/select_type_20.f90: New.
        * gfortran.dg/select_type_21.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/select_type_20.f90
    trunk/gcc/testsuite/gfortran.dg/select_type_21.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/dump-parse-tree.c
    trunk/gcc/fortran/frontend-passes.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/match.c
    trunk/gcc/fortran/parse.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/st.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/testsuite/ChangeLog
Comment 6 Tobias Burnus 2011-01-13 16:40:12 UTC
FIXED on the trunk (4.6). Thanks for the report Zdenek! And thanks for the
analysis (in PR45848) Mikael!