View Issue Details

IDProjectCategoryView StatusLast Update
0000145GC StudioCompilerpublic2022-04-10 05:19
Reporterevanvennn Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version99.02.18 
Target Version99.02.19Fixed in Version99.02.19 
Summary0000145: ASM error caused by incorrect assignment of variable in complex IF statement
DescriptionFix: Resolves incorrect compilation of ASM when a variable is not 'used' but is defined in complex 'if' statement. [1344]

~~~~
#option explicit
#chip 16F15324, 32

#define PIN PORTA.5
#define INPUT_STATE_FLAG_INITIAL_STATE_ON 1

Dim flags as word

flags = 0

If PIN = flags.INPUT_STATE_FLAG_INITIAL_STATE_ON Then
    ' ...
End If
~~~~
Steps To Reproduce
#option explicit
#chip 16F15324, 32

#define PIN PORTA.5
#define INPUT_STATE_FLAG_INITIAL_STATE_ON 1

Dim flags as word

flags = 0

If PIN = flags.INPUT_STATE_FLAG_INITIAL_STATE_ON Then
    ' ...
End If
TagsNo tags attached.

Activities

evanvennn

2022-04-06 07:14

administrator   ~0000067

Resolved in CompileConditions() method.

            'Add to resolve undeclared variable, as an undeclared variable causes ASM error and the memory has not be allocated
            FoundUserVar = HashMapGet( @(Subroutine(0)->Variables) , Left(R2,Instr(R2,",")-1) )
            If FoundUserVar = 0 Then
              'Create a variable but do not mark as used - this will then throw an Explict error as expected
              AddVar Left(R2,Instr(R2,",")-1), TypeOfValue( Left(R2,Instr(R2,",")-1) , CurrSub), 1, CurrSub, "REAL", Origin, -1 , 0
            Else
              'variable has been located just validate its use
              AddVar Left(R2,Instr(R2,",")-1), TypeOfValue( Left(R2,Instr(R2,",")-1) , CurrSub), 1, CurrSub, "REAL", Origin, -1 , -1
            End If

evanvennn

2022-04-06 07:15

administrator   ~0000068

Resolved in 1105

evanvennn

2022-04-06 07:16

administrator   ~0000069

Angel - uploaded and closed

evanvennn

2022-04-06 14:17

administrator   ~0000073

IN build 1006

Issue History

Date Modified Username Field Change
2022-04-06 07:11 evanvennn New Issue
2022-04-06 07:14 evanvennn Note Added: 0000067
2022-04-06 07:15 evanvennn Status new => feedback
2022-04-06 07:15 evanvennn Note Added: 0000068
2022-04-06 07:16 evanvennn Note Added: 0000069
2022-04-06 14:17 evanvennn Status feedback => resolved
2022-04-06 14:17 evanvennn Resolution open => fixed
2022-04-06 14:17 evanvennn Status resolved => closed
2022-04-06 14:17 evanvennn Note Added: 0000073
2022-04-07 00:15 angel-spartan Status closed => resolved
2022-04-07 00:15 angel-spartan Product Version => 99.02.18
2022-04-07 00:15 angel-spartan Fixed in Version => 99.02.19
2022-04-07 00:15 angel-spartan Target Version => 99.02.19
2022-04-10 05:19 angel-spartan Status resolved => closed