DEVELOPMENT TOOLS TIPS AND TRICKS
Go to bottomPage: 1
TOPIC:
#2267
Another heavy compiler bug 8 Months ago Karma: 0
Another heavy compiler bug.
Zilog IDE version 5.3.0 (17021001)
Zilog eZ80 Macro Assembler Version 4.2 (17030704)
Zilog eZ80 ANSI C Compiler Version 3.4 (17030704)
Zilog IEEE 695 Linker/Locator Version 6.25 (17030704)
Zilog IEEE 695 Object Librarian Version 4.12 (17030704)
GNU Make version 3.81
Scintilla IEditor version 1.0 (17020301)
Simulator Nexus Layer DLL version 1.00 (17013101)
eZ80 Disassembler version 1.02 (17013101)
eZ80 Acclaim! USB Smart Cable Nexus DLL version 1.10 (17013101)
eZ80 Acclaim! Serial Smart Cable Nexus DLL version 1.00 (17013101)
eZ80 Acclaim! ZPAKII Nexus DLL version 1.00 (17013101)
eZ80 Acclaim! Ethernet Smart Cable Nexus DLL version 1.00 (17013101)
Cycle-accurate eZ80 Instruction Simulator version 1.02 (17013101)


Example: See my comments marked with SIE:

File FreeRTOS DHCP.c from FreeRtos-Plus Project
***********************************************************************************************************************************************
Code:


uint16_t usGenerateProtocolChecksum( const uint8_t * const pucEthernetBuffer, size_t uxBufferLength, BaseType_t xOutgoingPacket )
{
uint32_t ulLength;
uint16_t usChecksum, *pusChecksum;
const IPPacket_t * pxIPPacket;
UBaseType_t uxIPHeaderLength;
ProtocolPacket_t *pxProtPack;
uint8_t ucProtocol;
#if( ipconfigHAS_DEBUG_PRINTF != 0 )
const char *pcType;
#endif

/* Check for minimum packet size. */
if( uxBufferLength < sizeof( IPPacket_t ) )
{
return ipINVALID_LENGTH;
}

/* Parse the packet length. */
pxIPPacket = ( const IPPacket_t * ) pucEthernetBuffer;

/* Per https://tools.ietf.org/html/rfc791, the four-bit Internet Header
Length field contains the length of the internet header in 32-bit words. */
#if 1 //SIE: 
uxIPHeaderLength = ( UBaseType_t ) ( sizeof( uint32_t ) * ( pxIPPacket->xIPHeader.ucVersionHeaderLength & 0x0Fu ) );
#else



results in the following wrong code.

Code:


001B20 DD0706              A 11350     LD BC,(IX+%6)
001B23 DD0FEA              A 11351     LD (IX+%FFFFFFEA),BC
                           A 11352    ; 1812
                           A 11353    ; 1813 /* Per https://tools.ietf.org/html/rfc791, the four-bit Internet Header
                           A 11354    ; 1814 Length field contains the length of the internet header in 32-bit words. */
                           A 11355    ; 1815 #if 1
                           A 11356    ; 1816 uxIPHeaderLength = ( UBaseType_t ) ( sizeof( uint32_t ) * ( pxIPPacket->xIPHeader.ucVersionHeaderLength & 0x0Fu ) );
                           A 11357    .LINE 1816
                           A 11358    
001B26 E60F                A 11359     AND A,%F ;SIE: forgotten to load the Accu first with pxIPPacket->xIPHeader.ucVersionHeaderLength
001B28 B7ED62              A 11360     UEXT HL     ;SIE: Macro "or a,a" "sbc hl,hl" ; clear hl
001B2B 6F                  A 11361     LD L,A
001B2C 29                  A 11362     ADD HL,HL
001B2D 29                  A 11363     ADD HL,HL
001B2E DD2FFA              A 11364     LD (IX+%FFFFFFFA),HL

Diese webseite ist echte Scheisse (User)
Fresh Boarder
Posts: 5
graphgraph
User Offline Click here to see the profile of this user
Location: Hamburg, Germany
The administrator has disabled public write access.
 
Go to topPage: 1
Moderators: Tom Ormiston
The Sample Center is managed separately
from Zilog's Customer Support services,
and therefore requires a separate login.
Acknowledged! Take me to the Sample Center.
Disable this pop-up in the future.