CPC converts tcg/tcg.c in QEMU into invalid C
/home/cs648/qemu/tcg/tcg.c:1642: Warning: Body of function tcg_reg_alloc falls-through. Adding a return statement gcc -D_GNUCC -E -I/home/cs648/qemu/tcg -I/home/cs648/qemu/tcg/i386 -I/home/cs648/qemu/linux-headers -I/home/cs648/qemu/bin/current/linux-headers -I. -I/home/cs648/qemu -I/home/cs648/qemu/include -I/home/cs648/qemu/tcg -Itcg -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__SSE2__ -w -Dcoroutine_fn=attribute((cps)) -Dnocps=attribute((nocps)) -I/usr/include/p11-kit-1 -I/usr/include/libpng12 -I/usr/include/pixman-1 -I../linux-headers -I.. -I/home/cs648/qemu/target-i386 -DNEED_CPU_H -I/home/cs648/qemu/include -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -O2 -D_FORTIFY_SOURCE=2 -g ./tcg.cil.c -o ./tcg.cil.i gcc -D_GNUCC -c -I/home/cs648/qemu/tcg -I/home/cs648/qemu/tcg/i386 -I/home/cs648/qemu/linux-headers -I/home/cs648/qemu/bin/current/linux-headers -I. -I/home/cs648/qemu -I/home/cs648/qemu/include -I/home/cs648/qemu/tcg -Itcg -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__SSE2__ -w -Dcoroutine_fn=attribute((cps)) -Dnocps=attribute((nocps)) -I/usr/include/p11-kit-1 -I/usr/include/libpng12 -I/usr/include/pixman-1 -I../linux-headers -I.. -I/home/cs648/qemu/target-i386 -DNEED_CPU_H -I/home/cs648/qemu/include -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -O2 -D_FORTIFY_SOURCE=2 -g -Werror -fPIE -m64 -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -w -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all -pthread -O2 -g -o tcg/tcg.o ./tcg.cil.i /home/cs648/qemu/tcg/tcg.c:2547:61: error: ‘img’ undeclared here (not in a function) .e_ident[EI_MAG2] = ELFMAG2, ^ make: *** [tcg/tcg.o] Error 1 make: Leaving directory `/home/cs648/qemu/bin/convert-block/x86_64-softmmu'
tcg.c: http://codepad.org/u5PyyVjO tcg.i: http://codepad.org/vS3gR45p tcg.cil.c: http://codepad.org/OaUDEJkp tcg.cil.i: http://codepad.org/QFJXikz6
Your files are truncated before the line causing the error. Could you send them to me by email?
Thanks.
On Wed, Sep 04, 2013 at 06:52:05PM -0700, Charlie Shepherd wrote:
/home/cs648/qemu/tcg/tcg.c:2547:61: error: ‘img’ undeclared here (not in a function) .e_ident[EI_MAG2] = ELFMAG2, ^ make: *** [tcg/tcg.o] Error 1 make: Leaving directory `/home/cs648/qemu/bin/convert-block/x86_64-softmmu'
Ah, this is a known CIL limitation: when a static local initializer is "lifted" to top level (as a global variable), it becomes incorrect if it contains a reference to another local variable (img in that case). Does --noMakeStaticGlobal fix the issue?
What I fail to understand is that I compiled qemu today with CPC and did not hit this problem (using your build.sh script). And I thought I had enabled --noMakeStaticGlobal by default in CPC (contrary to CIL). Could you send me a log of configure + make where this issue is triggered (including the configure invocation)?
Thanks.
I thought we had to disable --noMakeStaticGlobal because it caused a different error?
On Thu, Sep 05, 2013 at 04:37:22PM -0700, Charlie Shepherd wrote:
I thought we had to disable --noMakeStaticGlobal because it caused a different error?
That's correct, thanks for the reminder.
Gabriel
On Thu, Sep 05, 2013 at 04:37:22PM -0700, Charlie Shepherd wrote:
I thought we had to disable --noMakeStaticGlobal because it caused a different error?
In fact, no, I added a work-around that applies noMakeStaticGlobal by default in CPC, except for cps functions (where it causes the bug).
Is tcg_register_jit_int marked as coroutine_fn? Otherwise, I suspect you are
using an out-of-date CPC (which would also explain your regression on bug #5).