Date: Sun, 25 Apr 2010 21:02:43 +0300 From: Leonidas Tsampros <ltsampros@upnet.gr> To: yuri@rawbw.com Cc: freebsd-questions@freebsd.org Subject: Re: Why system gcc that is 4.2.1 produces different code than gcc-4.2.1 compiled from sources? Message-ID: <87k4rvh0l8.fsf@upnet.gr> In-Reply-To: <4BD3E923.9030606@rawbw.com> (yuri@rawbw.com's message of "Sun, 25 Apr 2010 00:02:59 -0700") References: <4BD3E923.9030606@rawbw.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Yuri <yuri@rawbw.com> writes: > I ran this simple example: > > #include <stdlib.h> > #include <stdio.h> > > int fib(int AnArg) { > if (AnArg <= 2) return (1); > return (fib(AnArg-1)+fib(AnArg-2)); > } > > int main(int argc, char* argv[]) { > int n = atoi(argv[1]); > printf("fib(%i)=%i\n", n, fib(n)); > } > > through system gcc and gcc built from sources. Both are 4.2.1. Options: -O3. > > Average runtime with the argument 45 is quite different: system gcc is > 3.650s and gcc-4.2.1 from sources is 3.740. > CPU: Intel(R) Core(TM) i7 CPU @ 9200 @ 2.67GHz > Hi, I'm pretty sure that a small difference in execution time does not mean that the produced code is different. In order to check the code gcc produced, you need to do something like this: objdump -d executable or even use gdb's disassemble command. Regards, Leonidas > Yuri
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87k4rvh0l8.fsf>