Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333928 - Bad code generated for SysMin_putch() on ARM M3 target
Summary: Bad code generated for SysMin_putch() on ARM M3 target
Status: CLOSED FIXED
Alias: None
Product: RTSC
Classification: Technology
Component: Runtime (show other bugs)
Version: unspecified   Edit
Hardware: All Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Karl Wechsler CLA
QA Contact:
URL:
Whiteboard: target:3.20.07
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-10 19:23 EST by Alan DeMars CLA
Modified: 2014-02-07 20:46 EST (History)
2 users (show)

See Also:


Attachments
ARM M3 code generated for SysMin_putch() (1.24 KB, text/plain)
2011-01-10 19:24 EST, Alan DeMars CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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