[EXT_EP-10833] Compiler fails to handle bare \r as a line separator Created: 06/Jun/22 Updated: 02/Apr/24 Resolved: 29/Jun/22 |
|
Status: | Fixed |
Project: | Embedded Software & Tools |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | High |
Reporter: | TI User | Assignee: | TI User |
Resolution: | Fixed | Votes: | 0 |
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Product: | Code Generation Tools |
Internal ID: | CODEGEN-10058 |
Forum URL: | https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1103378/tms320f280025-compiler-issue |
Found In Release: | C7000_1.4.0.LTS C2000_22.6.0.LTS C6000_8.3.0 MSP430_20.2.0.LTS C7000_2.1.0.LTS MSP430_21.6.0.LTS C2000_21.6.0.LTS ARM_20.2.0.LTS C2000_20.2.0.LTS |
Fix In Release: | ARM_20.2.7.LTS C7000_2.1.2.LTS C2000_20.2.7.LTS C2000_22.6.1.LTS MSP430_21.6.1.LTS C6000_8.3.13 C7000_1.4.3.LTS C2000_21.6.1.LTS MSP430_20.2.7.LTS |
Affected Platform/Device: | default |
Workaround: | Insert a carriage return \n or \r\n before the affected line of code. |
Description |
The parser for the TI compiler treats stand alone carriage return \r as white space. If a line of code (function call, expression, etc) following a line with For below example, the function call two() is treated as comments as continued from the comments at end of the previous line. void one(), two(); void line_ending_test() { one(); // this line ends with only \r two(); }More details % od -An -c -w10 line_ending_test.c v o i d o n e ( ) , t w o ( ) ; \r \n \r \n v o i d l i n e _ e n d i n g _ t e s t ( ) \r \n { \r \n o n e ( ) ; / / t h i s l i n e e n d s w i t h o n l y \ r \r t w o ( ) ; \r \n } \r \n Notice how every line ends with the sequence \r \n, except for the one with the comment: // this line ends with only \r . The TI proprietary compilers, including cl2000, view the bare \r character like a space or tab. It does not cause the line to end. Thus, the call to the function two() is commented out. Every other compiler I tried, including tiarmclang, views the bare \r as a line separator. Thus, the call to the function two() is not commented out. This is easily verified by viewing the assembly code generated by the compiler. I loaded this into compiler explorer, and tried many compilers. https://godbolt.org/z/Tfa7hTPad . Every one I tried generates a call to the function two(). |