mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 23:32:27 +00:00
Fix some signed vs. unsigned issues in array and vector handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52664 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2d0d59380a
commit
46e803b3e6
@ -1538,10 +1538,10 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
|
|||||||
uint64_t NumElements = ATy->getNumElements();
|
uint64_t NumElements = ATy->getNumElements();
|
||||||
|
|
||||||
// Verify that we have the correct size...
|
// Verify that we have the correct size...
|
||||||
if (NumElements != -1 && NumElements != (int)$3->size())
|
if (NumElements != uint64_t(-1) && NumElements != $3->size())
|
||||||
GEN_ERROR("Type mismatch: constant sized array initialized with " +
|
GEN_ERROR("Type mismatch: constant sized array initialized with " +
|
||||||
utostr($3->size()) + " arguments, but has size of " +
|
utostr($3->size()) + " arguments, but has size of " +
|
||||||
itostr(NumElements) + "");
|
utostr(NumElements) + "");
|
||||||
|
|
||||||
// Verify all elements are correct type!
|
// Verify all elements are correct type!
|
||||||
for (unsigned i = 0; i < $3->size(); i++) {
|
for (unsigned i = 0; i < $3->size(); i++) {
|
||||||
@ -1564,9 +1564,9 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
|
|||||||
(*$1)->getDescription() + "'");
|
(*$1)->getDescription() + "'");
|
||||||
|
|
||||||
uint64_t NumElements = ATy->getNumElements();
|
uint64_t NumElements = ATy->getNumElements();
|
||||||
if (NumElements != -1 && NumElements != 0)
|
if (NumElements != uint64_t(-1) && NumElements != 0)
|
||||||
GEN_ERROR("Type mismatch: constant sized array initialized with 0"
|
GEN_ERROR("Type mismatch: constant sized array initialized with 0"
|
||||||
" arguments, but has size of " + itostr(NumElements) +"");
|
" arguments, but has size of " + utostr(NumElements) +"");
|
||||||
$$ = ConstantArray::get(ATy, std::vector<Constant*>());
|
$$ = ConstantArray::get(ATy, std::vector<Constant*>());
|
||||||
delete $1;
|
delete $1;
|
||||||
CHECK_FOR_ERROR
|
CHECK_FOR_ERROR
|
||||||
@ -1581,13 +1581,13 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
|
|||||||
|
|
||||||
uint64_t NumElements = ATy->getNumElements();
|
uint64_t NumElements = ATy->getNumElements();
|
||||||
const Type *ETy = ATy->getElementType();
|
const Type *ETy = ATy->getElementType();
|
||||||
if (NumElements != -1 && NumElements != int($3->length()))
|
if (NumElements != uint64_t(-1) && NumElements != $3->length())
|
||||||
GEN_ERROR("Can't build string constant of size " +
|
GEN_ERROR("Can't build string constant of size " +
|
||||||
itostr((int)($3->length())) +
|
utostr($3->length()) +
|
||||||
" when array has size " + itostr(NumElements) + "");
|
" when array has size " + utostr(NumElements) + "");
|
||||||
std::vector<Constant*> Vals;
|
std::vector<Constant*> Vals;
|
||||||
if (ETy == Type::Int8Ty) {
|
if (ETy == Type::Int8Ty) {
|
||||||
for (unsigned i = 0; i < $3->length(); ++i)
|
for (uint64_t i = 0; i < $3->length(); ++i)
|
||||||
Vals.push_back(ConstantInt::get(ETy, (*$3)[i]));
|
Vals.push_back(ConstantInt::get(ETy, (*$3)[i]));
|
||||||
} else {
|
} else {
|
||||||
delete $3;
|
delete $3;
|
||||||
@ -1609,10 +1609,10 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
|
|||||||
unsigned NumElements = PTy->getNumElements();
|
unsigned NumElements = PTy->getNumElements();
|
||||||
|
|
||||||
// Verify that we have the correct size...
|
// Verify that we have the correct size...
|
||||||
if (NumElements != -1 && NumElements != (int)$3->size())
|
if (NumElements != unsigned(-1) && NumElements != (unsigned)$3->size())
|
||||||
GEN_ERROR("Type mismatch: constant sized packed initialized with " +
|
GEN_ERROR("Type mismatch: constant sized packed initialized with " +
|
||||||
utostr($3->size()) + " arguments, but has size of " +
|
utostr($3->size()) + " arguments, but has size of " +
|
||||||
itostr(NumElements) + "");
|
utostr(NumElements) + "");
|
||||||
|
|
||||||
// Verify all elements are correct type!
|
// Verify all elements are correct type!
|
||||||
for (unsigned i = 0; i < $3->size(); i++) {
|
for (unsigned i = 0; i < $3->size(); i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user