[PATCH] in C mode, __builtin_va_start tries to accept a reference, sees a record, decides it's a C++ class, then crashes because it isn't

Richard Smith richard at metafoo.co.uk
Thu Aug 8 11:32:52 PDT 2013


Right, but the root cause of the problem is that __builtin_va_start uses a
reference type in C mode. Your patch is fixing one of the places where that
doesn't work. So we have a choice: either we accept the cost of making
references work well enough in C to handle this weird case, or we pick a
different implementation strategy for __builtin_va_start. We don't have
many options, because the type of va_list is determined by the ABI and the
behavior of __builtin_va_start is defined by GCC, but we may be able to
(for instance) inject a "#define __builtin_va_start(list, ...)
__builtin_va_start_ptr(&(list), __VA_ARGS__)" rather than using a reference
type.

On Thu, Aug 8, 2013 at 12:43 AM, Artyom Skrobov <Artyom.Skrobov at arm.com>wrote:

>  Richard, my patch doesn’t add support for reference types in C – it only
> adds the proper type-checking so that clang emits a meaningful error
> diagnostic in this case, instead of crashing with a segfault.****
>
> ** **
>
> ** **
>
> *From:* metafoo at gmail.com [mailto:metafoo at gmail.com] *On Behalf Of *Richard
> Smith
> *Sent:* 08 August 2013 00:57
> *To:* Artyom Skrobov
> *Cc:* Anton Korobeynikov; cfe-commits at cs.uiuc.edu
>
> *Subject:* Re: [PATCH] in C mode, __builtin_va_start tries to accept a
> reference, sees a record, decides it's a C++ class, then crashes because it
> isn't****
>
>  ** **
>
> This is truly hideous. Do we *really* want to support reference types in
> C, just so that we can handle __builtin_va_start?****
>
> ** **
>
> On Tue, Aug 6, 2013 at 8:26 AM, Artyom Skrobov <Artyom.Skrobov at arm.com>
> wrote:****
>
> Anton, thank you for your suggestion.
>
> Re-submitting the patch as an attachment.****
>
>
>
> -----Original Message-----
> From: Anton Korobeynikov [mailto:anton at korobeynikov.info]
> Sent: 05 August 2013 23:24
> To: Artyom Skrobov
> Cc: cfe-commits at cs.uiuc.edu
> Subject: Re: [PATCH] in C mode, __builtin_va_start tries to accept a
> reference, sees a record, decides it's a C++ class, then crashes because it
> isn't
>
> Please consider reading
> http://llvm.org/docs/DeveloperPolicy.html#making-a-patch
>
>
> ****
>
> -- IMPORTANT NOTICE: The contents of this email and any attachments are
> confidential and may also be privileged. If you are not the intended
> recipient, please notify the sender immediately and do not disclose the
> contents to any other person, use it for any purpose, or store or copy the
> information in any medium.  Thank you.****
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits****
>
> ** **
>
> -- IMPORTANT NOTICE: The contents of this email and any attachments are
> confidential and may also be privileged. If you are not the intended
> recipient, please notify the sender immediately and do not disclose the
> contents to any other person, use it for any purpose, or store or copy the
> information in any medium. Thank you.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130808/77dd2b59/attachment.html>


More information about the cfe-commits mailing list