#35 compiler failure

closed-works-for-me
z80 port (188)
5
2001-07-21
2000-11-21
Anonymous
No

Something appears to be wrong with the Z80 implementation of SDCC.

Having recently downloaded sdcc-2.1.1-src.tar.gz, untared, configured, compiled and installed etc.
I decieded to give the compiler a simple test (listed below).
Unfortunately the results were less than encouraging.

SDCC version: 2.2.1
Linux version: Slackware 2.2.15
Command line used: sdcc -mz80 test.c
RESULT_DUMP
test.c(20):error *** FATAL Compiler Internal Error in file 'gen.c' line number '4843'
: got '>=' or '<=' shouldn't have come here
Contact Author with source code
test.c(27):error *** code not generated for 'main' due to previous errors
END_RESULT

START_FILE:test.c
/*
*-------------------------------------------------
*/
int putch( int Ch )
{
return( Ch );
}
/*
*-------------------------------------------------
*/
int puts( char *Str )
{
char *Ptr;

for( Ptr = Str; *Ptr != '\0'; Ptr++ )
{
putch( *Ptr );
}

return( (Ptr - Str) );
}
/*
*--------------------------------------------------
*/
void main( void )
{
puts( "hello world\n" );
}
/*
*----------------------------------------------------
*/
END_FILE

Further:
using 'sdcc test.c' seems to work - compile, assemble and link - but I'm not trying to target the 8051.
using 'sdcc -mgbz80 test.c' does compile but results in a help listing for the assemble pass.

The indicated line in sdcc/z80/gen.c does indeed generate this error message, it is in the middle of a switch statement relating to the interpretation of compiler tokens,
but how or why it hits that point with such a token is beyond my cursory examination.

I have tried a number of variations of implementation of the 'for' loop in my test code, but lacking any debug output I am at a loss. I realize the test code is trivial, and probably inefficient, but it was intended to exercise the compiler and allow me to evaluate the resultant assembler rather than to achieve any specific goal on a target system.

Any help or suggestion (or bug fixes) gladly accepted.

Peter Townson.

Discussion

  • Johan Knol

    Johan Knol - 2001-05-25
    • assigned_to: nobody --> michaelh
     
  • Michael Hope

    Michael Hope - 2001-07-21

    Logged In: YES
    user_id=373

    Cannot reproduce with sdcc-20010720. Sorry.

     
  • Michael Hope

    Michael Hope - 2001-07-21
    • status: open --> closed-works-for-me
     

Log in to post a comment.