Fix #112933: Bug crash 17.0+ MSVC builds with function passed-by-value arguments captured in lambdas #112616
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#112616
Loading…
Reference in New Issue
No description provided.
Delete Branch "mod_moder/blender:tmp_fix_msvc_bug"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
MSVC builder (Windows platform) have a bug that cause the crash of
the Split Edges node from Geometry Nodes.
This bug already being investigated by Microsoft team [1].
Until compiler bug be fixed (and it will be guaranteed that the blender
will not build on damaged versions), this fix should be used in blender.
Bug can be occurred in other places, so this fix might be reused in other places.
The define used to not violate the code style guide and simplify
future cleaning to delete this.
ms offered 2 workarounds, however they do not do the same thing
the bug in the ms compiler is in the inliner, by putting __declspec(noinline) on the function, the inliner doesn't run and we don't get bad code.
the bug in the ms compiler, more specifically is with how the inliner handles struct parameters by value, by passing these parameters by reference, the bug doesn't trigger and we don't get bad code.
passing these parameters by reference, does NOT disable the inliner, as your patch currently suggest.
Fix: get rid of the define, just pass by reference (given @HooglyBoogly / @JacquesLucke sign off on that)
if we are determined we want to use some form of macro here it'll have to be guarded so it'll only affect msvc 17.7+
I'd rather use
__declspec(noinline)
or even betterBLI_NOINLINE
here. This function is only called once for the entire mesh, inlining it shouldn't be important. And for consistency I'd rather keep passing these arguments by value.BLI_NOINLINE_MS
sounds very generic, but it only applies to very specific MSVC versions, that's not OK. Just useBLI_NOINLINE
and put the logic at the call site inmesh_split_edges.cc
BLI_NOINLINE
does not work. The error may appear somewhere else. This must be explicitly declared for general use.I see why you would think that, but no, a generic solution is not needed, this is a temporary issue at a limited number of call sites (currently 1) solve it at the call site
Note: this would also fix #112933
Fix: Bug crash 17.0+ MSVC builds with function passed-by-value arguments captured in lambdasto Fix #112933: Bug crash 17.0+ MSVC builds with function passed-by-value arguments captured in lambdasDoes it not work to just use
BLI_NOINLINE
for this function and add a comment? I don't understand why this has to be more complicated than that.BLI_NOINLINE
does not work.try this
Why not capturing lambda arguments as values instead of references?
just put
BLI_NOINLINE
on that method, you're making it much more difficult than it needs to be@ -201,3 +196,1 @@
const Span<int> corner_to_face_map,
const BitSpan split_edges,
const IndexMask &affected_verts)
BLI_NOINLINE static Array<Vector<CornerGroup>> calc_all_corner_groups(
/* BLI_NOINLINE because MSVC 17.7 has a codegen bug here, given there is only a single call to this function, not inlining it for all platforms won't affect performance. See https://developercommunity.visualstudio.com/t/10448291 for details. */