compiler/libec: Fix for sizeof to be of uintsize type
authorJerome St-Louis <jerome@ecere.com>
Tue, 27 May 2014 08:33:28 +0000 (04:33 -0400)
committerJerome St-Louis <jerome@ecere.com>
Tue, 27 May 2014 08:33:28 +0000 (04:33 -0400)
compiler/bootstrap/libec/bootstrap/pass15.c
compiler/libec/src/pass15.ec

index 774a7a8..5857fa4 100644 (file)
@@ -2795,7 +2795,7 @@ if(type->arraySizeExp)
 {
 ProcessExpressionType(type->arraySizeExp);
 ComputeExpression(type->arraySizeExp);
-if(!type->arraySizeExp->isConstant || (type->arraySizeExp->expType->kind != 3 && type->arraySizeExp->expType->kind != 15 && (type->arraySizeExp->expType->kind != 8 || !type->arraySizeExp->expType->_class->registered || type->arraySizeExp->expType->_class->registered->type != 4)))
+if(!type->arraySizeExp->isConstant || (type->arraySizeExp->expType->kind != 3 && type->arraySizeExp->expType->kind != 2 && type->arraySizeExp->expType->kind != 1 && type->arraySizeExp->expType->kind != 5 && type->arraySizeExp->expType->kind != 4 && type->arraySizeExp->expType->kind != 23 && type->arraySizeExp->expType->kind != 22 && type->arraySizeExp->expType->kind != 15 && (type->arraySizeExp->expType->kind != 8 || !type->arraySizeExp->expType->_class->registered || type->arraySizeExp->expType->_class->registered->type != 4)))
 {
 struct Location oldLoc = yylloc;
 char expression[10240];
@@ -14568,7 +14568,7 @@ if(exp->op.op == SIZEOF)
 exp->expType = __extension__ ({
 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
 
-__ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
+__ecereInstance1->refCount = 1, __ecereInstance1->kind = 23, __ecereInstance1;
 });
 exp->isConstant = 0x1;
 }
@@ -16393,7 +16393,7 @@ exp->member.member = MkIdentifier("structSize");
 exp->expType = __extension__ ({
 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
 
-__ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
+__ecereInstance1->refCount = 1, __ecereInstance1->kind = 23, __ecereInstance1;
 });
 break;
 }
@@ -16404,7 +16404,7 @@ struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->decla
 exp->expType = __extension__ ({
 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
 
-__ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
+__ecereInstance1->refCount = 1, __ecereInstance1->kind = 23, __ecereInstance1;
 });
 exp->isConstant = 0x1;
 DeclareType(type, 0x0, 0x0);
index dea1f00..7f4b5dd 100644 (file)
@@ -769,7 +769,14 @@ public int ComputeTypeSize(Type type)
             {
                ProcessExpressionType(type.arraySizeExp);
                ComputeExpression(type.arraySizeExp);
-               if(!type.arraySizeExp.isConstant || (type.arraySizeExp.expType.kind != intType && type.arraySizeExp.expType.kind != enumType &&
+               if(!type.arraySizeExp.isConstant || (type.arraySizeExp.expType.kind != intType &&
+                  type.arraySizeExp.expType.kind != shortType &&
+                  type.arraySizeExp.expType.kind != charType &&
+                  type.arraySizeExp.expType.kind != longType &&
+                  type.arraySizeExp.expType.kind != int64Type &&
+                  type.arraySizeExp.expType.kind != intSizeType &&
+                  type.arraySizeExp.expType.kind != intPtrType &&
+                  type.arraySizeExp.expType.kind != enumType &&
                   (type.arraySizeExp.expType.kind != classType || !type.arraySizeExp.expType._class.registered || type.arraySizeExp.expType._class.registered.type != enumClass)))
                {
                   Location oldLoc = yylloc;
@@ -8359,7 +8366,7 @@ void ProcessExpressionType(Expression exp)
             exp.expType = Type
             {
                refCount = 1;
-               kind = intType;
+               kind = intSizeType;
             };
             exp.isConstant = true;
          }
@@ -10423,7 +10430,7 @@ void ProcessExpressionType(Expression exp)
          exp.expType = Type
          {
             refCount = 1;
-            kind = intType;
+            kind = intSizeType;
          };
          // exp.isConstant = true;
          break;
@@ -10435,7 +10442,7 @@ void ProcessExpressionType(Expression exp)
          exp.expType = Type
          {
             refCount = 1;
-            kind = intType;
+            kind = intSizeType;
          };
          exp.isConstant = true;