Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 333928

Summary: Bad code generated for SysMin_putch() on ARM M3 target
Product: [Technology] RTSC Reporter: Alan DeMars <ademars>
Component: RuntimeAssignee: Karl Wechsler <karl>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: d-russo, sascha
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Windows XP   
Whiteboard: target:3.20.07
Attachments:
Description Flags
ARM M3 code generated for SysMin_putch() none

Description Alan DeMars CLA 2011-01-10 19:23:28 EST
Build Identifier: 3.20.06.81 and 3.21.00.30

The code generated for the C code below:
 
        if (module->outidx == SysMin_bufSize) {
            module->outidx = 0;
            module->wrapped = TRUE;
        }
        module->outbuf[module->outidx++] = ch;

actually executes like this:

        old_outindex = module->outidx;

        if (old_outidx == SysMin_bufSize) {
            module->outidx = 0;
            module->wrapped = TRUE;
        }
        module->outidx++;
        module->outbuf[old_outidx] = ch;

This results in a scribbling of the memory address one beyond the end of the SysMin output buffer whenever the output buffer index wraps.

Reproducible: Always
Comment 1 Alan DeMars CLA 2011-01-10 19:24:20 EST
Created attachment 186447 [details]
ARM M3 code generated for SysMin_putch()
Comment 2 Dave Russo CLA 2011-01-13 14:43:17 EST
Fixed in xdc-v55
Comment 3 Sasha Slijepcevic CLA 2011-01-13 19:16:07 EST
Replicated the problem with 3.20.06.81 and observed in CCS that the characters are written to a location outside of the buffer. Rebuilt with 3.20.07.84 and observed that the characters are now written only within the boundaries of the buffer.
Comment 4 Dave Russo CLA 2011-06-20 14:36:44 EDT
Shipped in XDCtools 3.20.07