Affected target: arm. (x86/x86_64 passes) Affected version: trunk 20140109, 4.8, 4.7 ~/cases/pragma $ cat p.c #pragma GCC push_options #pragma GCC optimize("O2") int foo(int a){ return a+1; } #pragma GCC pop_options ~/cases/pragma $ arm-none-eabi-gcc p.c -c p.c:6:9: warning: #pragma GCC target is not supported for this machine [-Wpragmas] #pragma GCC pop_options
Comes from: if (p->target_binary != target_option_current_node) { (void) targetm.target_option.pragma_parse (NULL_TREE, p->target_binary); target_option_current_node = p->target_binary; } The front-end expects the target always to implement these target hooks it seems rather than the default. Really I think the arm back-end should implement them so that thumb2 code can be in the same source file as arm32 code and would help out LTO when people mix and match them.
(In reply to Andrew Pinski from comment #1) > Comes from: > if (p->target_binary != target_option_current_node) > { > (void) targetm.target_option.pragma_parse (NULL_TREE, > p->target_binary); > target_option_current_node = p->target_binary; > } > > > The front-end expects the target always to implement these target hooks it > seems rather than the default. > > Really I think the arm back-end should implement them so that thumb2 code > can be in the same source file as arm32 code and would help out LTO when > people mix and match them. It is a useful feature on ARM. I don't know why it isn't support now. But this warning still need to be fixed as there are always some targets not supportting this pragma.
https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01977.html are the seeds of fixing this. A lot more will be needed than this basic set of patches to support more of this. Christian Bruel is looking into this.
#pragma GCC target relies on the target_attribute work *** This bug has been marked as a duplicate of bug 52144 ***