[PATCH] Reject bitcasts between address spaces with different sizes

Matt Arsenault arsenm2 at gmail.com
Fri Jul 5 12:32:20 PDT 2013


On Jul 4, 2013, at 12:55 , Nick Lewycky <nicholas at mxc.ca> wrote:
> 
> I share the same concerns. Another option is to make address space sizes a property of the module itself. Module already has a Module::getPointerSize method that doesn't rely on DataLayout, have you considered extending this for multiple address spaces?
> 

I didn't know that existed, but I don't see how it would change the current situation. It looks like it just scans through the same data layout string I was constructing the DataLayout from already instead of pre-parsing it. Is this a different datalayout string?

Without the datalayout, all pointers could be assumed to be the same size. That is effectively what happens already since there isn't really support for different sized pointers. Then adding a datalayout string with different sized address spaces could cause it to fail, but that also would be changing the meaning so I would think that's OK.

Actually, why would any of this upgrade stuff be necessary if casts between the same sizes are accepted? It made since when considering rejecting casts between across any address spaces. Different sized pointers doesn't actually work yet, so isn't a feature that anyone could be relying on yet.

The patch right now errors that datalayout is required if a bitcast happens with a nonzero address space. I could change this to just skip the check without it since all pointers would be assumed to be the same size.



More information about the llvm-commits mailing list