This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Record Types and Arrays
- From: Philip Herron <redbrain at gcc dot gnu dot org>
- To: GCC <gcc-help at gcc dot gnu dot org>
- Date: Thu, 3 Mar 2011 17:57:26 +0000
- Subject: Record Types and Arrays
Hi
I had this problem ages ago but only this last month getting properly
back into my gcc work again on a more stable basis and i never really
fixed this problem say for example in C code you could do something
like:
struct foo {
int x;
float y;
}
static struct foo x[] = {
{1,1.5},
{2,1.5}
{0,0},
......
}
And these are toplevel declarations outside of function blocks etc. I
am able to create the record type fine, but when i try to add a top
level var_decl using something like:
tree array_type = build_array_type (gpy_callable_type,
build_index_type (build_int_cst
(integer_type_node,
VEC_length(tree,gpy_function_decls))) );
tree callable_var_decl = build_decl (BUILTINS_LOCATION,VAR_DECL,
get_identifier("__gpy_module_main_callables"),
array_type);
DECL_ARTIFICIAL (callable_var_decl) = 1;
TREE_STATIC (callable_var_decl) = 1;
TREE_PUBLIC (callable_var_decl) = 1;
TREE_USED (callable_var_decl) = 1;
I get gimple dump output (although you dont see toplevel decls in
gimple for some reason) but no assembler output. I am not quite sure
what i am doing wrong with this.
--Phil