From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Dibyendu Majumdar <mobile@majumdar.org.uk>
Cc: Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: sparse-llvm switch constants must all be same type as switch value
Date: Sun, 19 Mar 2017 01:52:46 +0100 [thread overview]
Message-ID: <20170319005245.os6jl436ajvqiyud@macpro.local> (raw)
In-Reply-To: <CACXZuxfOP79gJbOD=02pPYWV4HQbnN0tRVWup77_etBxvhjAAQ@mail.gmail.com>
On Mon, Mar 13, 2017 at 09:24:47PM +0000, Dibyendu Majumdar wrote:
> Hi,
>
> While investigating errors that occurred when compiling 'minilua' I
> found that the sparse-llvm output for switch statements is hard coded
> to generate int32 values even when the switch is on a different
> integer type. I believe following fix is needed in output_op_switch():
>
> FOR_EACH_PTR(insn->multijmp_list, jmp) {
> if (jmp->begin == jmp->end) { /* case N */
> LLVMAddCase(target,
> LLVMConstInt(LLVMTypeOf(sw_val), jmp->begin, 0),
> jmp->target->priv);
> } else if (jmp->begin < jmp->end) { /* case M..N */
> assert(0);
> }
> } END_FOR_EACH_PTR(jmp);
There is also a problem with signed/unsigned constants,
like everywhere else in the code.
Could you submit a test case for this?
-- Luc
next prev parent reply other threads:[~2017-03-19 0:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-13 21:24 sparse-llvm switch constants must all be same type as switch value Dibyendu Majumdar
2017-03-19 0:52 ` Luc Van Oostenryck [this message]
2017-03-19 12:31 ` Dibyendu Majumdar
2017-03-19 15:19 ` Luc Van Oostenryck
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=20170319005245.os6jl436ajvqiyud@macpro.local \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
--cc=mobile@majumdar.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).