* [LTO]: PATCH: Avoid being confused by TRANSLATION_UNIT_DECL
@ 2007-08-06 0:30 Mark Mitchell
0 siblings, 0 replies; only message in thread
From: Mark Mitchell @ 2007-08-06 0:30 UTC (permalink / raw)
To: gcc-patches; +Cc: zadeck
Kenny --
The problem that you ran into with structure types was due to the
DWARF writer not handling TRANSLATION_UNIT_DECL. This patch fixes
that oversight.
However, trying to process this program in the LTO reader blows up in
build_decl for a local variable; it appears that you're creating a
VAR_DECL without giving it a type, and that makes the middle end
unhappy.
struct S {
int x;
int y;
};
int foo (void) {
struct S s;
return s.x;
}
Committed.
Thanks,
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
2007-08-05 Mark Mitchell <mark@codesourcery.com>
* tree.h (FILE_SCOPE_P): New macro.
(DECL_FILE_SCOPE_P): Use it.
* dwarf2out.c (lto_type_ref): Use FILE_SCOPE_P to test whether
an entity is at file scope.
Index: gcc/tree.h
===================================================================
--- gcc/tree.h (revision 127226)
+++ gcc/tree.h (working copy)
@@ -2667,10 +2667,14 @@ struct tree_memory_partition_tag GTY(())
#define DECL_POINTER_ALIAS_SET_KNOWN_P(NODE) \
(DECL_POINTER_ALIAS_SET (NODE) != - 1)
+/* Nonzero for a scope (e.g., the value of either DECL_CONTEXT or
+ TYPE_CONTEXT) which is the file scope. */
+#define FILE_SCOPE_P(SCOPE) \
+ (!(SCOPE) || TREE_CODE (SCOPE) == TRANSLATION_UNIT_DECL)
+
/* Nonzero for a decl which is at file scope. */
-#define DECL_FILE_SCOPE_P(EXP) \
- (! DECL_CONTEXT (EXP) \
- || TREE_CODE (DECL_CONTEXT (EXP)) == TRANSLATION_UNIT_DECL)
+#define DECL_FILE_SCOPE_P(EXP) \
+ FILE_SCOPE_P (DECL_CONTEXT (EXP))
/* Nonzero for a decl that is decorated using attribute used.
This indicates compiler tools that this decl needs to be preserved. */
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c (revision 127226)
+++ gcc/dwarf2out.c (working copy)
@@ -14929,7 +14929,7 @@ lto_type_ref (tree type, lto_out_ref *re
gcc_assert (TYPE_P (type));
scope = TYPE_CONTEXT (type);
- if (scope)
+ if (!FILE_SCOPE_P (scope))
{
/* We do not yet support lexically scoped types. */
sorry ("nested types are not supported by LTO");
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-08-06 0:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-06 0:30 [LTO]: PATCH: Avoid being confused by TRANSLATION_UNIT_DECL Mark Mitchell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).