Skip to content

Inconsistent error in analysis #152

Open
@chqrlie

Description

@chqrlie

I had a surprising behavior for my latest patch, where c2c reports an error on linux platform but not on Darwin:

parser/c2_tokenizer.c2:1559:11: error: implicit conversion changes signedness: 'u8' to 'i32'
    i32 c = *p++;
          ^

p is defined as const u8 *p;

This is a problem for 2 reasons:

  • the error is not reported on Darwin, hence there must be something fishy going on that makes the behavior platform dependent where it should not.
  • storing an unsigned 8-bit value into a 32-bit signed integer should not be considered an error: the value is preserved, the signedness is irrelevant in this operation and the workaround using a cast is ugly and risky (as all casts).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions