aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-11-18 14:11:00 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-11-18 14:11:00 +0000
commitd96283a052cc3e9db9c7fc3e1cf3f85632611de2 (patch)
treeb2c49004f166fcec255984c6e6153956e4cc6b9a /gcc
parent8a510ddbcf92c274d72175c28a4291fb60bba68f (diff)
downloadgcc-d96283a052cc3e9db9c7fc3e1cf3f85632611de2.zip
gcc-d96283a052cc3e9db9c7fc3e1cf3f85632611de2.tar.gz
gcc-d96283a052cc3e9db9c7fc3e1cf3f85632611de2.tar.bz2
re PR lto/45089 (-Os -g -fwhopr dwarf2out ICE)
2010-11-18 Richard Guenther <rguenther@suse.de> PR lto/45089 * dwarf2out.c (add_AT_die_ref): Work around LTO losing types when checking is not enabled. From-SVN: r166904
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/dwarf2out.c9
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3e589d2..9490dd3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2010-11-18 Richard Guenther <rguenther@suse.de>
+ PR lto/45089
+ * dwarf2out.c (add_AT_die_ref): Work around LTO losing types
+ when checking is not enabled.
+
+2010-11-18 Richard Guenther <rguenther@suse.de>
+
PR lto/46525
* gimple.c (gimple_register_type): Update TYPE_MAIN_VARIANT of
type leaders.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 4eade28..ea3852e 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -7362,6 +7362,15 @@ add_AT_die_ref (dw_die_ref die, enum dwarf_attribute attr_kind, dw_die_ref targ_
{
dw_attr_node attr;
+#ifdef ENABLE_CHECKING
+ gcc_assert (targ_die != NULL);
+#else
+ /* With LTO we can end up trying to reference something we didn't create
+ a DIE for. Avoid crashing later on a NULL referenced DIE. */
+ if (targ_die == NULL)
+ return;
+#endif
+
attr.dw_attr = attr_kind;
attr.dw_attr_val.val_class = dw_val_class_die_ref;
attr.dw_attr_val.v.val_die_ref.die = targ_die;