linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sparse-llvm switch constants must all be same type as switch value
@ 2017-03-13 21:24 Dibyendu Majumdar
  2017-03-19  0:52 ` Luc Van Oostenryck
  0 siblings, 1 reply; 4+ messages in thread
From: Dibyendu Majumdar @ 2017-03-13 21:24 UTC (permalink / raw)
  To: Linux-Sparse

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);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-19 15:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2017-03-19 12:31   ` Dibyendu Majumdar
2017-03-19 15:19     ` Luc Van Oostenryck

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).