This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

target/788: Code accessing double arg crashes for SPARC when arg is split over register/frame and -O1 is used



>Number:         788
>Category:       target
>Synopsis:       Code accessing double arg crashes for SPARC when arg is split over register/frame and -O1 is used
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 13 09:36:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Fridtjof Siebert
>Release:        gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
SUNW,Ultra-5_10
SunOS Release 5.7 Version Generic_106541-10 [UNIX(R) System V Release 4.0]
>Description:
Compilation using -O1 causes crash:

> gcc -O0 -o sparcBug0 sparcBug.c
> gcc -O1 -o sparcBug1 sparcBug.c
> sparcBug0
call t:
call u:
done.
> sparcBug1
call t:
call u:
Bus Error

Reason: Machine code uses odd address to access 64-bit double:

> gcc -O1 -S -o sparcBug1.s sparcBug.c
> cat sparcBug1.s | grep "u:" -A 10 | head -n 10  
u:
        !#PROLOGUE# 0
        save    %sp, -120, %sp
        !#PROLOGUE# 1
        ldd     [%fp+92], %f4  ************ fp+92 is ODD!
        sethi   %hi(.LLC1), %o0
        ldd     [%o0+%lo(.LLC1)], %f2
        fsubd   %f4, %f2, %f2
        std     %f2, [%fp-24]
        call    isnan, 0

The test C-file is

> cat sparcBug.c
#include <stdio.h>
#include <math.h>

void t(void *a,void *b,void *c,double d,double e,double f) { isnan((f-0.0010)); }
void u(        void *b,void *c,double d,double e,double f) { isnan((f-0.0010)); }

int main (int nargs, char **args) {
  printf("call t:\n"); fflush(stdout); t(NULL,NULL,NULL,3.0,4.0,5.0);
  printf("call u:\n"); fflush(stdout); u(     NULL,NULL,3.0,4.0,5.0);
  printf("done.\n"  ); fflush(stdout);
}
>How-To-Repeat:
> gcc -O1 -o sparcBug1 sparcBug.c
> sparcBug1
>Fix:
?!?
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="sparcBug.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="sparcBug.c"

I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxtYXRoLmg+Cgp2b2lkIHQodm9pZCAqYSx2b2lk
ICpiLHZvaWQgKmMsZG91YmxlIGQsZG91YmxlIGUsZG91YmxlIGYpIHsgaXNuYW4oKGYtMC4wMDEw
KSk7IH0Kdm9pZCB1KCAgICAgICAgdm9pZCAqYix2b2lkICpjLGRvdWJsZSBkLGRvdWJsZSBlLGRv
dWJsZSBmKSB7IGlzbmFuKChmLTAuMDAxMCkpOyB9CgppbnQgbWFpbiAoaW50IG5hcmdzLCBjaGFy
ICoqYXJncykgewogIHByaW50ZigiY2FsbCB0OlxuIik7IGZmbHVzaChzdGRvdXQpOyB0KE5VTEws
TlVMTCxOVUxMLDMuMCw0LjAsNS4wKTsKICBwcmludGYoImNhbGwgdTpcbiIpOyBmZmx1c2goc3Rk
b3V0KTsgdSggICAgIE5VTEwsTlVMTCwzLjAsNC4wLDUuMCk7CiAgcHJpbnRmKCJkb25lLlxuIiAg
KTsgZmZsdXNoKHN0ZG91dCk7Cn0KCg==

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]