ID |
Summary |
State |
Reported In Release |
Target Release |
Workaround |
Release Notes |
CODEGEN-5317 |
Ternary (?:) expression with 0/1 result uses type of predicate, not result, when optimised |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.4.LTS |
Compile with -Ooff. |
An expression like "(p ? 1 : 0)" can be converted by the compiler into "(p != 0)". If the types of 1 and 0 are wider than int, and the expression is shifted left, as in "(p ? 1UL : 0UL) << 16", then the value shifted will be int instead of the wider type, and the overall value will be incorrect. |
CODEGEN-5236 |
Register allocation failure |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.4.LTS |
No practical workaround |
The compiler may, in rare cases, allocate registers incorrectly. The most common symptom would be an internal error indicating that register allocation has failed. This problem has only been observed on C28x compiler version 8.1.3.LTS, but could occur for other ISAs. |
CODEGEN-5033 |
Functions in <string> incorrectly return NULL |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.4.LTS |
Ignore or suppress the warning. |
char_traits<char>::find() and char_traits<wchar_t>::find() return char* and wchar_t*, respectively. In our __string file (included by <string>), they are written to return NULL, which is (void*)0 and not the same type as the declaration, thus producing a warning. We have updated the file to make them return 0, which fixes the warnings. |
CODEGEN-4959 |
Premature deallocation of VLA arrays |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.4.LTS |
Rewrite the code so that it does not use VLA |
The intent behind C99 variable-length arrays (VLA) is that they are allocated on the stack, and thus are deallocated when the call frame is inactivated (by returning, or by being discarded with longjmp). However, we don't support actually allocating them on the stack, so we use malloc/free to simulate this. This works fine if the function exits normally; the parser turns a VLA declaration into a call to __vla_alloc, and placing a __vla_dealloc just before the function exits. However, what do you do if a longjmp skips over the function exit? The implementation needs a way to detect that and clean up dead VLAs.
It does this by keeping track of the SP during the call to __vla_alloc. When either __vla_alloc or __vla_dealloc is called, it looks at its own SP and compares it to the stored SP for each of the allocated VLAs it knows about. For MSP430, the stack grows toward zero. If the SP for any of the known VLAs is less than the current function's SP, those VLAs were allocated by a call to __vla_alloc deeper in the call stack than the current function, and thus must be dead.
This fails when procedure abstraction (PA) is involved, because PA creates a tiny little function to contain the PA code. This tiny little function has a lesser SP than the calling function, so it looks like a call deeper in the call stack. If there are any calls to __vla_alloc in the PA code, and any calls to either __vla_alloc or __vla_dealloc left in the calling function, the latter will cause any VLAs allocated in the PA code to be freed prematurely.
|
CODEGEN-4678 |
Incorrect error due to typedef of very large object |
Fixed |
|
MSP430_18.1.3.LTS |
As a workaround, remove the typedef. Where the typedef was used, instead use the type the typedef refers to. |
The TI compiler infrastructure is incapable of handling user-declared objects above a certain size, because it mistakenly truncates the size of very large objects. Formerly, this resulted in quiet corruption, which was defect CODEGEN-449. Now that CODEGEN-449 is fixed, the compiler will emit an error if the user attempts to create a type larger than the tool can handle. However, this error check is not quite right for typedefs. A typedef for a very large object that is still within the compiler's limit may cause the parser to mistakenly emit an error that the object is greater than the maximum supported size. |
CODEGEN-4638 |
When shift counts are higher than 32, compiler sometimes optimizes to an incorrect shift count |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.2.LTS |
Turn off optimization by using optimization level off.
Otherwise, avoid a left-shift by a constant as an operand of the listed operations. However, compiler optimizations could interfere with this. Try keeping the shift count in a global variable instead of as a literal, or computing the shift separately into a variable (a global or volatile local) and doing the |, +, etc, on the variable. |
Left shifts by 32 or more, as an operand of +, -, &, |, or ^, (eg, ((X<<56) | (Y<<48))) may produce incorrect results. |
CODEGEN-4622 |
Builtin test __has_builtin incorrectly claims to support many __builtin functions |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.2.LTS |
Do not use __has_builtin until it is fixed. |
MCU release 18.1.x.LTS added the __has_builtin feature to detect whether or not a particular builtin function was supported. However, this feature test mistakenly returned true for a great number of builtins that the TI compiler does not support. |
CODEGEN-4605 |
Incompatible redeclaration error with -o4 when using anonymous unions |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.2.LTS |
Do not use anonymous structs or unions; give all struct members a name, even if it is never used. |
Anonymous structs and unions are a GCC extension. They are members of a parent structure and have no names. You access the elements inside them as if they were direct members of the parent class. If you have an anonymous struct or union inside a union and you use -O4 optimization, you may get the mistaken error "symbol so-and-so redeclared with incompatible type" at link time. This bug can only happen in COFF mode.
Essentially the same bug was previously fixed for EABI and was known as CODEGEN-1191. |
CODEGEN-4600 |
Warning when using pragma RETAIN with attribute((noinit)) |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.3.LTS |
|
When using pragma RETAIN with attribute((noinit)) on the same symbol for an EABI target, a .clink directive is erroneously emitted in the assembly file, leading to a warning that the .CLINK directive is being ignored because the symbol already has .RETAIN specified. |
CODEGEN-4581 |
Using the C interlister with C++14 features may generate error |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.2.LTS |
Do not use the -s source interlisting option |
When using the -s C source interlisting option, the compiler may emit a bogus assembly directive for functions which do not have a body in the source code (e.g. certain implicit constructors). The assembler will emit an error when encountering this directive. |
CODEGEN-4576 |
hex --ascii option truncates address to 16 bits |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.2.LTS |
Use the hex converter from an earlier release |
When generating an "ASCII" format hex file, the hex converter would mistakenly truncate addresses to the lower 16 bits. |
CODEGEN-4419 |
Compiler erroneously speculates indexed load from the stack |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.2.LTS |
Modify the source code of the offending function to make local variables "volatile." There's no obvious way to pre-determine that a function will suffer from this bug; you just have to wait for the bug to happen, look at the line number of the offending instruction (which will always be a load with indexed addressing with base register SP), and go to the function at that line number. Make every local variable in that function "volatile." If it's a C++ function, you may need to make the function "volatile." |
The compiler moves instructions from one block to another to increase parallelism. Usually this is done by predicating (adding a condition to) every instruction that is moved above a branch. However, in some cases, the compiler will "speculate" the instruction, which means removing the condition entirely. This is done when the instruction's side-effects are judged to be safe, such as load of a local variable. In the case that the instruction's condition would have been false, this load will be useless, but at least it will be safe, because the stack pointer (SP) is at a legal location, and there won't be a memory fault. However, when a local variable's value is read with an indexed expression, the index register is not necessarily speculated exactly when the load is, so the index register may have a garbage value. In this test case, the load was speculated, but the index register definition wasn't, so in the false branch, the computed address was garbage, and we would read a random memory address, causing a memory fault. (Even though SP was perfectly valid, the index register was garbage, so SP+index might point anywhere in memory.) |
CODEGEN-4407 |
Not using const causes unexpected build error when calling std::sort |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.2.LTS |
Remove unnecessary const from helper in s__algo.c |
|
CODEGEN-4339 |
div() and ldiv() return incorrect result when built with -o4 option |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.0.LTS |
|
|
CODEGEN-4280 |
Using ULP advisor with C++ templates may cause the compiler to crash |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.2.LTS |
|
The compiler may crash when using ULP advisor on C++ code that contains templates |
CODEGEN-4182 |
Should ignore option --pending_instantiations when compiling C files |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.2.LTS |
If the user wishes to use the option --pending_instantiations, they must add this option individually to each C++ file. |
The compiler option --pending_instantiations only makes any sense when used with C++ code. It cannot have any effect on C code. Indeed, when passed as an option to a compilation of C code, the compiler will stop and emit an error, "pending instantiations option can be used only when compiling C++"
This is troublesome when trying to compile a mixture of C and C++ files in CCS. If the user wishes to use the option --pending_instantiations, they cannot just add this option to the global compiler options list; they must add this option individually to each C++ file. |
CODEGEN-4113 |
Assembler computes wrong result for expression 0x232800 % 0x10000 |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.2.LTS |
In some instances, as in the original test case, the AND operator can be used instead, but that is not a general workaround. |
The modulo operator in the TI assembler, for releases made in mid-to-late 2016 and all of 2017, is unreliable. In some cases it will produce an incorrect answer. |
CODEGEN-4078 |
LInker takes over 5 minutes to finish |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.2.LTS |
None. If the linker command file wants to be that specific about memory ranges, then the work has to be done, and the option to disable the work has its own bug. |
Linking may take excessively long when the linker command file specifically places a lot of variables at specific addresses, especially for C2000. The original report was placing more than 300 variables. The --no_placement_optimization option is not a workaround because it causes a linker crash. Both problems are fixed together. |
CODEGEN-3955 |
libc++ has incorrect implementation of pointer_safety |
Fixed |
|
MSP430_18.1.0.LTS |
|
The implementation of std::pointer_safety is a struct, rather than as an enum_class, as required by the C++ standard. |
CODEGEN-3931 |
Compiler crashes while handling 0 length array in zero sized struct |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.2.LTS |
None |
The compiler crashes while parsing a struct or class with zero-sized members in C++ mode. |
CODEGEN-3923 |
DWARF CFI information lost due to microoptimizations |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.3.LTS |
No practical workaround. |
Some optimizations in the compiler would change instructions but fail to retain debugging directives attached to those instructions. This could impact the accuracy of the DWARF debugging information in various ways. |
CODEGEN-3918 |
Writing multiple input sections in one line unexpectedly changes how input sections are combined into output sections |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.0.LTS |
Stick with separate lines, if there are subsection cases like this one that should be comprehended. |
In a linker command file, using a line like "hello.obj (.const, .far)" may link differently than two lines with one section each. The problem is that the single line is interpreted as the OR of the two sections, and the linker does not understand that the OR also encompasses any of their subsections. Two separate lines are analysed separately and completely. |
CODEGEN-3858 |
OFD gets DIE attribute offset wrong when using --dwarf_display=none,dinfo |
Fixed |
|
MSP430_18.1.0.LTS |
If you use --dwarf_display=none,dinfo, use --dwarf_display=none,dinfo,types instead |
You can use OFD to display the DWARF debugging information in your object files by using the option '--dwarf' (or -g). You can narrow the categories of DWARF information displayed by using the '--dwarf_display' option. If you use the option --dwarf_display=none,dinfo you will see the DWARF DIE objects in the .dwarf_info section, but you will not see any DW_AT_type attributes unless you also use the "types" flag. This is not a bug. However, when OFD skips a DW_AT_type attribute, it displays the offset of the skipped DW_AT_type for the next attribute instead of the next attribute's correct offset. |
CODEGEN-3801 |
Linker crashes with INTERNAL ERROR (unhandled exception) |
Fixed |
|
MSP430_18.1.0.LTS |
|
The linker experiences a segmentation fault when there is a reference from a debug section to a symbol without a section (for example, an absolute symbol). |
CODEGEN-3794 |
False warning for MISRA 10.1/10.2 when commutative binary operands swapped |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.2.LTS |
|
In certain cases, the compiler could emit an unwarranted MISRA diagnostic about type conversion. This would occur when using a commutative binary arithmetic operator with mixed operand types. The compiler mistakenly compared one operand's type to the other type. It should have compared each type to the promoted type of the operation. |
CODEGEN-3619 |
pragma triggers false MISRA-C:2004 19.1/A warning |
Fixed |
|
MSP430_18.1.0.LTS |
N/A |
Certain pragmas appearing prior to #include statements, such as #pragma RESET_MISRA, would cause MISRA warning 19.1/A to be issued:
MISRA-C:2004 19.1/A: #include statements in a file should only be preceded by other preprocessor directives or comments |
CODEGEN-3595 |
Stack usage under reports stack amount used because it fails to handle function aliases |
Fixed |
MSP430_18.1.0.LTS |
MSP430_18.1.2.LTS |
|
CCS Stack Assistant did not accurately track aliased functions-- functions whose definitions are represented by a different symbol name. Now, the alias function will be used to determine stack size correctly, and the aliased function call name will be replaced with its alias. Currently, the Stack Assistant GUI is not capable of showing both the aliased and alias function names for calls to aliased functions-- this will require a future update. |
CODEGEN-2373 |
Internal linker error triggered by function alias |
Fixed |
|
MSP430_18.1.0.LTS |
|
Linker sometimes generates "Assertion failed" message and aborts. |
CODEGEN-1979 |
Statements before declarations with no white space (aggravated by macros) may cause incorrect parser error |
Fixed |
|
MSP430_18.1.0.LTS |
Do not start any statement in the left-most column
Rearrange your code so that there are no statements before declarations. |
C99 and C++ allow statements before declarations in functions. This is not allowed by the C89 language, but as an extension, the TI compiler allows such statements in relaxed mode. However, in certain circumstances, the compiler may emit the 'error: expected "}"' for otherwise legal code which has statements before declarations.
This problem can only occur in relaxed C89 mode (which is the default mode), and 1) you have a function with statements that start in the left-most column, or 2) you use macros where the macro body contains C code with statements before declarations. |