http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
--- Comment #6 from janus at gcc dot gnu.org 2012-11-05 17:45:23 UTC --- Created attachment 28620 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28620 patch Here is an extended patch, based on comment 3, which fixes the storage_size_3 wrong-code problem (cf. gfc_trans_deferred_vars) and corrects the __builtin_free counts in the test cases. It still fails on the following: FAIL: gfortran.dg/c_ptr_tests_16.f90 -O scan-tree-dump-times optimized "i_do_not_exist" 0 FAIL: gfortran.dg/coarray_lib_alloc_2.f90 -O scan-tree-dump-times original "_gfortran_caf_deregister .&xx._data.token, 0B, 0B, 0.;" 1 FAIL: gfortran.dg/intent_optimize_1.f90 -O scan-tree-dump-times optimized "does_not_exist" 0 FAIL: gfortran.dg/volatile4.f90 -O scan-tree-dump-not optimized "NonVolatileNotOptimizedAway" FAIL: gfortran.dg/volatile6.f90 -O scan-tree-dump-not optimized "NonVolatileNotOptimizedAway1" Except for one coarray issue, those seem to be problems with optimizing away stuff in certain situations (I haven't checked any details yet).