Skip to content

compiler issue in msvc 2026? #2899

Description

@leadcoder

osgEarth Version: master

Description of the problem:

When compiling osgEarth in RelWithDebInfo and Release with msvc 2026 (Version: 18.2.0) and running the feature_country_boundaries.earth sample in the osgEarthViewer I get a crash in OGRFeatureSource, https://github.com/gwaldron/osgearth/blob/1569a59f57396aba94c4d5dc2075926bac17e79f/src/osgEarth/OGRFeatureSource.cpp#L287

If i can trust the debugger it looks like the osg::ref_ptr constructor executed in the filterList.push_back get a nullptr and as result i get "Unhandled exception thrown: write access violation.
this was 0x10." in the OpenThreads::Atomic::operator++ method called by the osg::ref_ptr constructor

What you have tried:

  • No crash in Debug (msvc2026)
  • No crash msvc 2022 RelWithDebInfo and Release
  • Everything works if i just push the ref_ptr without release, ie filterList.push_back(feature);
  • I've tried other vector-data sources and get the same issue.

I tried check for nullptr (should not happen), ie
auto* feature_ptr = feature.release();
if (feature_ptr)
filterList.push_back(feature_ptr);

...but same problem, when the exception is raised and catched by the debugger the feature_ptr is null in the debugger? very confusing.

I have not looked at the assembler code but maybe optimization bug in the compiler?

Metadata

Metadata

Assignees

No one assigned

    Labels

    supportSupport questions

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions