gcc 4.0.0 optimization vs. id strings (RCS, SCCS, etc.)

Andrew Pinski pinskia@physics.uc.edu
Tue Apr 26 00:54:00 GMT 2005


On Apr 25, 2005, at 8:15 PM, Bruce Lilly wrote:

> Hi,
>
> Earlier versions of gcc retain static character strings in object files
> which can be used for identification via ident (RCS) or what (SCCS).
> Gcc 4.0.0 removes them above optimization level 1.  Global strings
> are retained, of course, but that may lead to namespace collisions.
> #ident doesn't work on some architectures, and functionality can't
> be determined at preprocessor time.  #sccs doesn't work at all.  The
> bottom line is that identification which worked with earlier versions
> of gcc is broken under 4.0.0.  See attached C source code example.
> <idtest.c>

The following is correct way of saying that the variable is used in 3.3
and above:
static const char rcs_sccs_id[] __attribute__((used)) =
     "$Id: @(#)%M% %I% 20%E% %U% copyright 2005 %Q% string1\\ $";


-- Pinski



More information about the Gcc mailing list