From 1b3b0c38c48a0a0bed29496fe8878a4c0fe0c922 Mon Sep 17 00:00:00 2001 From: Joao Paulo Magalhaes Date: Sat, 18 Jan 2025 11:00:37 +0000 Subject: [PATCH] Revert "workarounds for gcc optimizer misbuilds" [ci skip] This reverts commit 51491b335f70937b92d3640ba08b93565fa58333. --- ext/c4core | 2 +- src/c4/yml/parse_engine.def.hpp | 14 -------------- src/c4/yml/parser_state.hpp | 3 --- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/ext/c4core b/ext/c4core index 4b7c1a14..c4d060fd 160000 --- a/ext/c4core +++ b/ext/c4core @@ -1 +1 @@ -Subproject commit 4b7c1a1401f642910c544243a2d8f6e0d879c3b8 +Subproject commit c4d060fd4b12ac3ab952e92182364afb6f4157c5 diff --git a/src/c4/yml/parse_engine.def.hpp b/src/c4/yml/parse_engine.def.hpp index 0e378b01..d72c8595 100644 --- a/src/c4/yml/parse_engine.def.hpp +++ b/src/c4/yml/parse_engine.def.hpp @@ -102,14 +102,6 @@ inline bool _is_doc_token(csubstr s) noexcept // The current version does not suffer this problem, but it may // appear again. // - // - // UPDATE. The problem appeared again in gcc12 and gcc13 with -Os - // (but not any other optimization level, nor any other compiler - // or version), because the assignment to s is being hoisted out - // of the loop which calls this function. Then the length doesn't - // enter the s.len >= 3 when it should. Adding a - // C4_DONT_OPTIMIZE(var) makes the problem go away. - // if(s.len >= 3) { switch(s.str[0]) @@ -1947,9 +1939,6 @@ typename ParseEngine::ScannedScalar ParseEngine::_sc while( ! _finished_file()) { const csubstr line = m_evt_handler->m_curr->line_contents.rem; - #if defined(__GNUC__) && __GNUC__ == 11 - C4_DONT_OPTIMIZE(line); // prevent erroneous hoist of the assignment out of the loop - #endif bool line_is_blank = true; _c4dbgpf("scanning double quoted scalar @ line[{}]: line='{}'", m_evt_handler->m_curr->pos.line, line); for(size_t i = 0; i < line.len; ++i) @@ -2099,9 +2088,6 @@ void ParseEngine::_scan_block(ScannedBlock *C4_RESTRICT sb, size_t { // peek next line, but do not advance immediately lc.reset_with_next_line(m_buf, m_evt_handler->m_curr->pos.offset); - #if defined(__GNUC__) && (__GNUC__ == 12 || __GNUC__ == 13) - C4_DONT_OPTIMIZE(lc.rem); - #endif _c4dbgpf("blck: peeking at [{}]~~~{}~~~", lc.stripped.len, lc.stripped); // evaluate termination conditions if(indentation != npos) diff --git a/src/c4/yml/parser_state.hpp b/src/c4/yml/parser_state.hpp index beabb894..70cb63e3 100644 --- a/src/c4/yml/parser_state.hpp +++ b/src/c4/yml/parser_state.hpp @@ -66,9 +66,6 @@ struct LineContents ++e; RYML_ASSERT(e >= offset); const substr stripped_ = buf.range(offset, e); - #if defined(__GNUC__) && __GNUC__ == 11 - C4_DONT_OPTIMIZE(stripped_); - #endif // advance pos to include the first line ending if(e < buf.len && buf.str[e] == '\r') ++e;