Menu

#2751 signedness for char needs to matter more

closed-fixed
None
Front-end
5
2019-03-29
2018-05-16
No

SDCC should take signedness of char more seriously. SDCC compiles

unsigned char *uc = "test";
signed char *sc = "test";
char *c = "test";

without warning or error. But the first and second are a constarint violation, requiring a diagnostic. I suggest a warning.

Also,

const char *g;

void f(void)
{
    g = _Generic("test"[0], char: "char", unsigned char: "unsigned char", signed char: "signed char");
}

gives an error ("error 228: multiple matching expressions in generic association"), but shouldn't.

Philipp

Related

Bugs: #2864

Discussion

  • Philipp Klaus Krause

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,4 @@
    -SDCC should take signednedd of char more seriously. SDCC compiles
    +SDCC should take signedness of char more seriously. SDCC compiles
    
     ~~~~
     unsigned char *uc = "test";
    
     
  • Philipp Klaus Krause

    • assigned_to: Philipp Klaus Krause
     
  • Philipp Klaus Krause

    • status: open --> closed-fixed
     
  • Philipp Klaus Krause

    Fixed in [r11150].

    Philipp

     

Log in to post a comment.

MongoDB Logo MongoDB