if (this->length_ != NULL)
{
Numeric_constant nc;
- unsigned long val;
- if (!this->length_->numeric_constant_value(&nc)
- || nc.to_unsigned_long(&val) != Numeric_constant::NC_UL_VALID)
+ if (!this->length_->numeric_constant_value(&nc))
{
- if (!this->issued_length_error_)
- {
- error_at(this->length_->location(), "invalid array length");
- this->issued_length_error_ = true;
- }
+ go_assert(saw_errors());
+ return;
}
- else
+ mpz_t val;
+ if (!nc.to_int(&val))
{
- char buf[50];
- snprintf(buf, sizeof buf, "%lu", val);
- ret->append(buf);
+ go_assert(saw_errors());
+ return;
}
+ char* s = mpz_get_str(NULL, 10, val);
+ ret->append(s);
+ free(s);
+ mpz_clear(val);
}
ret->push_back(']');
if (this->length_ != NULL)
{
Numeric_constant nc;
- unsigned long val;
- if (!this->length_->numeric_constant_value(&nc)
- || nc.to_unsigned_long(&val) != Numeric_constant::NC_UL_VALID)
+ if (!this->length_->numeric_constant_value(&nc))
{
- if (!this->issued_length_error_)
- {
- error_at(this->length_->location(), "invalid array length");
- this->issued_length_error_ = true;
- }
+ go_assert(saw_errors());
+ return;
}
- else
+ mpz_t val;
+ if (!nc.to_int(&val))
{
- char buf[50];
- snprintf(buf, sizeof buf, "%lu", val);
- ret->append(buf);
+ go_assert(saw_errors());
+ return;
}
+ char *s = mpz_get_str(NULL, 10, val);
+ ret->append(s);
+ free(s);
+ mpz_clear(val);
}
ret->push_back('e');
}