On 10 May 2012 12:54, <ka...@karme.de> wrote:
> I still can reproduce it using ccache 3.1.7-1 and gcc 4.4.7-1

Thanks!

The root cause is a bug in preprocessor. Since ccache by default runs the
preprocessor and then compiles its output, the error shows up when using
ccache.

Here's a reduced test case:

% cat bug465324.c
#define m(x) int x;
m(
#line 1 "f"
x)
#line 2 "f"
% gcc-4.4 -E bug465324.c -o bug465324.i
% cat bug465324.i
# 1 "bug465324.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "bug465324.c"


# 1 "f"
int x;# 2 "f"
% gcc-4.4 bug465324.i
f:1: error: stray ‘#’ in program
f:1: error: expected identifier or ‘(’ before numeric constant
% gcc-4.6 -E bug465324.c -o bug465324.i
% cat bug465324.i
# 1 "bug465324.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "bug465324.c"


# 1 "f"
# 2 "bug465324.c"
 int x;
# 2 "f"
% gcc-4.6 -c bug465324.i && echo works
works


It seems to work for me with GCC >=4.5 and fails with GCC <4.5. A
workaround is to set CCACHE_CPP2=1 since that avoids compiling the
preprocessed output (but also makes cache misses slower).

Note that this only covers the "stray ‘#’ in program" error. The original
bug report mentions "stray ‘\177’ in program", which sounds like another
problem.

-- Joel

Reply via email to