From edcec15a728f2f8e4930dc0565f56a274c3fc0c1 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 23 May 2025 15:39:40 +0200 Subject: bug: figuring out why a segfault occurs after we exit main. ubsan: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:926:60: runtime error: applying non-zero offset 18446744073709551536 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:926:60 in drv: SIGSEGV: Please report this on the GitHub issues page why? - A bogus iterator gets passed to ::destroy inside the method. next: - Debug that inside lldb. Signed-off-by: Amlal El Mahrouss --- dev/LibCompiler/Frontend.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'dev/LibCompiler/Frontend.h') diff --git a/dev/LibCompiler/Frontend.h b/dev/LibCompiler/Frontend.h index 119b9fe..9f6fe71 100644 --- a/dev/LibCompiler/Frontend.h +++ b/dev/LibCompiler/Frontend.h @@ -81,22 +81,22 @@ enum KeywordKind { /// \brief Compiler keyword information struct. struct CompilerKeyword { - std::string keyword_name; - KeywordKind keyword_kind = kKeywordKindInvalid; + std::string keyword_name{""}; + KeywordKind keyword_kind{kKeywordKindInvalid}; }; + struct SyntaxLeafList final { struct SyntaxLeaf final { Int32 fUserType; + #ifdef LC_USE_STRUCTS CompilerKeyword fUserData; #else std::string fUserData; #endif - SyntaxLeaf() = default; - - std::string fUserValue; - struct SyntaxLeaf* fNext; + std::string fUserValue{""}; + struct SyntaxLeaf* fNext{nullptr}; }; std::vector fLeafList; @@ -111,7 +111,7 @@ struct SyntaxLeafList final { /// \param haystack base string /// \param needle the string we search for. /// \return if we found it or not. -bool find_word(std::string haystack, std::string needle) noexcept; +BOOL find_word(std::string haystack, std::string needle) noexcept; /// find a word within strict conditions and returns a range of it. /// \param haystack -- cgit v1.2.3