public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/14947] New: Optimization leads to SegV for large locals on MAC Power PC
@ 2004-04-13 22:12 fsmith at mathworks dot com
  2004-04-13 22:45 ` [Bug optimization/14947] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: fsmith at mathworks dot com @ 2004-04-13 22:12 UTC (permalink / raw)
  To: gcc-bugs

/*
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug optimization/14947] Optimization leads to SegV for large locals on MAC Power PC
  2004-04-13 22:12 [Bug c/14947] New: Optimization leads to SegV for large locals on MAC Power PC fsmith at mathworks dot com
@ 2004-04-13 22:45 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-13 22:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-13 22:00 -------
This is a dup of bug 12828 which is fixed for 3.4.0.  The problem is -floop-optimize, you can disable it 
by -fno-loop-optimize but that disables some loop optimizations.

*** This bug has been marked as a duplicate of 12828 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|c                           |optimization
           Keywords|                            |patch, wrong-code
         Resolution|                            |DUPLICATE
   Target Milestone|---                         |3.4.0


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-04-13 22:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-13 22:12 [Bug c/14947] New: Optimization leads to SegV for large locals on MAC Power PC fsmith at mathworks dot com
2004-04-13 22:45 ` [Bug optimization/14947] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).