[cfe-dev] [LLVMdev] ubsan - active member check for unions

Alex Rosenberg alexr at leftfield.org
Sat Dec 20 10:08:34 PST 2014


And SIMD vector types.

Every compiler I've worked on exempted union trickery from alias analysis assumptions for compatibility reasons.

That said, more diagnostics, including optional sanitizer checks is welcome here.

Alex

On Dec 20, 2014, at 5:39 AM, Caldarale, Charles R <Chuck.Caldarale at unisys.com> wrote:

>> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] 
>> On Behalf Of Joerg Sonnenberger
>> Subject: Re: [LLVMdev] [cfe-dev] ubsan - active member check for unions
> 
>>> On Fri, Dec 19, 2014 at 06:59:48PM -0800, Richard Smith wrote:
>>>> On Thu, Dec 18, 2014 at 11:05 PM, Yury Gribov <y.gribov at samsung.com> wrote:
>>>> Anyway, the pattern is so widespread that IMHO most maintainers will find
>>>> such errors useless.
> 
>>> Well, given that this is the bug that the sanitizer is built to detect,
>>> such maintainers should not turn it on.
> 
>> I agree with Yury that there are a few cases where it is the standard
>> approach and flagging it as error doesn't make sense. Question is
>> whether we can enumerate those cases and white list them. I know unions
>> are used in mathematical code for accesing floats as int and vice versa,
>> not sure about any thing else.
> 
> Often used when dealing with bare hardware and the types of fields are dependent on other information, so several are folded into one union.
> 
> - Chuck
> 
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the cfe-dev mailing list