- if (len >= 0) {
- tarval *tv = new_tarval_from_long(len, get_type_mode(res_tp));
- return new_Const_type(tv, res_tp);
+
+ if (!has_entity_initializer(ent))
+ return NULL;
+
+ initializer = get_entity_initializer(ent);
+ if (get_initializer_kind(initializer) != IR_INITIALIZER_COMPOUND)
+ return NULL;
+
+ size = get_initializer_compound_n_entries(initializer);
+ for (i = 0; i < size; ++i) {
+ ir_initializer_t *val = get_initializer_compound_value(initializer, i);
+ if (initializer_val_is_null(val)) {
+ tarval *tv = new_tarval_from_long(i, get_type_mode(res_tp));
+ return new_Const_type(tv, res_tp);
+ }