Skip to content

Natvis visualization for int128 is wrong. #455

Description

@MarekKnapek

Execute the following program in the Microsoft Visual Studio 2026 with natvis loaded and observe contents of the locals window or the watch window.

#include <boost/int128.hpp>

int main()
{
	boost::int128::int128_t a;
	boost::int128::int128_t b;
	boost::int128::int128_t c;
	boost::int128::int128_t d;
	boost::int128::int128_t e;
	boost::int128::int128_t f;
	boost::int128::int128_t g;
	boost::int128::int128_t h;

	a.low  = 0x0000000000000000ull;
	a.high = 0x0000000000000000ull;

	b.low  = 0x0000000000000000ull + 42;
	b.high = 0x0000000000000000ull;

	c.low  = 0xffffffffffffffffull - 42;
	c.high = 0x0000000000000000ull;

	d.low  = 0x0000000000000000ull + 42;
	d.high = 0x0000000000000001ull;

	e.low  = 0xffffffffffffffffull - 42;
	e.high = 0x7fffffffffffffffull;

	f.low  = 0x0000000000000000ull + 42;
	f.high = 0x8000000000000000ull;

	g.low  = 0xffffffffffffffffull - 42;
	g.high = 0xffffffffffffffffull;

	h.low  = 0xffffffffffffffffull;
	h.high = 0xffffffffffffffffull;

	__debugbreak();
}
  • The variable a contains the value of zero.
  • The variable b contains the value of 42.
  • The variable c contains the value of 42 before the great 2^64 boundary / barrier.
  • The variable d contains the value of 42 after the great 2^64 boundary / barrier.
  • The variable e contains the value of 42 before the great positive / negative boundary / barrier.
  • The variable f contains the value of 42 after the great positive / negative boundary / barrier.
  • The variable g contains the value of 42 before the absolute maximum.
  • The variable h contains the absolute maximum.

Also observe the following screenshot.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Boost ReviewFeedback from the review period including pre- and post- on the MLBugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions