Bug 102918 - Undefined behaviour in regex header (uininitialized boolean)
Summary: Undefined behaviour in regex header (uininitialized boolean)
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 11.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-24 21:39 UTC by camilotalero96
Modified: 2024-04-09 21:55 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-10-25 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description camilotalero96 2021-10-24 21:39:03 UTC
I am using undefined behaviour sanitizers and they are detecting a potential bug in teh regex header, the specific report is:

`/usr/include/c++/11/bits/regex.h:909:15: runtime error: load of value 192, which is not a valid value for type 'bool'`

Which does seem like the use of a potentially uninitialized boolean.
Comment 1 Jonathan Wakely 2021-10-25 08:48:18 UTC
std::sub_match only has one constructor, and it initializes the bool. The only stores to that variable are literal treu or false values, or the result of a boolean expression first != last. So there's no way I can see for the library to cause this behaviour Are you sure you're not causing undefined behaviour in your own code?

Have you tried building with -D_GLIBCXX_DEBUG to get runtime checks in std::match_results.

Without more details there's nothing we can do here. The <regex> code looks correct.
Comment 2 Andrew Pinski 2024-04-09 21:55:58 UTC
No feedback or a testcase in over 2 years so closing as invalid. If you provide a testcase we will be able to look into it but until then, closing as invalid.