google / wuffs

Wrangling Untrusted File Formats Safely

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MSVC internal compiler error

tksuoran opened this issue · comments

FYI: https://developercommunity.visualstudio.com/t/fatal--error-C1001:-Internal-compiler-er/10703305

I have not tried to make a minimal repro yet, but at least the workaround might be useful while waiting for MS to fix the compiler not to crash.

Thanks for the FYI.

Another workaround might be to temporarily downgrade wuffs-v0.4.c from the latest (alpha) version, v0.4.0-alpha.5, to the previous one (v0.4.0-alpha.4: check out commit f169822) until we hear more from the Microsoft C++ team.

I don't use Windows or MSVC, so I'm only guessing, but I'm curious if your "Internal compiler error" repro still crashes (with the latest Wuffs version, v0.4.0-alpha.5) if you pass the /arch:AVX or /arch:AVX2 compiler flag.

I am already using the v0.4.0-alpha.5 tag. I added /arch:AVX2 - the ICE still happens the same.

This config does not trigger MSVC ICE:

#define WUFFS_CONFIG__MODULES
#define WUFFS_CONFIG__MODULE__ADLER32
#define WUFFS_CONFIG__MODULE__AUX__BASE
#define WUFFS_CONFIG__MODULE__AUX__IMAGE
#define WUFFS_CONFIG__MODULE__BASE
#define WUFFS_CONFIG__MODULE__JPEG

If I add CRC32 module (required by PNG), there ICE gets triggered.

#define WUFFS_CONFIG__MODULES
#define WUFFS_CONFIG__MODULE__ADLER32
#define WUFFS_CONFIG__MODULE__AUX__BASE
#define WUFFS_CONFIG__MODULE__AUX__IMAGE
#define WUFFS_CONFIG__MODULE__BASE
#define WUFFS_CONFIG__MODULE__CRC32
#define WUFFS_CONFIG__MODULE__JPEG

Huh, interesting.

I still don't have MSVC but if you have the time, you could #define WUFFS_CONFIG__MODULE__CRC32 (to trigger ICE) and then delete lines of code from the wuffs_crc32__ieee_hasher__up_x86_sse42 function (in wuffs-v0.4.c line 36762) until the ICE stops? That might give us (and the Microsoft C++ team) a reproducer.

If you want a minimal reproducer, you should be able to trim the module allow-list to just this:

#define WUFFS_CONFIG__MODULES
#define WUFFS_CONFIG__MODULE__CRC32

I've just rolled Wuffs v0.4.0-alpha.6, which rolls back to the v0.4.0-alpha.4 behavior where, on MSVC, SIMD is opt in (instead of v0.4.0-alpha.5's opt out).

You can still get ICE if you opt in, but at least you should no longer see this ICE by default.

#define WUFFS_CONFIG__ENABLE_MSVC_CPU_ARCH__X86_64_V2 (or _V3) to opt in.