I am trying to use the GCC pragma optimize to set global optimizations in my C code. GCC version is 4.4.3 on Ubuntu. The basic idea is to use function specific optimization levels.
#pragma GCC optimize ("O3")
I get a compilation error
just before my main function in my C code
But when I build it, I get compilation error as below -
passrecovery.c: In function Ã¢mainÃ¢:
passrecovery.c:493: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
make: *** [all] Error 1
I checked the README.Bugs file, mentioned in the error, but found no clues regarding this.
Is `#pragma optimize` supported in 4.4.3 GCC or not?
If yes, then what is that I am doing incorrectly in using this pragma to optimize the code.
Any other alternative GCC directive for optimizing the code for speed?
**EDIT**: I even tried `#pragma GCC push_options` then `#pragma GCC optimize ("O3")` and at end of file `#pragma GCC pop_options`; same error.
以上就是C code optimization using #pragma GCC optimize的详细内容，更多请关注web前端其它相关文章！