From owner-freebsd-current@FreeBSD.ORG Tue Apr 3 11:21:15 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 078A61065674 for ; Tue, 3 Apr 2012 11:21:15 +0000 (UTC) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from comsys.kpi.ua (comsys.kpi.ua [77.47.192.42]) by mx1.freebsd.org (Postfix) with ESMTP id AA3DF8FC17 for ; Tue, 3 Apr 2012 11:21:14 +0000 (UTC) Received: from pm513-1.comsys.kpi.ua ([10.18.52.101] helo=pm513-1.comsys.ntu-kpi.kiev.ua) by comsys.kpi.ua with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1SF1nU-0006rN-Ue for freebsd-current@freebsd.org; Tue, 03 Apr 2012 14:21:12 +0300 Received: by pm513-1.comsys.ntu-kpi.kiev.ua (Postfix, from userid 1001) id 9CCD81CC36; Tue, 3 Apr 2012 14:21:12 +0300 (EEST) Date: Tue, 3 Apr 2012 14:21:11 +0300 From: Andrey Simonenko To: freebsd-current@freebsd.org Message-ID: <20120403112111.GA39616@pm513-1.comsys.ntu-kpi.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Authenticated-User: simon@comsys.ntu-kpi.kiev.ua X-Authenticator: plain X-Sender-Verify: SUCCEEDED (sender exists & accepts mail) X-Exim-Version: 4.63 (build at 28-Apr-2011 07:11:12) X-Date: 2012-04-03 14:21:12 X-Connected-IP: 10.18.52.101:44232 X-Message-Linecount: 66 X-Body-Linecount: 54 X-Message-Size: 1853 X-Body-Size: 1353 Subject: -ffast-math in Ports and wrong generated code X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2012 11:21:15 -0000 Hello, I use one port from the Ports Collection, that works with FP. Having reinstalled it (its version was not changed) I noticed that it started to work incorrectly. After debugging and disassembling its code I found out that the -ffast-math option used for building was the result of wrongly generated code (I did not specify this option in /etc/make.conf). At least finite() function call was eliminated from the result Assembler code when -ffast-math option is used, tested on 9.0-STABLE and 10.0-CURRENT. Example test source code and generated code under 9.0-STABLE on amd64 by gcc from the base system: ----------------------------- #include #include void check_finite(double x) { printf("%d\n", finite(x)); } ----------------------------- % gcc -Wall -O2 -S finite.c ----------------------------- check_finite: .LFB3: subq $8, %rsp .LCFI0: call finite <-- call to finite() movl $.LC0, %edi movl %eax, %esi addq $8, %rsp xorl %eax, %eax jmp printf .LFE3: .size check_finite, .-check_finite ----------------------------- % gcc -Wall -O2 -ffast-math -S finite.c ----------------------------- check_finite: .LFB3: xorl %esi, %esi <-- fake result from finite() movl $.LC0, %edi xorl %eax, %eax jmp printf .LFE3: .size check_finite, .-check_finite ----------------------------- Can somebody comment this?