Mail Archives: cygwin/1998/03/09/14:04:29
-----Original Message-----
From: Kevin Hughes [SMTP:kh AT wg DOT icl DOT co DOT uk]
Sent: 05 March 1998 16:12
To: Gnuwin95 (E-mail)
Subject: B19 compiler fail - on debug but not optimised
We have just moved to b19 and our project failed miserably, it compiled but
did not run. After much poking about in the
assmbler we discovered an odd switch which ended up jumping to part way
through an instruction. We recoded this as an if then else sequence and all
was fine. We then looked more deeply and extracted the failing source. We
also noted that if we compile with -O3 it all works.
Heres the code
typedef unsigned int uint;
typedef unsigned char uchar;
class AClass {
protected:
uint ib;
public:
AClass( void ) { }
AClass( uint initib ) { ib = initib; }
operator uint () { return ib; }
uint getTop() { return ib >> (16+9); }
bool hasPropertyX() { return true; }
typedef enum
{
XYZunk = 0, XYZ1 = 1, XYZ2 = 2, XYZ4 = 3, XYZopDep = 4,
XYZstDep = 5, XYZhalf = 6, XYZdble = 7, XYZ4to2 = 8, XYZsame = 9
} XYZType;
XYZType getXYZType()
{
static uchar XYZ[128] =
{
XYZunk, XYZsame, XYZsame, XYZsame, XYZunk, XYZunk, XYZunk,
XYZunk,
XYZsame, XYZ2, XYZsame, XYZsame, XYZsame, XYZsame, XYZsame,
XYZunk,
XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZsame,
XYZsame,
XYZsame, XYZopDep,XYZsame, XYZsame, XYZstDep,XYZsame, XYZunk,
XYZunk,
XYZsame, XYZ1, XYZ2, XYZ4, XYZsame, XYZhalf, XYZsame,
XYZsame,
XYZsame, XYZsame, XYZ1, XYZ1, XYZsame, XYZsame, XYZsame,
XYZsame,
XYZsame, XYZ1, XYZ2, XYZ4, XYZ2, XYZdble, XYZsame,
XYZsame,
XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZsame,
XYZsame,
XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZsame,
XYZsame,
XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZsame,
XYZsame,
XYZsame, XYZsame, XYZsame, XYZsame, XYZdble, XYZsame, XYZsame,
XYZsame,
XYZsame, XYZsame, XYZsame, XYZsame, XYZ4to2, XYZsame, XYZsame,
XYZhalf,
XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZsame,
XYZsame,
XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZdble,
XYZ4to2,
XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZdble,
XYZdble,
XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZsame, XYZdble,
XYZsame,
};
return ( XYZType ) ( XYZ[ this->getTop() ] );
}
int getNextXYZ( uint startXYZ )
{
switch ( getXYZType() )
{
case XYZ1:
return( 1 );
case XYZ2:
return( 2 );
case XYZ4:
return( 3 );
case XYZhalf:
return( startXYZ - 1 );
case XYZdble:
return( startXYZ + 1 );
case XYZ4to2:
return( startXYZ == 3 ? 2 : startXYZ );
case XYZsame:
return( startXYZ );
case XYZopDep: // MPSR only!
if ( hasPropertyX() )
{
return( 4 );
}
// Drop through!!
case XYZstDep:
case XYZunk:
default:
return( 0 );
}
}
};
main()
{
AClass x( 0x62000000 );
printf( "Next XYZ for %.8X = %d\n", x, x.getNextXYZ( 2 ) );
}
////////////////////////////////////////////////////////////////////////
/////
//
// gives the following behaviour..
//
// aab55>g++ -g -o swbuganon.exe swbuganon.c
// swbuganon.c: In function `int main()':
// swbuganon.c:77: warning: implicit declaration of function `int
printf(...)'
// aab55>./swbuganon.exe
// (C:\temp\swbuganon.exe 1124) Exception: STATUS_ACCESS_VIOLATION
// (C:\temp\swbuganon.exe 1124) Dumping stack trace to swbuganon.exe.core
// aab55>g++ -g -O3 -o swbuganon.exe swbuganon.c
// swbuganon.c: In function `int main()':
// swbuganon.c:77: warning: implicit declaration of function `int printf
(...)'
// aab55>./swbuganon.exe
// Next XYZ for 62000000 = 1
// aab55>
//
////////////////////////////////////////////////////////////////////////
//////
Hope this is usefull to the maintainers.
We will try this on the egcs compiler when it arrives - hope the problem
has been fixed.
Thanks for any input
Kevin
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -