https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123985
Giuseppe D'Angelo <peppe at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |peppe at gcc dot gnu.org
--- Comment #1 from Giuseppe D'Angelo <peppe at gcc dot gnu.org> ---
We've also spotted a 15->16 regression with -Wmaybe-uninitialized in Qt at -O0
only, reduced testcase:
https://gcc.godbolt.org/z/z7oo8oTKa
class QVectorPath
{
public:
QVectorPath(const double *points, int count)
: m_points(points),
m_count(count)
{
}
~QVectorPath();
private:
QVectorPath(const QVectorPath &) = delete;
const double *m_points;
const int m_count;
};
class QRectVectorPath : public QVectorPath {
public:
inline QRectVectorPath()
: QVectorPath(pts, 4)
{ }
double pts[8];
};
int main()
{
QRectVectorPath r;
}
<source>: In constructor 'QRectVectorPath::QRectVectorPath()':
<source>:23:29: warning: '<unknown>' may be used uninitialized
[-Wmaybe-uninitialized]
23 | : QVectorPath(pts, 4)
| ^
<source>:4:5: note: by argument 2 of type 'const double*' to
'QVectorPath::QVectorPath(const double*, int)' declared here
4 | QVectorPath(const double *points, int count)
| ^~~~~~~~~~~
Compiler returned: 0
The warning disappears at higher -O levels.
By the way, I'm not sure why it talks about argument 2 when it's argument 1
(0?).