------- Comment #2 from burnus at gcc dot gnu dot org 2010-09-02 11:32 ------- Confirm: It compiles with g95 and NAG f95, but ICEs with gfortran (4.1 to 4.6) and a couple of other compilers.
My feeling is that the program is invalid - at least in case the actual argument is not present. The program compiles (and runs) if one passes an actual argument - thus the problem only occurs very late during folding. The best probably would be to add a warning (default on?) and some conditions around the expression such that it remains valid for folding even if the argument is not present. Due to the complexity of fixing it for invalid programs - without having a chance to print an error message at compile time, I have reduced the priority to minor. Valgrind shows: ==5725== Invalid read of size 8 ==5725== at 0x896636: get_frame_type (tree-nested.c:223) ==5725== by 0x896BFF: get_chain_decl (tree-nested.c:330) ==5725== by 0x899ED5: get_nonlocal_debug_decl (tree-nested.c:842) ==5725== by 0x89A7C1: convert_nonlocal_reference_op (tree-nested.c:920) ==5725== by 0x9D0B66: walk_tree_1 (tree.c:10174) ==5725== by 0x70F96B: walk_gimple_op (gimple.c:1356) -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|critical |minor Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |ice-on-invalid-code Known to fail| |4.2.1 4.1.2 4.3.4 4.4.0 | |4.5.1 4.6.0 Last reconfirmed|0000-00-00 00:00:00 |2010-09-02 11:32:28 date| | Summary|ICE: For character function |ICE: For character function |with length specifier |with length specifier |dependent on non-present |dependent on non-present arg |arg. | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45495