Opened 7 years ago
Closed 7 years ago
#62 closed new feature (fixed)
Add support for the identification of uninitialised variables
Reported by: | phdmakk | Owned by: | phdmakk |
---|---|---|---|
Priority: | major | Milestone: | v2.0.0 Series |
Component: | T3Q | Version: | 2.0 |
Keywords: | Cc: |
Description
T3Q shall raise an error message whenever there is an operation involving an uninitialised variable, i.e. regardless of the type of the variable or the operation done over it. The feature shall be enabled/disabled using the xml configuration file. For example, given:
function f_ConditionalSpec() { var integer v_s0; var integer v_s1; var integer v_s2 := 1; var integer v_s3; var integer v_s4; var integer v_s5; //v_s2 is initialised upon declaration -> no warning if (v_s2 == 1) { //v_s3 is not initialised -> warning //v_s0 initialised within the conditional after this statement v_s0 := v_s3 + 1; //v_s1 is not initialised -> warning //v_s2 is initialised -> no warning //v_s3 initialised within the conditional after this statement v_s3 := v_s2 + 1 + v_s1; //v_s3 is initialised above -> no warning //v_s4 initialised within the conditional after this statement v_s4 := v_s3 + 1; } else { //v_s2 is initialised -> no warning //v_s4 initialised within the else branch after this statement v_s4 := v_s2 + 1; } //v_s3 is only initialised within one of the possible paths -> warning //v_s4 is initialised within both possible paths (within all branches of the conditional above) -> no warning v_s5 := v_s3 + v_s4; }
This feature requires data flow analysis.
Change History (2)
comment:1 Changed 7 years ago by phdmakk
- Owner set to phdmakk
- Status changed from new to accepted
comment:2 Changed 7 years ago by phdmakk
- Resolution set to fixed
- Status changed from accepted to closed
Note: See
TracTickets for help on using
tickets.