Re: Output from linearize and LLVM error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27 January 2017 at 14:00, Dibyendu Majumdar <mobile@xxxxxxxxxxxxxxx> wrote:
> struct foo {
>         int i;
> };
> typedef struct foo foo;
> foo*  testfunc(void);
> foo* testfunc(void) {
>         foo *p = (foo *) malloc(sizeof(struct foo));
>         return p;
> }
>
> Here is the output from test-linearize:
>
> testfunc:
> .L0x7ffae85d1010:
>  <entry-point>
>  call.64     %r1 <- malloc, $4
>  cast.64     %r2 <- (64) %r1
>  ret.64      %r2
>
> The second LLVM assertion failure occurs in the cast to (64).
>

In linearize.c:

static struct instruction *alloc_cast_instruction(struct symbol *src,
struct symbol *ctype)
{
 int opcode = OP_CAST;
 struct symbol *base = src;
 if (base->ctype.modifiers & MOD_SIGNED)
  opcode = OP_SCAST;
 if (base->type == SYM_NODE)
  base = base->ctype.base_type;
 if (base->type == SYM_PTR) {
  base = base->ctype.base_type;
  if (base != &void_ctype)
   opcode = OP_PTRCAST;
 }
 if (base->ctype.base_type == &fp_type)
  opcode = OP_FPCAST;
 return alloc_typed_instruction(opcode, ctype);
}

So if base->type is SYM_PTR but base->c.type.base_type is not void
then the cast instruction is left as OP_CAST, but it should be
OP_PTRCAST regardless?

Thanks and Regards
Dibyendu
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux