https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110318

--- Comment #1 from Roland Illig <roland.illig at gmx dot de> ---
A variant on the same theme:
~~~c
typedef typeof(sizeof 0) size_t;
int memcmp(const void *, const void *, size_t);

int demo(const char *s) {
        if (memcmp(s, "12345678", 8) == 0)
                return 8;
        if (memcmp(s, "1234567", 7) == 0)
                return 7;
        if (memcmp(s, "123456", 6) == 0)
                return 6;
        if (memcmp(s, "12345", 5) == 0)
                return 5;
        if (memcmp(s, "1234", 4) == 0)
                return 4;
        if (memcmp(s, "123", 3) == 0)
                return 3;
        if (memcmp(s, "12", 2) == 0)
                return 2;
        if (memcmp(s, "1", 1) == 0)
                return 1;
        return 0;
}
~~~

It looks as if the string literals are retained if their length is not a power
of two.

Reply via email to