Fri Jun 6 04:37:00 GMT 2003
We are trying to develop a tool to check the code by reading the compiler trees generated from gcc. While parsing through the trees, we found the following issues. Please suggest us, if there is any utility, which gives us the data that directly reflect the user code with out doing any optimization or processing of the user code.
1. const is coming only for variables in form of read_only_flag. With this we are only able to identify read only variables. But we are not able to identify pointers that are pointing to constant data like "const char *p."
2. "Implicit data types could not be found Ex: var = 7; This var is implicitly treated as a integer variable."
3. "Repeated data definitions cannot be found. They will be overWritten.
The second declaration has an initializer, so it ignores the previous declaration.
4. For a conditional statement like (i>0)? i:-i is treated as a abs_expr (Absolute Expression) instead of an conditional expression.
5. If there is an else statement with a NULL body, then it will be ignored.
6. There is no differentiation done between extern declaration and a forward declaration for a function.
7. For an inline function declaration, the inline information for the function is missing in the tree.
8. While iterating multiple input file, with top_lev_main, it is failing inside stor-layout.c
9. The function declaration comes as default at the definition, even if there is no declaration for the function.
10. If the function definition follows a function declaration, then the declaration is getting overwritten by the definition.
11. Sometimes in function declaration, a void member is padded at the end of the function argument list.
12. If the function takes in variable number of parameters ( … ), this information is missing in the trees.
13. For function declarations, the argument name information is missing.
14. "In a Compound expression, if there are multiple expressions, only the first and last expressions are considered for adding in the tree, as the compund expression can have only two arguments like (a+2, b+3, a+b+c): Will be taken as (a+2, a+b+c)"
15. "Size of construct: If there is a structure type definition inside a type declaration like struct,
In this case the unit size of the record type includes the size of the structure definition even though there is no member defined for the internal structure. This case gives a difference in size when we attain through sizeof() operation."
16. "in-built functions can not be traced as the tree is constructed using the information. The sizeof construct is replaced by its value in the tree."
17. The enumeration Constants are replaced by their values in the tree.
18. Tree information in a long variable ( for ex if a function call is made func(20l) it is not possible to recognize these situations.)
19. "All the implicit conditional statements are expanded in the tree. If ( i ) => if ( i != 0 )"
20. An expression like w < 20 will be treated as w <= 19
21. Implicit cast and explicit cast of data types could not be differentiated.
22. Prefix and postfix ( ++, -- ) are optimized in iterative statement, in which they are swapped.
23. All the constant expressions are evaluated in the tree.
24. "Compound assignment operators are expanded to simple operators. a>>=b is expanded to a = a >> b;"
Thanks in advance,
Hate Junk Email? Ebook helps you stop it - http://BlockJunkEmail.com
Select your own custom email address for FREE! Get firstname.lastname@example.org w/No Ads, 6MB, POP & more! http://www.everyone.net/selectmail?campaign=tag
More information about the Gcc-help