Skip site navigation (1)Skip section navigation (2)
Date:      Sun,  9 Apr 2000 11:31:03 +0200
From:      Mirko Viviani <mirko.viviani@rccr.cremona.it>
To:        Mike Heffner <spock@techfour.net>
Cc:        current@FreeBSD.org
Subject:   Re: 4.0 possible compiler bug ?
Message-ID:  <200004090931.LAA02968@rccr.cremona.it>
In-Reply-To: <XFMail.20000408211158.mheffner@mailandnews.com>
References:  <XFMail.20000408211158.mheffner@mailandnews.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--NeXT-Mail-29933908-1
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Sat, 08 Apr 2000, Mike Heffner  wrote:

> | I'm testing the __builtin_apply() to make a patch to GNUstep, but I'm
> | getting
> | in troubles.
>
> Since you're on the subject, there are also two other bugs with
> __builtin_apply() in FBSD that I know of.

Always better... :(

> The easy hack to fix 2 is to remove FP_X_INV from the floating point mask
> -- but this is not the right way to do it. 1 can be fixed by passing a
> pointer of a float.

Exactly how to do that ?

> I tried investigating into it a while back, but didn't have any luck. I
> know that 2 isn't a problem in 3-stable.

If we'are not able to fix it I'm forced to change OS... I need GNUstep.

I have tested the prg with NEXTSTEP cc 2.5.8 that uses the same behaviour
for these things, it does not crash and return a pointer for the struct on  
the stack.

CC differences:

argframe: NS 8 bytes, FBSD 16 bytes
struct on the stack: NS up to 4 bytes, FBSD up to 8 bytes.

If it helps someone here is the asm generated by cc on NS.

[An attachment was originally included here]
---
Bye,
     Mirko  <mirko.viviani@rccr.cremona.it>   (NeXTmail, MIME)
                    <mirko@yourbox.net>

--NeXT-Mail-29933908-1
Content-Type: multipart/mixed; boundary=NeXT-Mail-1209868928-2
Content-Transfer-Encoding: 7bit

--NeXT-Mail-1209868928-2
Content-Type: text/enriched; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<nofill>On Sat, 08 Apr 2000, Mike Heffner  wrote:

> | I'm testing the __builtin_apply() to make a patch to GNUstep, but I'm
> | getting
> | in troubles.
> 
> Since you're on the subject, there are also two other bugs with
> __builtin_apply() in FBSD that I know of.

Always better... :(

> The easy hack to fix 2 is to remove FP_X_INV from the floating point mask
> -- but this is not the right way to do it. 1 can be fixed by passing a
> pointer of a float.

Exactly how to do that ?

> I tried investigating into it a while back, but didn't have any luck. I
> know that 2 isn't a problem in 3-stable.

If we'are not able to fix it I'm forced to change OS... I need GNUstep.

I have tested the prg with NEXTSTEP cc 2.5.8 that uses the same behaviour
</nofill>for these things, it does not crash and return a pointer for the struct on
the stack.

<nofill>
CC differences:

argframe: NS 8 bytes, FBSD 16 bytes
struct on the stack: NS up to 4 bytes, FBSD up to 8 bytes.

If it helps someone here is the asm generated by cc on NS.

</nofill>
--NeXT-Mail-1209868928-2
Content-Type: application/octet-stream; name=contest_i.S; x-unix-mode=0600
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=contest_i.S

.globl _value
.data
	.align 2
_value:
	.long _p
.text
	.align 2,0x90
.globl _floatValue
_floatValue:
	pushl %ebp
	movl %esp,%ebp
	pushl %ebx
	movl %ebx,%eax
	movb $32,_p
	movb $3,_p+1
	movb $4,_p+2
	movb $33,_p+3
	movb $-2,_p+9
	movl $_p,%edx
	movl (%edx),%ecx
	movl %ecx,(%eax)
	movl 4(%edx),%ecx
	movl %ecx,4(%eax)
	movw 8(%edx),%cx
	movw %cx,8(%eax)
	jmp L1
	.align 2,0x90
L1:
	movl %eax,%eax
	movl -4(%ebp),%ebx
	movl %ebp,%esp
	popl %ebp
	ret
.cstring
LC0:
	.ascii "%02x \0"
LC1:
	.ascii "\12\0"
.text
	.align 2,0x90
.globl _main
_main:
	pushl %ebp
	movl %esp,%ebp
	subl $140,%esp
	pushl %edi
	pushl %esi
	pushl %ebx
	leal 8(%ebp),%ecx
	movl %ecx,-24(%ebp)
	movl %ebx,%ecx
	movl %ecx,-20(%ebp)
	leal -24(%ebp),%ecx
	movl $_floatValue,-8(%ebp)
	movl %ecx,-16(%ebp)
	movl -16(%ebp),%ecx
	movl $0,(%ecx)
	movl -16(%ebp),%ebx
	movl (%ebx),%ecx
	movl %esp,%esi
	movl %esp,%ecx
	movl -16(%ebp),%ebx
	addl $4,%ebx
	movl (%ebx),%ecx
	movl %ecx,%ebx
	movl -8(%ebp),%ecx
	leal -140(%ebp),%edi
	call *%ecx
	movl %eax,(%edi)
	movl %edx,4(%edi)
	fnsave 8(%edi)
	movl %esi,%esp
	leal -140(%ebp),%eax
	movl %eax,-12(%ebp)
	movl $0,-4(%ebp)
L3:
	cmpl $39,-4(%ebp)
	jg L4
	movl -12(%ebp),%eax
	addl -4(%ebp),%eax
	movzbl (%eax),%edx
	pushl %edx
	pushl $LC0
	call _printf
	addl $8,%esp
L5:
	incl -4(%ebp)
	jmp L3
	.align 2,0x90
L4:
	pushl $LC1
	call _printf
	addl $4,%esp
	movl $0,-4(%ebp)
L6:
	cmpl $3,-4(%ebp)
	jg L7
	movl -4(%ebp),%eax
	addl $_value,%eax
	movzbl (%eax),%edx
	pushl %edx
	pushl $LC0
	call _printf
	addl $8,%esp
L8:
	incl -4(%ebp)
	jmp L6
	.align 2,0x90
L7:
	pushl $LC1
	call _printf
	addl $4,%esp
	pushl $0
	call _exit
	addl $4,%esp
	.align 2,0x90
L2:
	leal -152(%ebp),%esp
	popl %ebx
	popl %esi
	popl %edi
	movl %ebp,%esp
	popl %ebp
	ret
.comm _p,12

--NeXT-Mail-1209868928-2
Content-Type: text/enriched; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline



---

Bye,

     Mirko  <<mirko.viviani@rccr.cremona.it>   (NeXTmail, MIME)

                    <<mirko@yourbox.net>


--NeXT-Mail-1209868928-2--

--NeXT-Mail-29933908-1--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004090931.LAA02968>