https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119051
Bug ID: 119051
Summary: Inline Function Behavior Varies Across Optimization
Levels
Product: gcc
Version: 14.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: xieym3 at zohomail dot com
Target Milestone: ---
A compilation error occurs at -O0 and -Os optimization levels when compiling an
inline function that modifies a global variable. However, the issue does not
appear at -O1, -O2, or -Ofast. The behavior suggests a possible issue with how
inline functions are handled at lower optimization levels.
It can be reproduced on https://godbolt.org/z/dEa3cofbh.
$ cat file.c
int global_var = 0;
inline void update_global(int value) {
global_var += value;
}
int main() {
update_global(5);
return 0;
}
Is this the same as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119028