summaryrefslogtreecommitdiffhomepage
path: root/ir/be/begnuas.c
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2015-10-06 10:33:10 +0200
committerMatthias Braun <matze@braunis.de>2015-10-06 10:33:10 +0200
commit57e10dc3ab836c8da9f4d9fa38d97f9918214e9d (patch)
tree2fbb5ab3ac9acd117b56397d33990a9d0cc0636f /ir/be/begnuas.c
parentea4b6f7512ba31c361566c84a26b1a267911f9dc (diff)
begnuas: It is not allowed to ask an alias entity for an initializer
Diffstat (limited to 'ir/be/begnuas.c')
-rw-r--r--ir/be/begnuas.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ir/be/begnuas.c b/ir/be/begnuas.c
index 955ed4e..995a1c2 100644
--- a/ir/be/begnuas.c
+++ b/ir/be/begnuas.c
@@ -392,6 +392,8 @@ static bool entity_is_string_const(const ir_entity *ent, bool only_suffix_null)
static bool entity_is_zero_initialized(ir_entity const *entity)
{
+ if (is_alias_entity(entity))
+ return false;
ir_initializer_t *initializer = get_entity_initializer(entity);
return initializer != NULL && initializer_is_null(initializer);
}
@@ -931,6 +933,9 @@ static unsigned long compute_entity_size(ir_entity const *const entity)
{
ir_type *const type = get_entity_type(entity);
unsigned long size = get_type_size_bytes(type);
+ if (is_alias_entity(entity))
+ return size;
+
/* Note that for variable array/compound types we may have to inspect the
* initializer to get the actual size */
ir_initializer_t const *const initializer = get_entity_initializer(entity);