qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Overoptimization


From: Herbert Poetzl
Subject: Re: [Qemu-devel] Overoptimization
Date: Fri, 28 May 2004 13:08:38 +0200
User-agent: Mutt/1.4.1i

On Fri, May 28, 2004 at 04:58:33PM +0600, Alexander E. Patrakov wrote:
> Herbert Poetzl wrote:
> >On Fri, May 28, 2004 at 07:19:35AM +0600, Alexander E. Patrakov wrote:
> >
> >>The CFLAGS in Makefile.target are bad for gcc 3.3.2. This is not a my 
> >>problem with my gcc, because it passes the "make check" testsuite except 
> >>some known errors in libstdc++, which cannot affect qemu.
> >>
> >>The victim is the tcp_input function in slirp. When compiling with the 
> >>decault CFLAGS, for some reason all packets are dropped as having a 
> >>wrong TCP checksum. I tried debugging this by placing some debug printfs 
> >>in tcp_input.c file, but the problem disappeared after I inserted them. 
> >>I concluded that it is very strange and compiled this tcp_input.c file 
> >>without my debug statements, but with -O1 instead of -O2. The problem 
> >>went away.
> >
> >
> >gcc isn't supposed to change the semantics of
> >a program based on the optimization level.
> >
> >nevertheless several cases are known where this
> >happened, and not seldom the bug was in gcc
> >
> >testing the same opts with 3.3.3 or 3.4 will
> >show if gcc is to blame or not.
> 
> Done (with gcc 3.4.0). I used a truly minimal configuration of qemu in 
> both cases to make sure that this is not an SDL/X/whatever else problem:
> 
> ./configure --prefix=/usr --target-list=i386-softmmu --enable-slirp 
> --disable-sdl
> 
> GCC 3.4.0, however, required one more file to be compiled with -O1 
> (because of some register allocation error), and there were some "struct 
> timezone" errors that were trivial to fix by including <time.h> where 
> appropriate.
> 
> The result is the same. If I compile tcp_input.c with -O2, all tcp 
> packets are rejected in user-net mode because of wrong tcp checksum. If 
> tcp_input.c is compiled with -O1, qemu works.

okay, sounds like some 'broken' struct, which might
get misaligned or maybe a problem with the binutils ...

I'd suggest trying -Os and -O9 just to give some hints
to the developers, also the detailed error messages
of the specific code with -Wall might shed some light
on that ...

HTH,
Herbert

> -- 
> Alexander E. Patrakov




reply via email to

[Prev in Thread] Current Thread [Next in Thread]