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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I thought we don't, if the testcase starts with
void dummy (void);
short int foo (void);
int src(void) {
    short int num = foo ();
    switch(num){
instead then evrp1 optimizes away the BIT_AND_EXPR.
Though, if the ranger just has a known zero mask in addition to normal ranges,
maybe it can't handle it, because the range of num with (short)num == 111 is
hard to express
(it would be a union of 65536 ranges).
Maybe bit-ccp should be able to handle that though, this case is exactly that
upper 16 bits of the value are uknown and lower 16 bits of the value are all
known,
some of them 0, some of them 1.
But maybe bit-ccp doesn't handle switches.

Reply via email to