-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
Description
I'm seeing a large spew of:
In constructor ‘__llvm_libc_20_0_0_git::testing::FormatSectionMatcher::FormatSectionMatcher(__llvm_libc_20_0_0_git::printf_core::FormatSection)’,
inlined from ‘virtual void LlvmLibcPrintfParserTest_DoublePercentIsAllowedInvalidIndex::Run()’ at /android0/llvm-project/libc/test/src/stdio/printf_core/parser_test.cpp:626:3:
/android0/llvm-project/libc/test/UnitTest/PrintfMatcher.h:25:9: error: ‘expected0.__llvm_libc_20_0_0_git::printf_core::FormatSection::conv_val_ptr’ is used uninitialized [-Werror=uninitialized]
25 | : expected(expectedValue) {}
| ^~~~~~~~~~~~~~~~~~~~~~~
/android0/llvm-project/libc/test/src/stdio/printf_core/parser_test.cpp: In member function ‘virtual void LlvmLibcPrintfParserTest_DoublePercentIsAllowedInvalidIndex::Run()’:
/android0/llvm-project/libc/test/src/stdio/printf_core/parser_test.cpp:621:46: note: ‘expected0.__llvm_libc_20_0_0_git::printf_core::FormatSection::conv_val_ptr’ was declared here
621 | LIBC_NAMESPACE::printf_core::FormatSection expected0;
| ^~~~~~~~~
when building the unit tests with gcc-14.
Perhaps EXPECT_PFORMAT_EQ is a macro that constructs a FormatSectionMatcher, which copy constructs the FormatSection expected (highlighted in the diagnostic), but the default implicit copy constructor of FormatSectionMatcher is copying over every field, where fields such as FormatSection::conv_val_ptr and FormatSection::conv_val_raw have not been initialized!
I wonder if we should either:
- have the unit tests that default construct
FormatSection's initializeconv_val_ptrandconv_val_raw - explicitly delete the implicit default constructor for
FormatSectionand update the tests - other?
Observed while trying to test #124036.