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

error : syntax error at token '-' in: IL_002d: ldc.r8 -nan(ind) with "return Double.NaN" #158

Closed
tapika opened this issue Jun 4, 2020 · 2 comments
Labels
Milestone

Comments

@tapika
Copy link

tapika commented Jun 4, 2020

Steps to reproduce:

Create demo project with function, which returns

return Double.NaN;
  • DllExport -version: 1.7.1
    With Visual studio 2017 it works. I have tried to start development prompt:
    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC>where ildasm
    C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\ildasm.exe

     C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC>ildasm /?|more
     Microsoft (R) .NET Framework IL Disassembler.  Version 4.0.30319.17929

Same code does not work with Visual Studio 2019.

    C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise>where ildasm
    C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\ildasm.exe

    C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise>ildasm /? |more
    Microsoft (R) .NET Framework IL Disassembler.  Version 4.8.3928.0

I have tried to override this by modifying project settings and enforcing specific tool version, like this:

    <DllExportILAsmCustomPath>C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools</DllExportILAsmCustomPath>

After that project compiled in both Visual studios.

Suspect some ildasm bug, at least looks somehow similar to:
#128 (comment)
=>

https://developercommunity.visualstudio.com/content/problem/545431/ildasmexe-regression-with-infinum-floating-point-v.html

Is this the same problem perhaps ?

I have vs2019 16.6.0, but there is update available, need to try it on.

@tapika tapika added the bug label Jun 4, 2020
@3F
Copy link
Owner

3F commented Jun 4, 2020

Confirmed.

NaN for single and double precision is now processed as -nan(ind) instead of (00 00 C0 FF) and (00 00 00 00 00 00 F8 FF), respectively.

Temporary solution: as it was already noticed, please use either our IL Assembler or custom path to any official version less than 4.8

@3F
Copy link
Owner

3F commented Jun 7, 2020

Optional NaNToken patching has been planned for 1.7.3

.field = float32(-nan(ind)) -> 0xFFC00000
.field = float64(-nan(ind)) -> 0xFFF8000000000000

ldc.r8 -nan(ind) -> 00 00 00 00 00 00 F8 FF
ldc.r4 -nan(ind) -> 00 00 C0 FF

You can check this via related CI build 9f26c9b

3F added a commit that referenced this issue Jun 12, 2020
* FIXED: Fixed syntax error at token '-' in: IL_002d: ldc.r8 -nan(ind) with "return Double.NaN"
         Through "Single + Double NaN token patching" option. Issue #158.
            ```
            .field = float32(-nan(ind)) -> 0xFFC00000
            .field = float64(-nan(ind)) -> 0xFFF8000000000000

            ldc.r8 -nan(ind) -> 00 00 00 00 00 00 F8 FF
            ldc.r4 -nan(ind) -> 00 00 C0 FF
            ```

* FIXED: NuGet packages are not visible as installed when DLLExport enabled for project.
         Issue #152.

* FIXED: Concurrency Issue with Parallel Project Builds. Issue #73.

* FIXED: Fixed the first phase of the build when restoring. Related issue #159.

* FIXED: Fixed VS NuGet PM possible error:
         "You cannot call a method on a null-valued expression."

* CHANGED: Improves package integration. PR  #161.
            - Updated logic for packages through `-pkg-link` key.
            - Removed `-force` key from the project files
              if it was pushed together with other commands for manager.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants