This tiny program gives the expected variable redeclaration error when run in the IDE but the optimising compiler doesn't detect this and emits code that causes a type conversion error in csc.exe. This may or may not be considered a bug as most programs will be run in the IDE first but the error during compilation is unhelpfully different to that in the IDE.
B4X:
Sub Globals
Dim d
End Sub
Sub App_Start
test
End Sub
Sub test
Dim d As Number
d = 23
End Sub