From owner-freebsd-ports-bugs@freebsd.org Wed Feb 8 20:34:14 2017 Return-Path: Delivered-To: freebsd-ports-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1541CD6690 for ; Wed, 8 Feb 2017 20:34:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9657E10F2 for ; Wed, 8 Feb 2017 20:34:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v18KYDvr064489 for ; Wed, 8 Feb 2017 20:34:14 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-ports-bugs@FreeBSD.org Subject: [Bug 216770] lang/julia: fails to build with clang 4.0 Date: Wed, 08 Feb 2017 20:34:14 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: needs-patch X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: dim@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-ports-bugs@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback+ X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Feb 2017 20:34:14 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D216770 --- Comment #5 from Dimitry Andric --- (In reply to Jan Beich (mail not working) from comment #4) > -O2 optimizes out (k > 0) check in ratio() from contrib/gdtoa/smisc.c. > Dimitry, can you confirm? I don't see it being optimized out. On i386, the assembly becomes: .globl __ratio_D2A .p2align 4, 0x90 .type __ratio_D2A,@function __ratio_D2A: # @__ratio_D2A # BB#0: # %entry pushl %ebp movl %esp, %ebp pushl %edi pushl %esi andl $-8, %esp subl $48, %esp movl 12(%ebp), %esi movl 8(%ebp), %edi movl __stack_chk_guard, %eax movl %eax, 44(%esp) leal 20(%esp), %eax movl %eax, 4(%esp) movl %edi, (%esp) calll __b2d_D2A fstl 8(%esp) # 8-byte Folded Spill fstpl 32(%esp) leal 16(%esp), %eax movl %eax, 4(%esp) movl %esi, (%esp) calll __b2d_D2A fstl 24(%esp) movl 20(%esp), %eax subl 16(%esp), %eax movl 16(%edi), %ecx subl 16(%esi), %ecx shll $5, %ecx addl %eax, %ecx movl %ecx, %edx sarl $31, %edx leal (%ecx,%edx), %eax xorl %edx, %eax testl %ecx, %ecx jg .LBB1_1 [... this is the k > 0 comparison ...] # BB#2: # %entry leal 24(%esp), %ecx jmp .LBB1_3 .LBB1_1: leal 32(%esp), %ecx .LBB1_3: # %entry shll $20, %eax orl $4, %ecx addl %eax, (%ecx) fldl 8(%esp) # 8-byte Folded Reload fdivp %st(1) movl __stack_chk_guard, %eax cmpl 44(%esp), %eax jne .LBB1_5 # BB#4: # %entry leal -8(%ebp), %esp popl %esi popl %edi popl %ebp retl .LBB1_5: # %entry fstp %st(0) calll __stack_chk_fail .Lfunc_end1: .size __ratio_D2A, .Lfunc_end1-__ratio_D2A On amd64, it doesn't use jmps, but conditional movs: .globl __ratio_D2A .p2align 4, 0x90 .type __ratio_D2A,@function __ratio_D2A: # @__ratio_D2A .cfi_startproc # BB#0: # %entry pushq %rbp .Lcfi8: .cfi_def_cfa_offset 16 .Lcfi9: .cfi_offset %rbp, -16 movq %rsp, %rbp .Lcfi10: .cfi_def_cfa_register %rbp pushq %r14 pushq %rbx subq $48, %rsp .Lcfi11: .cfi_offset %rbx, -32 .Lcfi12: .cfi_offset %r14, -24 movq %rsi, %r14 movq %rdi, %rbx movq __stack_chk_guard(%rip), %rax movq %rax, -24(%rbp) leaq -44(%rbp), %rsi callq __b2d_D2A movsd %xmm0, -56(%rbp) # 8-byte Spill movsd %xmm0, -32(%rbp) leaq -48(%rbp), %rsi movq %r14, %rdi callq __b2d_D2A movsd %xmm0, -40(%rbp) movl -44(%rbp), %eax subl -48(%rbp), %eax movl 20(%rbx), %ecx subl 20(%r14), %ecx shll $5, %ecx addl %eax, %ecx movl %ecx, %eax negl %eax cmovll %ecx, %eax testl %ecx, %ecx [... here the value of k is tested ...] leaq -32(%rbp), %rcx leaq -40(%rbp), %rdx cmovgq %rcx, %rdx [... and here is the conditional move-if-greater ...] shll $20, %eax orq $4, %rdx addl %eax, (%rdx) movq __stack_chk_guard(%rip), %rax cmpq -24(%rbp), %rax jne .LBB1_2 # BB#1: # %entry movsd -56(%rbp), %xmm1 # 8-byte Reload # xmm1 =3D mem[0],zero divsd %xmm0, %xmm1 movapd %xmm1, %xmm0 addq $48, %rsp popq %rbx popq %r14 popq %rbp retq .LBB1_2: # %entry callq __stack_chk_fail .Lfunc_end1: .size __ratio_D2A, .Lfunc_end1-__ratio_D2A .cfi_endproc That said, I *do* see a difference in the values produced by that strtod te= st, e.g. libc compiled with 3.9.1 or 4.0.0 gives: 3.9.1: 10633823966279326983230456482242756608.000000 4.0.0: 10633823966279321080272352895186239488.000000 This is consistent on i386 and amd64. Certainly needs a bit more investigation. --=20 You are receiving this mail because: You are the assignee for the bug.=