Fix miscompilation when cg_ssa is using multiple builders at the same time by bj...
source link: https://github.com/rust-lang/rustc_codegen_gcc/pull/131
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Outdated Show resolved
Outdated Show resolved
} else {
self.const_bitcast(value, ty)
}
self.const_bitcast(value, ty)
This does not look right. bitsize
could potentially be 1
, so are you sure the type will be the same size?
Only for a bool can bitsize be 1. A bool is represented as self.bool_type which is also 1 bit.
Oh, right, type_ix()
will return self.i8_type
which is 8 bits, like self.bool_type
.
In any case, it seems like the size is always equal, since the tests pass, but I'd also like an assert for the size.
Looks like .get_size()
doesn't work on pointer types. In addition it returns a byte size and not a bit size, so a bool would either be not supported or get a byte size of 1 despite having a bit size of 1.
get_size()
indeed only works on integers. If needed, I can make it work for pointer types.
That's a difference between LLVM and gcc: LLVM has a type i1
of "1 bit" for bool while GCC's bool is 8 bits.
type_ix(1)
needs to be a bool_type
. Seems like it is currently implemented as i8_type
.
Ok, can you add a TODO here saying to add an assert for the sizes, please?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK