From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.redhat.com (mail.redhat.com [199.183.24.239]) by listman.redhat.com (Postfix) with ESMTP id EAFB83119B for ; Wed, 4 Oct 2000 17:44:38 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.11.0/8.8.7) id e94Licg05905 for axp-list@listman.redhat.com; Wed, 4 Oct 2000 17:44:38 -0400 Received: from pop3.dvic.com (IDENT:root@[63.237.68.6]) by mail.redhat.com (8.11.0/8.8.7) with ESMTP id e94LibD05901 for ; Wed, 4 Oct 2000 17:44:38 -0400 Received: from voicenet.com ([63.237.68.248]) by pop3.dvic.com (8.9.3/8.8.7) with ESMTP id RAA15882; Wed, 4 Oct 2000 17:40:21 -0400 Message-ID: <39DBA4BF.EAAA8E8E@voicenet.com> Date: Wed, 04 Oct 2000 16:44:31 -0500 From: Uncle George Organization: GatWorks X-Mailer: Mozilla 4.72 [en] (X11; I; Linux 2.2.16 alpha) X-Accept-Language: en MIME-Version: 1.0 To: axp-list@redhat.com, Michal Jaegermann Subject: Re: who is responsible for egcs/gcc on alpha nowadays References: <200010041549.JAA25588@ellpspace.math.ualberta.ca> Content-Type: multipart/mixed; boundary="------------1C194DDD830098C4C2C741CA" X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0beta4 Precedence: bulk Reply-To: axp-list@redhat.com List-Id: Linux and Red Hat on Alpha processors This is a multi-part message in MIME format. --------------1C194DDD830098C4C2C741CA Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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
, 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. --------------1C194DDD830098C4C2C741CA Content-Type: text/plain; charset=us-ascii; name="tstparm.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="tstparm.c" 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 ); } --------------1C194DDD830098C4C2C741CA Content-Type: text/plain; charset=us-ascii; name="tstparm2.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="tstparm2.c" 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; } } } --------------1C194DDD830098C4C2C741CA--