diff options
| author | Tetralux <1348560+Tetralux@users.noreply.github.com> | 2019-01-16 17:07:43 +0000 |
|---|---|---|
| committer | Tetralux <1348560+Tetralux@users.noreply.github.com> | 2019-01-16 17:22:25 +0000 |
| commit | 46c610d6e59e0becad790c795f4b1ff159da3a79 (patch) | |
| tree | d0a2e736a734cb1541a0a9c6670cd689ecdeec52 /src/types.cpp | |
| parent | db2eff6847d61fb0c2f97f5b43e84300dc8865c8 (diff) | |
Fix printing IR of integer as a pointer with endianness.
When converting an integer value into a pointer and writing out the IR
for it in 'ir_print_exact_value', 'is_type_integer_endian_{little,big}'
did not correct handle being asked about pointer types.
They now reply with whether the endianness of 'uintptr' matches the
endianness being asked about.
Diffstat (limited to 'src/types.cpp')
| -rw-r--r-- | src/types.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/types.cpp b/src/types.cpp index eb850fa66..52c06ef71 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -1041,6 +1041,8 @@ bool is_type_integer_endian_big(Type *t) { return build_context.endian_kind == TargetEndian_Big; } else if (t->kind == Type_BitSet) { return is_type_integer_endian_big(bit_set_to_int(t)); + } else if (t->kind == Type_Pointer) { + return is_type_integer_endian_big(&basic_types[Basic_uintptr]); } else { GB_PANIC("Unsupported type: %s", type_to_string(t)); } @@ -1058,6 +1060,8 @@ bool is_type_integer_endian_little(Type *t) { return build_context.endian_kind == TargetEndian_Little; } else if (t->kind == Type_BitSet) { return is_type_integer_endian_little(bit_set_to_int(t)); + } else if (t->kind == Type_Pointer) { + return is_type_integer_endian_little(&basic_types[Basic_uintptr]); } else { GB_PANIC("Unsupported type: %s", type_to_string(t)); } |