This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36767] [4.3/4.4 Regression] Segmentation fault with -fprofile-arcs -O2
- From: "dodji at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Jul 2008 18:25:11 -0000
- Subject: [Bug c++/36767] [4.3/4.4 Regression] Segmentation fault with -fprofile-arcs -O2
- References: <bug-36767-16437@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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