This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/36767] [4.3/4.4 Regression] Segmentation fault with -fprofile-arcs -O2



------- Comment #6 from dodji at gcc dot gnu dot org  2008-07-22 18:25 -------
@jakub: I confirm that doing:

if (!DECL_CONTEXT (decl))
    { 
      DECL_CONTEXT (decl) = current_function_decl;
    }
at the beginning of one_static_initialization_or_destruction() allows the
compilation to not crash.

At that point, the name of current_function_decl is effectively
"__static_initialization_and_destruction_0".

I am not sure if setting DECL_CONTEXT (decl) is safe to do, because the
DECL_CONTEXT (decl) being NULL means the variable happened in the global
namespace. Doing DECL_CONTEXT (decl) = current_function_decl makes us loose
that information.

On the other hand, one_static_initialization_or_destruction() is called at the
end of the parsing+semantic analysis phase, so loosing that information might
not be harmful (I am not sure). In which case, this candidate fix might be
enough.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36767


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]