<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63023>63023</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            "[SCCP] Don't mark edges feasible when resolving undefs" combined with function inline lead to segment fault 
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          godmiaozi
      </td>
    </tr>
</table>

<pre>
    we have demo.c as following
```C
#include <stdio.h>

int g_print = 1;

void dump_list()
{ unsigned int type;

    type = 1<<11;

    if ((g_print & (1 << type)) != 0) {
        printf("need log type=%d\n", type);
    }
}

int main()
{
    printf("before main\n");
    dump_list();

    printf("after main\n");
 return 0;
}
```
command
```bash
./bin/clang -O2 demo.c -o demo
 ./demo
before main
before main
Segmentation fault (core dumped)
``` 
according to the C programming language specification https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf
`If the value of the right operand is negative or is
greater than or equal to the width of the promoted left operand, the behavior is undefined`

"1 << 2048" will lead to undefined behavior.
previously this code actually works fine. i have figured out that this "segment fault" is introduced by this commit 1f88d804083a8a1b68df1e6677920e38ab2a6b40(from @nikic)
before this commit the output would be 
```bash
./bin/clang -O2 demo.c -o demo
 ./demo
before main
after main
```
i have take a quick glance at this modification, it looks like if we have an undef if branch, all the successor of that if branch will be marked as invalid and replaced with unreachable instruction(all the successors actually are eliminated)
i do know that we should not depend on undef behavior, but this modification actually break some old code which used to work "fine", i have the following question
* is that actually what we want? what is the motivation behind?( to simplify the CFG?)
* even we have such undef behavior detected, currently the compiler does not complain any warnings, is it possible to add some warnings to tell the user that we have problematic code here 


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VsuO4zoO_RplQ1Rgy3kusuhKJoNZzQD9AQ1Zom12ZMmtR4yar7-QlFdV913eQsG2JD4OyUMqwnvqDeKBrd_Z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