https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108873
Bug ID: 108873
Summary: Using the C++ front-end causes no DCE from happening
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
CC: amacleod at redhat dot com, dimhen at gmail dot com,
theodort at inf dot ethz.ch, unassigned at gcc dot gnu.org,
yinyuefengyi at gmail dot com
Depends on: 105833
Target Milestone: ---
+++ This bug was initially created as a clone of Bug #105833 +++
Testcase from #105833
```
void foo();
static int b;
static int **c;
static int ***d = &c;
static int ****e = &d;
static char(a)(char g, int h) { return h >= 2 ? g : g << h; }
int main() {
**e == 0;
b = b ? 4 : 0;
if (!a(*e != 0, b))
foo();
}
```
For some reason (I Have not done any anlysis of why), using the C++ front-end
with the above does not get optimized by does when using the C front-end.
This does not seem like a regression either.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105833
[Bug 105833] [13 Regression] Dead Code Elimination Regression at -O2 (trunk vs.
12.1.0)