Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integer initializer values expressed as decimal are compiled incorrectly if they have lead zeros #31

Open
ForsakenShell opened this issue Nov 16, 2023 · 2 comments

Comments

@ForsakenShell
Copy link

ForsakenShell commented Nov 16, 2023

Regardless of a script property or variable, Caprica v0.3.0 is not parsing decimal integer values with lead zeros as initializers correctly.

Papyrus Script:

Scriptname TestInitializer Extends Form

Int i7dc   = 0007 Const
Int i8dc   = 0008 Const
Int i124dc = 0124 Const

Int i7hc   = 0x0007 Const
Int i8hc   = 0x0008 Const
Int i124hc = 0x007C Const

ASM output from Caprica v0.3.0:

.info
  .source "TestInitializer.psc"
  .modifyTime 0
  .compileTime 1700096266
  .user "REDACTED"
  .computer "REDACTED"
.endInfo
.userFlagsRef
.endUserFlagsRef
.objectTable
  .object TestInitializer Form
    .userFlags 0
    .docString ""
    .autoState 
    .structTable
    .endStructTable
    .variableTable
      .variable i7dc Int const
        .userFlags 0
        .initialValue 7
      .endVariable
      .variable i8dc Int const
        .userFlags 0
        .initialValue 0
      .endVariable
      .variable i124dc Int const
        .userFlags 0
        .initialValue 84
      .endVariable
      .variable i7hc Int const
        .userFlags 0
        .initialValue 7
      .endVariable
      .variable i8hc Int const
        .userFlags 0
        .initialValue 8
      .endVariable
      .variable i124hc Int const
        .userFlags 0
        .initialValue 124
      .endVariable
    .endVariableTable
    .guardTable
    .endGuardTable
    .propertyTable
    .endPropertyTable
    .propertyGroupTable
    .endPropertyGroupTable
    .stateTable
      .state
      .endState
    .endStateTable
  .endObject
.endObjectTable
@ForsakenShell ForsakenShell changed the title Integer initializer values >7 expressed as decimal are compiled incorrectly if they have lead zeros Integer initializer values expressed as decimal are compiled incorrectly if they have lead zeros Nov 16, 2023
@leppie
Copy link

leppie commented Nov 16, 2023

Many programming languages treat integers with a leading 0 as octal. 0124 emitted as 84 (decimal) confirms that is the same case here.

@ForsakenShell
Copy link
Author

"undocumented feature" - got it ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants