[ccache] Old code ccache hit always come back unless CCACHE_DISABLE is used

g.esp at free.fr g.esp at free.fr
Tue Jun 5 14:48:48 MDT 2012

----- Mail original -----
> De: "Joel Rosdahl" <joel at rosdahl.net>
> À: "g esp" <g.esp at free.fr>
> Cc: ccache at lists.samba.org
> Envoyé: Samedi 2 Juin 2012 18:29:30
> Objet: Re: [ccache] Old code ccache hit always come back unless CCACHE_DISABLE is used
> On 1 June 2012 12:12,  <g.esp at free.fr> wrote:
> > On the no-fPIE case, using CCACHE_CPP2=1 change compilation to
> > work.
> > Any next recompilation even without CCACHE_CPP2=1 result in cache
> > hit.
> Yes, so this means that the compiler has a bug. You should be able to
> reproduce it by running these two commands:
> /usr/bin/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -include ../config.h
> -I../include -DLOCALEDIR="/usr/share/locale" -fsigned-char -Os
> -march=i486 -mtune=pentium -pipe -fomit-frame-pointer -c -MT lscpu.o
> -MD -MP -MF .deps/lscpu.Tpo -E lscpu.c -o lscpu.i
> /usr/bin/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -include ../config.h
> -I../include -DLOCALEDIR="/usr/share/locale" -fsigned-char -Os
> -march=i486 -mtune=pentium -pipe -fomit-frame-pointer -c lscpu.i -o
> lscpu.o
> As mentioned, the ccache workaround for this kind of bug is to set
> -- Joel
True, the second part fail for gcc-4.4.5 with
lscpu.c: In function 'read_hypervisor':
lscpu.c:446: error: can't find a register in class 'BREG' while reloading 'asm'
lscpu.c:446: error: 'asm' operand has impossible constraints

the good new is that the issue is workaround on util-linux-2.21.2 as more recent compiler warn for undefined operation there

commit 550a02d6e75833be169ac22ab4a2d479cc2ffcbf
Author: Petr Uzel <petr.uzel at suse.cz>
Date:   Mon Apr 23 10:43:38 2012 +0200

    lscpu: fix possibly undefined operation

    With -Wall -Werror, compilation of lscpu.c fails with:

      Making all in sys-utils
      make[2]: Entering directory `/home/petr/upstream/util-linux/sys-utils'
      gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I..  -include ../config.h -I../include -DLOCALEDIR=\"/usr/share/locale\"  -fsigned-char -Wall -Werror -MT lscpu.o -M
      lscpu.c: In function ‘print_parsable’:
      lscpu.c:971:7: error: operation on ‘p’ may be undefined [-Werror=sequence-point]
      cc1: all warnings being treated as errors

    Fix by splitting the pointer increment to separate statement.

    Signed-off-by: Petr Uzel <petr.uzel at suse.cz>

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 65e1eb6..ee6969c 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -966,8 +966,10 @@ print_parsable(struct lscpu_desc *desc, int cols[], int ncols,
                        char *p = data + 1;

-                       while (p && *p != '\0')
-                               *p++ = tolower((unsigned int) *p);
+                       while (p && *p != '\0') {
+                               *p = tolower((unsigned int) *p);
+                               p++;
+                       }
                fputs(data && *data ? data : "", stdout);

So there is no issue on ccache and gcc-4.4.5 was not totally wrong while failing to compile.


More information about the ccache mailing list