Sure, we can pass this feedback along.

Thanks for reporting it.

Cindy

On 09/11/12 10:00, Cedric Blancher wrote:
Forwarded conversation
Subject: [developer] SUNWspro compiler bug
------------------------

From: Matthew Ahrens<mahr...@delphix.com>
Date: 11 September 2012 06:35
To: develo...@lists.illumos.org


Is there a good place to report a SUNWspro compiler bug?

I've found that functions that use alloca() (or c99 variable-length
arrays) and are compiled with "-m64 -xO1 -Wu,-save_args" (as the
kernel is) restore callee-saved registers incorrectly.

Note that extant code works correctly because the kernel doesn't call
alloca(), and 64-bit userland is not compiled with save_args.

The incorrect assembly looks like:

func:                           pushq  %rbp
func+1:                         movq   %rsp,%rbp
# save arguments:
func+4:                         subq   $0x18,%rsp
func+8:                         movq   %rdi,-0x8(%rbp)
func+0xc:                       movq   %rsi,-0x10(%rbp)
func+0x10:                      movq   %rdx,-0x18(%rbp)
# callee-saved registers which this function needs:
func+0x14:                      pushq  %r12
func+0x16:                      pushq  %r13
func+0x18:                      pushq  %r14
func+0x1a:                      pushq  %r15
# alloca(1):
func+0x1c:                      subq   $0x8,%rsp
func+0x20:                      decq   %rsp
func+0x23:                      andq   $0xfffffffffffffff0,%rsp

... some computation that uses %r12, %r13, %r14, %r15

# incorrectly change %rsp to what it was before the alloca()
# should be -0x38 to include saved arguments
func+0x187:                     leaq   -0x20(%rbp),%rsp
# restore callee-saved registers:
func+0x18b:                     popq   %r15
func+0x18d:                     popq   %r14
func+0x18f:                     popq   %r13
func+0x191:                     popq   %r12
func+0x193:                     leave
func+0x194:                     ret

For an example, see the attached test program.

--matt
illumos-developer | Archives | Modify Your Subscription

----------
From: Richard Lowe<richl...@richlowe.net>
Date: 11 September 2012 06:40
To: Matthew Ahrens<mahr...@delphix.com>, illumos-dev
<develo...@lists.illumos.org>


On Tue, Sep 11, 2012 at 12:35 AM, Matthew Ahrens<mahr...@delphix.com>  wrote:

Is there a good place to report a SUNWspro compiler bug?

I've found that functions that use alloca() (or c99 variable-length arrays) and are 
compiled with "-m64 -xO1 -Wu,-save_args" (as the kernel is) restore 
callee-saved registers incorrectly.


I hit this same issue when concocting the libproc changes I just sent
out for review.  I think you can file Studio bugs at bugs.sun.com
still, but it won't be any good for illumos, since it'll only be fixed
in a version of the compiler we can't really use.

-- Rich
illumos-developer | Archives | Modify Your Subscription



Ced
--
Cedric Blancher<cedric.blanc...@googlemail.com>
Institute Pasteur



_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to