This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC][PATCH] Change default to -fcommon
- From: Sandra Loosemore <sandra at codesourcery dot com>
- To: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: nd <nd at arm dot com>
- Date: Sat, 18 Nov 2017 18:48:58 -0700
- Subject: Re: [RFC][PATCH] Change default to -fcommon
- Authentication-results: sourceware.org; auth=none
- References: <DB6PR0801MB20537CD32063175699A3E50F832F0@DB6PR0801MB2053.eurprd08.prod.outlook.com>
On 11/17/2017 12:12 PM, Wilco Dijkstra wrote:
GCC currently defaults to -fcommon. This is an optional C feature dating
back to early C implementations. On many targets this means global variable
accesses having an unnecessary codesize and performance penalty in C code
(the same source generates better code when built as C++). Given there isn't
a lot of software that really requires this (mostly it's accidentally forgetting to
use 'extern' in a header), it is about time to change the default.
What do people think? I presume someone with access to distro source code
and a fast build machine could try and see how many packages fail to get an
idea how feasible it is. We could keep defaulting to -fcommon with -std=c89
if necessary.
2017-11-17 Wilco Dijkstra <wdijkstr@arm.com>
* common.opt (fcommon): Change init to 1.
* doc/invoke.texi (-fcommon): Update documentation.
The doc parts of this patch are OK.
Personally, I think the change is a good idea, but I don't know how much
breakage it would cause. One data point I can contribute is that when
we looked at this several years ago, we found that all competing
compilers on bare-metal targets implemented the -fno-common behavior.
So another possible compromise is keeping -fcommon on Unix-like targets
where it is the traditional behavior, and switching to -fno-common
elsewhere where it's not. I don't see much benefit in tying the default
to -std= since it's not behavior specified in the C standard at all.
-Sandra