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]
Other format: [Raw text]

[Bug c/14947] New: Optimization leads to SegV for large locals on MAC Power PC


/*
 This program segvs with gcc -O, but not with plain gcc.
 
 The differences between the crashing version with Sz1 and the non-crashing 
 version with SZ2 are;
 
 $  diff mactest.s mactest_segv.
25c25
<       li r4,8172
---
>       li r4,8173
59c59
<       ori r0,r0,32752
---
>       ori r0,r0,32736
65,69d64
<       xoris r0,r30,0x8000
<       stw r0,32756(r1)
<       lis r0,0x4330
<       stw r0,32752(r1)
<       lfd f13,32752(r1)
71a67,72
>       lis r0,0x4330
>       add r9,r9,r1
>       xoris r2,r30,0x8000
>       stw r2,4(r9)
>       stw r0,0(r9)
>       lfd f13,0(r9)

 Inspecting this code in the broader context the problem appears to be that 
 r9 is used without being initialized

 gcc -v returns:
 Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)
 */

#include<stdio.h>

#define SZ1 8192-19
#define SZ2 8192-20

/* Crashes with SZ1 but not with SZ2 or smaller sizes. */
#define SZ SZ1

void prn(int j, double k) /* double is required here. */
{
    printf("SZ=%d j=%d, k=%g\n",SZ,j,k);
    fflush(stdout);
}


int main(void)
{
    int j=0;
    int A[SZ];
    
    do { /* loop required. */
        prn(j,/* implicit cast here. */ j);
    } while(j);
    
    return 0;
}

-- 
           Summary: Optimization leads to SegV for large locals on MAC Power
                    PC
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fsmith at mathworks dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: gcc version 3.3 20030304 (Apple Computer, Inc. build
                    1495)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14947


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