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  <wdijk...@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

Reply via email to