Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Uncle George <gatgul@voicenet.com>
To: axp-list@redhat.com,
	Michal Jaegermann <michal@ellpspace.math.ualberta.ca>
Subject: Re: who is responsible for egcs/gcc on alpha nowadays
Date: Wed, 04 Oct 2000 16:44:31 -0500	[thread overview]
Message-ID: <39DBA4BF.EAAA8E8E@voicenet.com> (raw)
In-Reply-To: 200010041549.JAA25588@ellpspace.math.ualberta.ca

[-- Attachment #1: Type: text/plain, Size: 2968 bytes --]

Ok, now got a simple sample. it seems that using -O2 causes the frame pointer
to be off.
compile with
gcc -O2 -g   tstparm.c tstparm2.c

using "gdb a.out"  u can either step trace  ( display/i $pc  & then si ), or
just "r" and  show the back trace
a -02 build has this back trace. the variable lineAddr should have
0x1000000007 in it

===========================================================
$ gdb a.out
GNU gdb 19991004
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.

Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "alpha-redhat-linux"...
(gdb) r
Starting program: /gat/alinux-java/build/solaris/a.out

Program received signal SIGSEGV, Segmentation fault.
foo_4ch_bl (leftEdges=0x1000000001, rightEdges=0x1000000002,
    xStarts=0x1000000003, yStarts=0x1000000004, sides=0x1000000005,
    dstData=0x200003a5408 " h\025", lineAddr=0x200003aaa48, dstYStride=1,
    srcYStride=1299556) at /tmp/tstparm2.c:35
35  foo_s32  yFinish = sides[1];
(gdb) where
#0  foo_4ch_bl (leftEdges=0x1000000001, rightEdges=0x1000000002,
    xStarts=0x1000000003, yStarts=0x1000000004, sides=0x1000000005,
    dstData=0x200003a5408 " h\025", lineAddr=0x200003aaa48, dstYStride=1,
    srcYStride=1299556) at /tmp/tstparm2.c:35
#1  0x12000044c in main () at /tmp/tstparm.c:37

=====================================================================
and gcc  -O1 -g produces this
======================================================================

gdb a.out
GNU gdb 19991004
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.

Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "alpha-redhat-linux"...
(gdb) r
Starting program: /gat/alinux-java/build/solaris/a.out

Program received signal SIGSEGV, Segmentation fault.
foo_4ch_bl (leftEdges=0x1000000001, rightEdges=0x1000000002,
    xStarts=0x1000000003, yStarts=0x1000000004, sides=0x1000000005,
    dstData=0x1000000006 <Address 0x1000000006 out of bounds>,
    lineAddr=0x1000000007, dstYStride=268435464, srcYStride=268435465)
    at /tmp/tstparm2.c:35
35  foo_s32  yFinish = sides[1];


Michal Jaegermann wrote:

> Uncle George wrote:
> >
> > It seems like the egcs compiler in redhat/6.2 is producing bad stack
> > addressing. In my case it appears to be off by 16 bytes, and fetches the
> > 7th arg from the wrong place( short by 16 bytes in fact ).
>
> I, for one, would be really interested in seeing a sample code which
> would demonstrate that.  I have seen in the past wrong offsets but they
> were results of bugs in sources.

[-- Attachment #2: tstparm.c --]
[-- Type: text/plain, Size: 933 bytes --]

typedef signed char        foo_s8;
typedef unsigned char      foo_u8;
typedef short              foo_s16;
typedef unsigned short     foo_u16;
typedef int                foo_s32;
typedef unsigned int       foo_u32;
typedef float              foo_f32;
typedef double             foo_d64;



typedef long long          foo_s64;
typedef unsigned long long foo_u64;

foo_f32 foo_t_u8[7],
        foo_t_bc[7],
        foo_t_s16f_bc[7];


foo_f32 foo_t_u8[7];
foo_f32 foo_t_Q8[7];

main()
{

 
	foo_s32 *leftEdges = 0x1000000001; 
	foo_s32 *rightEdges = 0x1000000002;
	foo_s32 *xStarts = 0x1000000003;
	foo_s32 *yStarts = 0x1000000004;
	foo_s32 *sides = 0x1000000005;
	foo_u8 *dstData  = 0x1000000006;
	foo_u8  **lineAddr = 0x1000000007;
	foo_s32 dstYStride   = 0x10000008;
	foo_s32 srcYStride =   0x10000009;

foo_4ch_bl(leftEdges, 
		rightEdges, 
		xStarts,
		yStarts,
		sides,
		dstData, 
		lineAddr,
		dstYStride , 
		srcYStride );

}


[-- Attachment #3: tstparm2.c --]
[-- Type: text/plain, Size: 4295 bytes --]

typedef signed char        foo_s8;
typedef unsigned char      foo_u8;
typedef short              foo_s16;
typedef unsigned short     foo_u16;
typedef int                foo_s32;
typedef unsigned int       foo_u32;
typedef float              foo_f32;
typedef double             foo_d64;



typedef long long          foo_s64;
typedef unsigned long long foo_u64;
typedef unsigned long      foo_addr;

extern const foo_f32 foo_t_u8[],
                      foo_t_u8f[],
                      foo_t_s16f[];
extern const foo_f32 foo_t_u8[];
extern const foo_f32 foo_t_Q8[];

void foo_4ch_bl(foo_s32 *leftEdges,
 foo_s32 *rightEdges,
 foo_s32 *xStarts,
 foo_s32 *yStarts,
 foo_s32 *sides,
 foo_u8  *dstData,
 foo_u8  **lineAddr,
 foo_s32 dstYStride ,
 foo_s32 srcYStride )
{
  foo_s32  xLeft, xRight, X, Y;
 foo_s32  xSrc, ySrc;
 foo_s32  yStart = sides[0];
 foo_s32  yFinish = sides[1];
 foo_s32  dX = sides[2];
 foo_s32  dY = sides[3];
 foo_u8  *srcPixelPtr;
 foo_u8  *dstPixelPtr;
 foo_u8  *dstLineEnd;
 foo_s32  j; 
  foo_u8  *srcPixelPtr2;

  for (j = yStart; j <= yFinish; j++) {
    foo_f32  fdx, fdy;
    foo_f32  a00_0, a01_0, a10_0, a11_0;
    foo_f32  a00_1, a01_1, a10_1, a11_1;
    foo_f32  a00_2, a01_2, a10_2, a11_2;
    foo_f32  a00_3, a01_3, a10_3, a11_3;
    foo_f32  pix0_0, pix1_0, res0;
    foo_f32  pix0_1, pix1_1, res1;
    foo_f32  pix0_2, pix1_2, res2;
    foo_f32  pix0_3, pix1_3, res3;

    dstData += dstYStride;
 xLeft = leftEdges[j];
 xRight = rightEdges[j];
 X = xStarts[j];
 Y = yStarts[j];
 if (xLeft > xRight) continue;
 dstPixelPtr  = (foo_u8 *)dstData +  4  * xLeft;
 dstLineEnd   = (foo_u8 *)dstData +  4  * xRight; 

    fdx = foo_t_Q8[(X >> 8) & 0xFF];
 fdy = foo_t_Q8[(Y >> 8) & 0xFF];
 ySrc = ( Y  >> (16 -3)) &~ 7 ;
  Y += dY;
 xSrc = X>> 16 ;
  X += dX;
 srcPixelPtr = (*(foo_u8  **)((foo_addr) lineAddr  +   ySrc ))  +  4  * xSrc;
 srcPixelPtr2 = (foo_u8  *)((foo_u8 *)srcPixelPtr + srcYStride); 
 
   a00_0  = foo_t_u8[srcPixelPtr[  0 ]];
 a01_0  = foo_t_u8[srcPixelPtr[  4 ]];
 a10_0  = foo_t_u8[srcPixelPtr2[  0 ]];
 a11_0  = foo_t_u8[srcPixelPtr2[  4 ]]; 
    a00_1  = foo_t_u8[srcPixelPtr[  1 ]];
 a01_1  = foo_t_u8[srcPixelPtr[  5 ]];
 a10_1  = foo_t_u8[srcPixelPtr2[  1 ]];
 a11_1  = foo_t_u8[srcPixelPtr2[  5 ]];
 
    a00_2  = foo_t_u8[srcPixelPtr[  2 ]];
 a01_2  = foo_t_u8[srcPixelPtr[  6 ]];
 a10_2  = foo_t_u8[srcPixelPtr2[  2 ]];
 a11_2  = foo_t_u8[srcPixelPtr2[  6 ]];
 
    a00_3  = foo_t_u8[srcPixelPtr[  3 ]];
 a01_3  = foo_t_u8[srcPixelPtr[  7 ]];
 a10_3  = foo_t_u8[srcPixelPtr2[  3 ]];
 a11_3  = foo_t_u8[srcPixelPtr2[  7 ]];
 




    for (;dstPixelPtr < dstLineEnd; dstPixelPtr+=4) {
      pix0_0  = a00_0  + fdy * (a10_0  - a00_0 );
 pix1_0  = a01_0  + fdy * (a11_0  - a01_0 );
 res0  = pix0_0  + fdx * (pix1_0  - pix0_0 );
 
      pix0_1  = a00_1  + fdy * (a10_1  - a00_1 );
 pix1_1  = a01_1  + fdy * (a11_1  - a01_1 );
 res1  = pix0_1  + fdx * (pix1_1  - pix0_1 );
 
      pix0_2  = a00_2  + fdy * (a10_2  - a00_2 );
 pix1_2  = a01_2  + fdy * (a11_2  - a01_2 );
 res2  = pix0_2  + fdx * (pix1_2  - pix0_2 );
 
      pix0_3  = a00_3  + fdy * (a10_3  - a00_3 );
 pix1_3  = a01_3  + fdy * (a11_3  - a01_3 );
 res3  = pix0_3  + fdx * (pix1_3  - pix0_3 );
 
      fdx = foo_t_Q8[(X >> 8) & 0xFF];
 fdy = foo_t_Q8[(Y >> 8) & 0xFF];
 ySrc = ( Y  >> (16 -3)) &~ 7 ;
  Y += dY;
 xSrc = X>> 16 ;
  X += dX;
 srcPixelPtr = (*(foo_u8  **)((foo_addr) lineAddr  +   ySrc ))  +  4  * xSrc;
 srcPixelPtr2 = (foo_u8  *)((foo_u8 *)srcPixelPtr + srcYStride);
 
      a00_0  = foo_t_u8[srcPixelPtr[  0 ]];
 a01_0  = foo_t_u8[srcPixelPtr[  4 ]];
 a10_0  = foo_t_u8[srcPixelPtr2[  0 ]];
 a11_0  = foo_t_u8[srcPixelPtr2[  4 ]];
 
      a00_1  = foo_t_u8[srcPixelPtr[  1 ]];
 a01_1  = foo_t_u8[srcPixelPtr[  5 ]];
 a10_1  = foo_t_u8[srcPixelPtr2[  1 ]];
 a11_1  = foo_t_u8[srcPixelPtr2[  5 ]];
 
      a00_2  = foo_t_u8[srcPixelPtr[  2 ]];
 a01_2  = foo_t_u8[srcPixelPtr[  6 ]];
 a10_2  = foo_t_u8[srcPixelPtr2[  2 ]];
 a11_2  = foo_t_u8[srcPixelPtr2[  6 ]];
 
      a00_3  = foo_t_u8[srcPixelPtr[  3 ]];
 a01_3  = foo_t_u8[srcPixelPtr[  7 ]];
 a10_3  = foo_t_u8[srcPixelPtr2[  3 ]];
 a11_3  = foo_t_u8[srcPixelPtr2[  7 ]];
 
      dstPixelPtr[0] = res0;
      dstPixelPtr[1] = res1;
      dstPixelPtr[2] = res2;
      dstPixelPtr[3] = res3;

    }
  }
}

  parent reply	other threads:[~2000-10-04 21:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-04 13:10 who is responsible for egcs/gcc on alpha nowadays Uncle George
2000-10-04 15:49 ` Michal Jaegermann
2000-10-04 18:32   ` Matt Wilson
2000-10-04 19:06   ` Uncle George
2000-10-04 21:44   ` Uncle George [this message]
2000-10-04 17:05 ` Nathan Paul Simons
  -- strict thread matches above, loose matches on Subject: below --
2000-11-30 23:12 Hankinson, Jeremy
2000-12-01  8:12 ` Christian Iseli
     [not found] <61FC074AB601D411B7970050046089BA047F520E@softwareag.com>
2000-12-01  9:01 ` Joerg Bruehe
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox