All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dibyendu Majumdar <mobile@majumdar.org.uk>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: Potential issue with handling of va_arg()
Date: Sat, 1 Apr 2017 13:56:54 +0100	[thread overview]
Message-ID: <CACXZuxfznvD82rF5nk9xu4gbFmzDy9Qw7+vpJJSCgijsBSwO4g@mail.gmail.com> (raw)
In-Reply-To: <CAMHZB6GHpSktsr3V4UyQvMKWuCmpDekbd297QRcwAuq2tGkh+Q@mail.gmail.com>

Hi Luc,

On 31 March 2017 at 19:55, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
> On Fri, Mar 31, 2017 at 4:06 PM, Dibyendu Majumdar
> <mobile@majumdar.org.uk> wrote:
>> On 31 March 2017 at 14:47, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
>>> I am investigating a failure in this test:
>>>
>>> #include <stdarg.h>
>>> #include <stdlib.h>
>>> #include <stdio.h>
>>>
>>> void error_message(const char *fmt, ...) {
>>> va_list argp;
>>> va_start(argp, fmt);
>>
>> I think this might be because the macro __builtin_va_start() is being
>> defined in sparse but this doesn't match what gets defined by gcc? I
>> see this in sparse:
>>
>
> Current support for vaarg is more faked than anything else.
> There is just the minimum needed to be able to do correct parsing
> of code using it but there is nothing behind it.
>

Okay, I think a workaround for sparse-llvm is to disable generation of
the macros related to var arg processing - this will cause the
compilation to fail with undefined errors, rather than silently
generating bad code. I have done this in dmr_C where the relevant
macros are not defined when llvm backend is being used. I was
experiencing crashes with minilua due to this issue - I have reworked
minilua so that the functions that rely upon var arg processing are
moved to a separate source file which cannot be compiled with
sparse-llvm.

For my use case the var arg issue is not a pressing issue to fix, what
is more important is that bad code is never generated and the cases
not handled correctly are detected early and compilation fails.

Thanks and Regards
Dibyendu

      reply	other threads:[~2017-04-01 12:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 13:47 Potential issue with handling of va_arg() Dibyendu Majumdar
2017-03-31 14:06 ` Dibyendu Majumdar
2017-03-31 14:34   ` Dibyendu Majumdar
2017-03-31 18:55   ` Luc Van Oostenryck
2017-04-01 12:56     ` Dibyendu Majumdar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACXZuxfznvD82rF5nk9xu4gbFmzDy9Qw7+vpJJSCgijsBSwO4g@mail.gmail.com \
    --to=mobile@majumdar.org.uk \
    --cc=linux-sparse@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.