From owner-freebsd-questions@FreeBSD.ORG Sun Apr 25 07:03:01 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A92D106566B for ; Sun, 25 Apr 2010 07:03:01 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from shell0.rawbw.com (shell0.rawbw.com [198.144.192.45]) by mx1.freebsd.org (Postfix) with ESMTP id 4FCDB8FC13 for ; Sun, 25 Apr 2010 07:03:01 +0000 (UTC) Received: from eagle.syrec.org (stunnel@localhost [127.0.0.1]) (authenticated bits=0) by shell0.rawbw.com (8.14.4/8.14.4) with ESMTP id o3P730o8029005 for ; Sun, 25 Apr 2010 00:03:00 -0700 (PDT) (envelope-from yuri@rawbw.com) Message-ID: <4BD3E923.9030606@rawbw.com> Date: Sun, 25 Apr 2010 00:02:59 -0700 From: Yuri User-Agent: Thunderbird 2.0.0.24 (X11/20100331) MIME-Version: 1.0 To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Why system gcc that is 4.2.1 produces different code than gcc-4.2.1 compiled from sources? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: yuri@rawbw.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2010 07:03:01 -0000 I ran this simple example: #include #include 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 Yuri