https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114737
Bug ID: 114737
Summary: Missed optimization : fail to optimize load with
select clobber
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: xxs_chy at outlook dot com
Target Milestone: ---
Godbolt link: https://godbolt.org/z/3e5sfvfKj
```
char src(void** p, char* p1, bool c) {
char* tostore1 = p1 + 1;
char* tostore2 = p1 + 4;
*p = tostore1;
*p1 = 0;
char* tostore = (c ? tostore1 : tostore2) + 1;
*tostore = 1;
return *p1;
}
```
"return *p1" can be optimized into "return 0" here.
```
char tgt(void** p, char* p1, bool c) {
char* tostore1 = p1 + 1;
char* tostore2 = p1 + 4;
*p = tostore1;
*p1 = 0;
char* tostore = (c ? tostore1 : tostore2) + 1;
*tostore = 1;
return 0;
}
```