diff --git a/generator.c b/generator.c
index 179320aef7df8ffb4cf1aa4a6ecc3b4df4250f17..b0887aee7c82587beed212c50e56cac179a32b72 100644 (file)
--- a/generator.c
+++ b/generator.c
}
else if(type -> class == OBERON_TYPE_BOOLEAN)
{
- gcc_type = gcc_jit_context_get_type(gcc_context, GCC_JIT_TYPE_BOOL);
+ if(type -> size == sizeof(bool))
+ {
+ gcc_type = gcc_jit_context_get_type(gcc_context, GCC_JIT_TYPE_BOOL);
+ }
+ else
+ {
+ oberon_error(ctx, "generator: unsupported boolean size");
+ }
+ }
+ else if(type -> class == OBERON_TYPE_REAL)
+ {
+ if(type -> size == sizeof(float))
+ {
+ gcc_type = gcc_jit_context_get_type(gcc_context, GCC_JIT_TYPE_FLOAT);
+ }
+ else if(type -> size == sizeof(double))
+ {
+ gcc_type = gcc_jit_context_get_type(gcc_context, GCC_JIT_TYPE_DOUBLE);
+ }
+ else if(type -> size == sizeof(long double))
+ {
+ gcc_type = gcc_jit_context_get_type(gcc_context, GCC_JIT_TYPE_LONG_DOUBLE);
+ }
+ else
+ {
+ oberon_error(ctx, "generator: unsupported real size");
+ }
}
else if(type -> class == OBERON_TYPE_ARRAY)
{
case OBERON_TYPE_ARRAY:
size = type -> size;
type = type -> base;
+ size = (size == 0) ? (1) : (size);
size *= oberon_generator_get_type_size(ctx, type);
printf("array size: %i\n", size);
break;
right = gcc_jit_context_new_call_through_ptr(gcc_context, NULL, gcc_alloc, 1, &fnarg);
right = gcc_jit_context_new_cast(gcc_context, NULL, right, result_type);
}
+ else if(item -> mode == MODE_REAL)
+ {
+ gcc_jit_type * int_type = gcc_jit_context_get_type(gcc_context, GCC_JIT_TYPE_FLOAT);
+ right = gcc_jit_context_new_rvalue_from_int(gcc_context, int_type, item -> real);
+ }
else
{
oberon_error(ctx, "rvalue_from_item: invalid mode %i", item -> mode);