[Bug c++/126868] -ftrivial-auto-var-init=uninitialized should be incompatible with -std=c++26 (or at least warn about it)
"jakub at gcc dot gnu.org via Gcc-bugs" <[email protected]>
| Newsgroups | gmane.comp.gcc.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126868 --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- [[indeterminate]] int a; if (a == a) all_is_good(); else fire_missiles(); can fire_missiles() or do anything else, even in C++26. And, so can -ftrivial-auto-var-init=uninitialized when it is defined as if [[indeterminate]] was implied on everything the attribute can appertain to. Having a user a way to opt out is really necessary, while in a lot of code the extra cost isn't that significant, e.g. in huge switches with a lot of vacuously initialized variables in the scope of the switch body, the cost can be significant. And the users should have a way to opt out, not just to use -std=c++23 forever because they aren't willing to accept the slowdowns.