[Bug c/90552] New: attribute((optimize(3))) not overriding -Os
pskocik at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon May 20 19:06:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90552
Bug ID: 90552
Summary: attribute((optimize(3))) not overriding -Os
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: pskocik at gmail dot com
Target Milestone: ---
I test-compiled ( https://gcc.godbolt.org/z/8bhbNa ):
__attribute((optimize(3))) int div(int X) { return X/3; }
with -O{0,1,2,3,s}, expecting to get the same assembly in all cases, but
__attribute((optimize(3))) is failing to override the last case, namely -Os.
(I'd like the function to not use the idiv instruction even if the rest of the
file is compiled with -Os).
Please correct me if I'm wrong to expect `__attribute((optimize(3)))` to be
able to override `-Os`.
This behavior appears to exist on all gcc versions.
More information about the Gcc-bugs
mailing list