r/cpp • • 6d ago

How can we get MSVC to actually test their compiler?

It seems like every update to MSVC over the past year has had some sort of massive basic compiler regression, that the team refuses to actually hotfix because regressions are not actually considered problematic. What can we do to change this and actually make regressions fixable without waiting 6+ months? Having "LTS" compilers isn't useful when every LTS compiler has some break in it.

Using older compilers isn't an option, because we're an open source library that people use, and also GitHub Action runners automatically update to the newest compilers and don't make it easy to use old ones.

https://developercommunity.visualstudio.com/t/x64-MSVC-1952-O2-miscompiles-inline-ar/11182010?q=double+19.52

This is our new one from this time.

84 Upvotes

51 comments sorted by

102

u/STL MSVC STL Dev 6d ago

Build your code with VS Insiders' MSVC Build Tools Preview and promptly report bugs with self-contained test cases (ideally minimal, but self-contained is sufficient), following https://aka.ms/compilercrash . Don't wait until the general availability release. Fixing stuff during Preview is easiest, and fixes will appear in the next preview in 1-2 weeks. If you wait until GA, then yeah, it's going to be 6 months until the next GA. Or we have to backport the fix in servicing, which we can do, but it might take about a month to ship, and it's very time-consuming due to the paperwork and validation involved, which directly eats at our ability to fix a larger total volume of bugs.

If you have a popular open-source library that's constantly encountering toolset regressions, then we can consider adding it to our "Real World Code" test suite. (RWC is expensive in terms of time and machine resources for us to run, which is why we have thresholds for what we're willing to add.)

25

u/ThadeeusMaximus 6d ago edited 6d ago

It’d be great if GitHub Actions had preview runners. If your stance is to use the preview toolsets, you should work with them to actually make that possible to do.

It’d be great if we could either do that ourselves or get in the regression tests. We’ve had to work around major issues in the nov 25 release, the may 26 release and now the nov 26 release. And all 3 have been silent code gen bugs.

38

u/STL MSVC STL Dev 6d ago

Getting feature requests to GitHub is... not easy.

Send me an email (it brings me great joy to have gotten my preferred three-letter username both on reddit and at work) with a link to your open-source project, a brief description of what it does, how widely it's used, and how active your contributors are, and as exhaustive a list as you can build of the MSVC toolset bugs you've encountered (a flat list of DevCom links is fine), and I can route it to the RWC maintainers. Silent bad codegen is pretty bad and it sounds to me like your project is worth considering. (This is easier if it's quick to build, quick to test, and doesn't exhibit weird flakiness.)

13

u/ThadeeusMaximus 6d ago edited 6d ago

I'll do that this week sometime.

But yeah, for open source projects, following that advice is very difficult because no preview action runners exist, and its not safe to use private runners for public open source repos. So theres essentially no solution to actually use preview msvc builds without just manually running it occasionally. We've tried to change the installed MSVC on actions runners, but the installer just hangs and we can't actually do it. So we're forced to use the toolchains they have installed.

I think the big issue is regressions not meeting a servicing bar. To me, that honestly makes no sense. New features not working correctly to me is what doesn't meet a servicing bar, and if a new feature doesn't work that should be pushed to the next servicing release. Breaking existing code and then saying we're sorry, we'll fix it in 6 months is rough.

10

u/Wetmelon 6d ago

I wonder what u/STL (the name) is worth at this point lol.

7

u/kalmoc 6d ago

Silent code gen bigs, as in the generated code doesn't do what's it supposed to do? And ms isn't fixing them in a timely manner? Oh boy

5

u/Ameisen vemips, avr, rendering, systems 6d ago

What I run into are usually performance regression... and it seems to be about 50/50 whether those get fixed or marked as "won't fix". Usually, the compiler putting out incredibly poor and redundant assembly for some things.

Rarely, deeper discussions ensue such as what the semantics actually imply (such as if noalias functions can be assumed to return the same value if called right after itself).

7

u/fortsnek274 6d ago

citation needed

But let me provide one: https://developercommunity.visualstudio.com/t/Regression-in-MSVC-1952:-x64-O2-miscom/11185575

Occasionally, you see bugs like that show up, and you just wonder.

6

u/ThadeeusMaximus 6d ago

Ours is a super simple one too. https://developercommunity.visualstudio.com/t/x64-MSVC-1952-O2-miscompiles-inline-ar/11182010?q=double+19.52

I just know that as soon as we see an issue, the soonest we can have it fixed is 6-12 months from now. Because the team doesn't consider regressions as worthy of hotfixing.

5

u/fortsnek274 6d ago

At least compiler bugs tend to get fixed pretty quickly. Especially as they're doing a lot of work on the optimiser. Which is probably why it happened...

7

u/ThadeeusMaximus 6d ago

That's generally not what I've been told in the past. I've been told that unless it's a regression that hits a major internal customer, it won't get fixed until the next servicing release, which is in May. Small regressions, even silent micompilations get delayed.

0

u/Wonderful-Habit-139 6d ago

May? of 2027? That is pretty ridiculous...

0

u/fortsnek274 6d ago

I'm sure somebody like STL will come in and clear this up. But I do see a bunch of quick fixes on devcom, assuming they're listed correctly.

2

u/nunquam_rideo 6d ago

Wow, that's an embarrassing bug for a major compiler

48

u/MarkSuckerZerg 6d ago

Last time I reported a fatal bug (not crash, but infinite loop) in MSVC toolchain, I made a mistake of disclosing I have a workaround in the bug report ("if I do 'X' instead of 'Y', it works as expected").

They used that against me and told me it's low prio since there is a workaround. I reported it in 2024 and fix happened sometimes in VS 2026

32

u/drodri 6d ago

Not defending anyone, but I think it is common practice in product management and backlog prioritization: if there are ways users can move forward, then it is way lower priority than other bugs, issues and features (lack of), that could be holding back or blocking users.

4

u/MarkSuckerZerg 6d ago

Yeah, that's true, but I would never set reproducible crash bug to low prio. I would have added some temporary error printout and fix it later on my project

2

u/drodri 6d ago

Sure, there are many factors, having a workaround is not the only one, it also depends on the severity, consequences when it is triggered, etc., so something that crashes probably should have been higher priority. But also at large volume projects it can be challenging to do the right prioritization, miscategorization happens, and the "has workaround" maybe got too much consideration in this oen.

7

u/Plazmatic 6d ago

MSVCs team prior to around this year post c++20 development has been extremely bad, like embarrassingly bad for Microsoft, and people (especially MS management) should have been deeply ashamed.  But since this year this has basically completely flipped around. All of my previously reported bugs have been fixed, even those that were lower priority or had workarounds.  Even the several new bugs I reported were fixed in a couple of weeks with out weird weaseling out of responsibility like you described.  I suspect the very reason your bugs were even fixed at all was because of this change in 2026, not because it took them two years to get through the backlog.

10

u/Gloomy_Necesary 6d ago

Probably cause of claude or codex tbh

19

u/mguid65 6d ago

There have been bugs in MSVC I've found in the past that their compiler devs told me would not be fixed, not because they couldn't but because they would break ABI.

8

u/mguid65 6d ago

I wouldn't necessarily consider them to be benign either since some of these technically make the c++ implementation non-conforming. Thinks like no-unique-address, strange empty base behavior, and that scoped enums do not carry their strong type information when passed as NTTPs. They are encoded as integers like unscoped enums meaning they can collide. Meaning E1::A == E2::A in this situation. So MSVC itself violates ODR on code that is supposed to be standard conforming.

4

u/starfreakclone MSVC FE Dev 3d ago

Unfortunately, ABI compatibility holds us back from fixing the name encoding problem.

43

u/CrasseMaximum 6d ago

Last time I reported a regression it's been fixed the next day. If you provide a proper example reproducing your issue it will likely be fixed quickly.

29

u/Possibility_Antique 6d ago

I mean, I have open bug reports that have survived for years at this point, with fully working examples in compiler explorer. They even successfully compile on other compilers, but several of my bug reports have been flagged as "low priority" and therefore don't get assigned to be fixed.

11

u/StockyDev 6d ago

Link them :) Getting people to upvote can improve visibility to the team... Also I am fairly sure a few of the Devs see this subreddit regularly.

9

u/Possibility_Antique 6d ago

Funny enough, I was going to take your advice and link one. I maintain a high performance linear algebra library, and one of the features I make use of is variadic array initializers to support automatic size/type deduction of arbitrary tensors.

There was a bug where MSVC would think there was an out of bounds array access inside of a constexpr context, but clang/gcc handled it correctly. Submitted in 2020. I just went to link it here, and I noticed they fixed it in January of this year, 6 years after I submitted the bug report. So now I have to eat my words. Still, 6 years is quite some time to wait. At least I now get to implement my container class correctly now.

3

u/StockyDev 6d ago

Fair play. 6 years is a long time. There are some long lived ones that I am personally very interested in too. E.g. Please make a warning that is on par with -Wunused-variable. This one is from 2019 and is "under review"

4

u/CrasseMaximum 6d ago

I have to admit I reported when working for a company, maybe that played in my favor.

14

u/holyblackcat 6d ago

As others have said, switch to Clang. We recently switched at work, and got faster binaries and faster compilation. (Fun fact, we found that clang built with clang works faster than clang built with gcc.)

3

u/Trubydoor LLVM dev 6d ago

Lots of people build clang with clang and make that codegen faster, on both sides of the equation. As in, making clang faster at building clang, and also making clang’s codegen for clang better. I used to work on a team that did a bit of this and I know for sure we were a very small player in that field!

60

u/Zero_Owl 6d ago

We can start by telling exactly what is wrong instead of some general accusations which lead nowhere.

17

u/MarkSuckerZerg 6d ago

he did include link to the bug report...

13

u/CrasseMaximum 6d ago

I think he did not initially

6

u/ack_error 6d ago

I got it down to this min repro, on latest preview (x64 14.52.37032.0)... took forever to dig through all of the template machinery. Looks like some bug between the inliner and autovectorizer.

struct _unit_t {};
struct meter_t : public _unit_t { double m_value; };
struct PoseLike {
    meter_t m_x;
    meter_t m_y;
    meter_t X() const { return m_x; }
    meter_t Y() const { return m_y; }
};
struct A { double x, y; };
A toPose(const PoseLike& p) {
    A a;
    a.x = p.X().m_value * 10.0;
    a.y = p.Y().m_value * 10.0;
    return a;
}

11

u/jesseschalken 6d ago

This sub is not the MSVC team, use the previous version or clang-cl.

6

u/Dragdu 6d ago

Option 1: Be a big enough library to be in their "OSS test suite" (if that's still a thing, given MS's general demeanor as of late).

Option 2: Have significant social media following so the shitstorm reaches their PMs and they will personally interfere to get your issue fixed.

Option 3: Pay them $$$ for their substandard compiler, so that your bug reports get prioritized.

3

u/ozyx7 6d ago

If you have specific examples, perhaps you could write and provide test cases for them to run?

3

u/eboys 6d ago

MSVC is a compiler I don't take seriously. Switch to clang-cl and forget it

2

u/ImNoRickyBalboa 6d ago

That's embarrassing 😳

2

u/hanotak 6d ago

Switch to CLang.

2

u/robstoon 6d ago

Ever hear the saying fool me once, shame on you, fool me twice, shame on me? MSVC has been fooling people for literally decades. Use a different compiler.

1

u/feverzsj 6d ago

Sooner or later you gonna switch to clang on windows.

1

u/13steinj 6d ago

No, stop using Microsoft products? They can't stop screwing up their own operating system and cloud services, you think they will care about their C++ compiler when internally they're generally Rust and LLM -pilled if you speak to any connections off the record?

Unironically, I think you'll get better results convincing whatever your industry is to invest in using mingw / clangw. Potentially even in switching to Linux. This isn't claiming that you'll get your customers to switch to Linux easily. Just that you'll have difficulty in having MS have their compiler anywhere near the quality of GCC/Clang.

1

u/Zeh_Matt No, no, no, no 6d ago

I would love to know this too, its such an annoyance when the CI suddenly starts failing on vcpkg packages that were perfectly fine before and now one has to wait for the project to either work around the issue and then have someone get it updated on vcpkg OR wait for the compiler fix and then have that also deployed on all runners. I wish they would just drop it and make clang the default.

Edit: The failing library in question is openal-soft.

Edit 2: As of this post the latest commit is https://github.com/kcat/openal-soft/commit/2934c1bb6a2501a7c6af08f297d25884111074be which is just another one of those "MSVC workarounds", its quite pathetic at this point.

1

u/Rob-190 6d ago

I've found Microsoft to be incredibly helpful when I've reported problems. Yes, you do need to be very clear what the problem is and ideally provide an example that shows the issue, which can sometimes take a lot of effort. I don't think people should be complaining. Microsoft give us an amazing compiler, with an IDE that's far better than anything else that's available, and to all intents and purposes, it's FREE.

-1

u/WoodyTheWorker 6d ago

I wonder if they fixed an old bug with const qualifiers, and at this point I'm afraid to ask, and I don't really care anymore.

0

u/[deleted] 6d ago

[deleted] — view deleted comment

2

u/Suitable_Plate4943 6d ago

when its a bug on the feature you really want...
fortunately you can just #if _MSC_VER > lol