UE 5.7.2 various unreachable code detected when using bEnableAddressSanitizer

Setting bEnabledAddressSanitizer to true when building Development Editor Win64 uncovers numerous issues with unreachable code in systems as diverse as:

NiagaraEditor

RigVM

TextureGraph

FoliageEdit

SequencerCore

I recommend someone enables the setting and reviews the output in order to determine if the behaviour of these systems is correct or there are unintended sideeffects.

Steps to Reproduce
1) Set bEnabledAddressSanitizer to true

2) Compile Development Editor Win64

Observe: MSVC compiler output indicates multiple error C4702: unreachable code

Hello [mention removed]​,

Thanks for the report. I was able to reproduce this locally by building the engine from source in UE 5.7.2 following the steps you mentioned.

This appears to be a regression since I tested the same setup in UE 5.6 and was not able to observe the same output there.

I’ll continue looking into this and follow up once I have more relevant information.

Best,

Francisco

Hi ​[mention removed]​,

I looked into this further and ASan for Windows Editor builds isn’t currently a supported workflow. That said, the unreachable code build failures you reported have already been addressed upstream in UE5-Main via several small changes, so you may be able to unblock compilation by integrating those fixes.

I was able to cherry-pick the following CLs into UE5/Release-5.7 and confirm they eliminate the C4702 build stops:

  • CL 45956790 – Fix unreachable code warnings revealed by Editor ASan builds (SequencerCore / ViewModel.h)
  • CL 45924069 – [FoliageEdit] Fix unreachable code error
  • CL 45836429 – Move binding for OnFinishedChangingProperties into reachable code
  • CL 48449262 – RigVM Variable Mapping: remove unreachable code

With these integrated, the Editor target will compile successfully with ASan enabled on 5.7. However, launching the Windows Editor built with ASan still crashes (in my case, during startup in the MovieScene/PreAnimatedState path), which prevents the Editor from loading.

Epic’s recommended usage on Windows is to enable ASan only for the Win64 Game/Client target (not the Editor), via *.Target.cs. For reference, Patrick Laflamme describes that workflow here: Can't debug project with ASan

I’d suggest enabling ASan only for your Game/Client target but if you want to pursue Editor ASan builds for experimentation, the CLs above should help unblock compilation.

Please let me know if this information helps.

Best,

Francisco

Thanks Francisco, I’ll give those CLs a look!

Hi [mention removed]​,

Glad to hear. Please let me know if you need anything further on this case. Otherwise, I’ll go ahead and close it for now.

Best,

Francisco