https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123850
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to YunQiang Su from comment #3)
> (In reply to Andrew Pinski from comment #1)
> > The bug is only inside main there are dups.
>
> Yes, or not.
>
> ```
> int f() {
> std::vector<char> v = {1, 2, 3, 4, 5};
> v.resize(49);
> // no return: this will emit another warning/error.
> }
> ```
>
> also emit this warning;
Well in that case calling f is undefined.
It is similar to:
```
#include <vector>
void f() {
{
std::vector<char> v = {1, 2, 3, 4, 5};
v.resize(49);
}
__builtin_unreachable ();
}
```
basically f without a return is considered as cold as it is unreachable as it
would cause undefined behavior.
Main is consider cold as it is called ever only once (in C++).