-
Bug
-
Resolution: Won't Do
-
Normal
-
rhel-8.9.0
-
None
-
None
-
None
-
rhel-sst-pt-gcc
-
ssg_platform_tools
-
1
-
False
-
-
None
-
None
-
None
-
None
-
None
When using g++ from devtoolset-12-gcc-c++ to compile a test file, a warning about uninitialized memory is shown. This warning is not present on devtoolset-11-gcc-c++.
~~~
$ cat foo.cpp
#include <string>
struct Foo
{
static Foo OK;
~Foo() noexcept( false ) {}
};
Foo Foo::OK;
Foo run()
{
if ( 1 == 0 )
switch ( 1 )
{
case 1:
{
try
catch ( int ex )
{
}
}
}
std::string text;
return Foo::OK;
}
~~~
When using devtoolset-11-gcc-c+, it compiles without warnings. When using devtoolset-12-gcc-c+, the following is shown:
~~~
[root@r79 ~]# source /opt/rh/devtoolset-12/enable
[root@r79 ~]# g++ -Wall -c src/foo.cpp -o obj/foo.o
src/foo.cpp: In function ‘Foo run()’:
src/foo.cpp:26:10: warning: ‘<anonymous>’ is used uninitialized [-Wuninitialized]
26 | }
^ src/foo.cpp:16:19: note: ‘<anonymous>’ was declared here 16 |
return Foo::OK; |
^~ [root@r79 ~]# ~~~ |