davidgiven / ack

The Amsterdam Compiler Kit
http://tack.sf.net
Other
421 stars 60 forks source link

i80: negative case labels break switch statement #282

Open svofski opened 1 year ago

svofski commented 1 year ago

This is probably a grey area, but it's different to gcc.

#include <stdio.h>

int test_switch(int value)
{
    switch (value) {
        case -1:
        case 1:
            return 1;
    }

    return 0;
}

int main()
{
    printf("-1 --> %d\n", test_switch(-1)); // gcc prints 1, ack prints 1
    printf("1 --> %d\n", test_switch(1));    // gcc prints 1, ack prints 0

    return 0;
}