Skip to content

Heisenbugs and test case failures #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
KlausKoder opened this issue Nov 27, 2024 · 14 comments
Closed

Heisenbugs and test case failures #75

KlausKoder opened this issue Nov 27, 2024 · 14 comments

Comments

@KlausKoder
Copy link

I had some heisenbug issues and all tests cases failed for different reasons. I suspected that the local llvm build was to blame.

So I fixed the problems that prevented systemc-compiler to build on the distribution llvm/clang (version 18). (For example 30e8251).

System

-- Found LLVM 18.1.8
-- The CXX compiler identification is GNU 14.2.1
-- SystemCLanguage_VERSION = 3.0.0
-- CMAKE_SYSTEM = Linux-6.10.12-200.fc40.x86_64
-- CMAKE_SYSTEM_PROCESSOR = x86_64

Tests

Now most of the test pass, only 7 SYN fatal errors remain (+ 7 DIFF errors)

$ cd designs/examples
$ ctest
[...]
72% tests passed, 14 tests failed out of 50

Total Test time (real) =  6.00 sec

The following tests FAILED:
	 25 - sct_fifo_shared_SYN (Failed)
	 28 - sct_fifo_single_SYN (Failed)
	 31 - sct_target_fifo_SYN (Failed)
	 40 - sct_signal_SYN (Failed)
	 43 - sct_in_out_ports_SYN (Failed)
	 46 - sct_always_ready_meth_SYN (Failed)
	 49 - sct_always_ready_thread_SYN (Failed)

... all these errors are Unsupported operator operator<< and follow this pattern:

<SCC>/designs/examples/sct_fifo/fifo_single.h:131:9: fatal error: ScTool internal fatal error : Unsupported operator operator<<
  131 |         cout << sc_time_stamp() << " " << sc_delta_count() << " : #1 all get done " << endl << endl;
      |         ^

There are two very similar cout << lines in the same block, but only the second fail.

223:    cout << sc_time_stamp() << " " << sc_delta_count() << " : #1, all put done " << endl;

        T data; 
        for (int i = 0; i < N; ++i) {
            while (!resp_req) wait();
            assert (resp_data.read() == 32+i);
            wait();
        }
131:    cout << sc_time_stamp() << " " << sc_delta_count() << " : #1 all get done " << endl << ""<< endl;
        wait();

mind boggling! Here is another failing line from another file, that look just like the one that passed in line 223:

<SCC>/designs/examples/sct_fifo/target_fifo.h:147:13: fatal error: ScTool internal fatal error : Unsupported operator operator<<
 147 |             cout << sc_time_stamp() << " " << sc_delta_count() << " : put " << (42+i) << endl;
     |             ^

In -DCMAKE_BUILD_TYPE=Release builds:

Compiling systemc-compiler pass cleanly except for two unhealthy looking stringop-overread warnings.

Reading between 9 and ... bytes from a region of size 8

ScElabModuleBuilder.cpp:1195

In file included from /usr/include/c++/14/bits/hashtable_policy.h:36,
                 from /usr/include/c++/14/bits/hashtable.h:35,
                 from /usr/include/c++/14/bits/unordered_map.h:33,
                 from /usr/include/c++/14/unordered_map:41,
                 from <SCC>/sc_tool/lib/sc_tool/elab/ScElabModuleBuilder.h:15,
                 from <SCC>/sc_tool/lib/sc_tool/elab/ScElabModuleBuilder.cpp:12:
In static member function ‘static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = sc_elab::VerilogVar*; _Up = sc_elab::VerilogVar*; bool _IsMove = true]’,
    inlined from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = true; _II = sc_elab::VerilogVar**; _OI = sc_elab::VerilogVar**]’ at /usr/include/c++/14/bits/stl_algobase.h:521:30,
    inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = true; _II = sc_elab::VerilogVar**; _OI = sc_elab::VerilogVar**]’ at /usr/include/c++/14/bits/stl_algobase.h:548:42,
    inlined from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = true; _II = sc_elab::VerilogVar**; _OI = sc_elab::VerilogVar**]’ at /usr/include/c++/14/bits/stl_algobase.h:555:31,
    inlined from ‘_OI std::move(_II, _II, _OI) [with _II = sc_elab::VerilogVar**; _OI = sc_elab::VerilogVar**]’ at /usr/include/c++/14/bits/stl_algobase.h:683:38,
    inlined from ‘llvm::SmallVectorImpl<T>& llvm::SmallVectorImpl<T>::operator=(llvm::SmallVectorImpl<T>&&) [with T = sc_elab::VerilogVar*]’ at /usr/include/llvm/ADT/SmallVector.h:1083:25,
    inlined from ‘llvm::SmallVector<T, N>& llvm::SmallVector<T, N>::operator=(llvm::SmallVector<T, N>&&) [with T = sc_elab::VerilogVar*; unsigned int N = 1]’ at /usr/include/llvm/ADT/SmallVector.h:1271:36,
    inlined from ‘void {anonymous}::ScElabModuleBuilder::bindPortUpAux(sc_elab::PortView, const sc_elab::VerilogVarsVec&, bool)’ at <SCC>/sc_tool/lib/sc_tool/elab/ScElabModuleBuilder.cpp:1195:65,
    inlined from ‘void {anonymous}::ScElabModuleBuilder::bindAux(sc_elab::PortView, const sc_elab::VerilogVarsVec&, BindDirection, bool)’ at <SCC>/sc_tool/lib/sc_tool/elab/ScElabModuleBuilder.cpp:1122:26:
/usr/include/c++/14/bits/stl_algobase.h:452:30: warning: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ reading between 9 and 34359738360 bytes from a region of size 8 [-Wstringop-overread]
  452 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<SCC>/sc_tool/lib/sc_tool/elab/ScElabModuleBuilder.cpp: In member function ‘void {anonymous}::ScElabModuleBuilder::bindAux(sc_elab::PortView, const sc_elab::VerilogVarsVec&, BindDirection, bool)’:
<SCC>/sc_tool/lib/sc_tool/elab/ScElabModuleBuilder.cpp:1195:51: note: at offset 16 into source object ‘<anonymous>’ of size 24
 1195 |             hostVars = hostVerMod->getVerVariables(bindedObj.obj);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
Another reading between 9 and ... bytes from a region of size 8

ScThreadBuilder.cpp:1589

In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/llvm/ADT/Hashing.h:51,
                 from /usr/include/llvm/ADT/ArrayRef.h:12,
                 from /usr/include/llvm/ADT/APFloat.h:19,
                 from /usr/include/clang/AST/APNumericStorage.h:12,
                 from /usr/include/clang/AST/Decl.h:16,
                 from <SCC>/sc_tool/lib/sc_tool/utils/ScTypeTraits.h:16,
                 from <SCC>/sc_tool/lib/sc_tool/cthread/ScThreadBuilder.h:16,
                 from <SCC>/sc_tool/lib/sc_tool/cthread/ScThreadBuilder.cpp:13:
In static member function ‘static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = sc_elab::VerilogVar*; _Up = sc_elab::VerilogVar*; bool _IsMove = true]’,
    inlined from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = true; _II = sc_elab::VerilogVar**; _OI = sc_elab::VerilogVar**]’ at /usr/include/c++/14/bits/stl_algobase.h:521:30,
    inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = true; _II = sc_elab::VerilogVar**; _OI = sc_elab::VerilogVar**]’ at /usr/include/c++/14/bits/stl_algobase.h:548:42,
    inlined from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = true; _II = sc_elab::VerilogVar**; _OI = sc_elab::VerilogVar**]’ at /usr/include/c++/14/bits/stl_algobase.h:555:31,
    inlined from ‘_OI std::move(_II, _II, _OI) [with _II = sc_elab::VerilogVar**; _OI = sc_elab::VerilogVar**]’ at /usr/include/c++/14/bits/stl_algobase.h:683:38,
    inlined from ‘llvm::SmallVectorImpl<T>& llvm::SmallVectorImpl<T>::operator=(llvm::SmallVectorImpl<T>&&) [with T = sc_elab::VerilogVar*]’ at /usr/include/llvm/ADT/SmallVector.h:1083:25,
    inlined from ‘llvm::SmallVector<T, N>& llvm::SmallVector<T, N>::operator=(llvm::SmallVector<T, N>&&) [with T = sc_elab::VerilogVar*; unsigned int N = 1]’ at /usr/include/llvm/ADT/SmallVector.h:1271:36,
    inlined from ‘void sc::ThreadBuilder::generateThreadLocalVariables()’ at <SCC>/sc_tool/lib/sc_tool/cthread/ScThreadBuilder.cpp:1589:59:
/usr/include/c++/14/bits/stl_algobase.h:452:30: warning: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ reading between 9 and 34359738360 bytes from a region of size 8 [-Wstringop-overread]
  452 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<SCC>/sc_tool/lib/sc_tool/cthread/ScThreadBuilder.cpp: In member function ‘void sc::ThreadBuilder::generateThreadLocalVariables()’:
<SCC>/sc_tool/lib/sc_tool/cthread/ScThreadBuilder.cpp:1589:50: note: at offset 16 into source object ‘<anonymous>’ of size 24
 1589 |                 verVars = verMod->getVerVariables(*elabObj);
      |                           ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~

In -DCMAKE_BUILD_TYPE=Debug builds:

operator delete called on pointer returned from a mismatched allocation function

sysc/kernel/sc_simcontext.cpp

In file included from <SCC>/systemc/src/sysc/kernel/sc_simcontext_int.h:37,
                 from <SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp:32:
<SCC>/systemc/src/sysc/kernel/sc_runnable_int.h: In member function ‘void sc_core::sc_runnable::init()’:
<SCC>/systemc/src/sysc/kernel/sc_runnable_int.h:147:74: warning: ‘void operator delete(void*, std::size_t)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  147 |                                                     sc_entry_func(), 0, 0);
      |                                                                          ^
<SCC>/systemc/src/sysc/kernel/sc_runnable_int.h:147:74: note: returned from ‘static void* sc_core::sc_object::operator new(std::size_t)’
<SCC>/systemc/src/sysc/kernel/sc_runnable_int.h:158:74: warning: ‘void operator delete(void*, std::size_t)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  158 |                                                     sc_entry_func(), 0, 0);
      |                                                                          ^
<SCC>/systemc/src/sysc/kernel/sc_runnable_int.h:158:74: note: returned from ‘static void* sc_core::sc_object::operator new(std::size_t)’
<SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp: In member function ‘void sc_core::sc_simcontext::sc_tool_elaboration()’:
<SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp:665:68: warning: ‘void operator delete(void*, std::size_t)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  665 |         new sc_invoke_method("$$$$kernel_module$$$$_invoke_method" );
      |                                                                    ^
<SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp:665:68: note: returned from ‘static void* sc_core::sc_object::operator new(std::size_t)’
<SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp: In member function ‘void sc_core::sc_simcontext::elaborate()’:
<SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp:682:66: warning: ‘void operator delete(void*, std::size_t)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  682 |       new sc_invoke_method("$$$$kernel_module$$$$_invoke_method" );
      |                                                                  ^
<SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp:682:66: note: returned from ‘static void* sc_core::sc_object::operator new(std::size_t)’
<SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp: In member function ‘sc_core::sc_process_handle sc_core::sc_simcontext::create_cthread_process(const char*, bool, sc_core::sc_entry_func, sc_core::sc_process_host*, const sc_core::sc_spawn_options*)’:
<SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp:1193:74: warning: ‘void operator delete(void*, std::size_t)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
 1193 |         new sc_cthread_process(name_p, free_host, method_p, host_p, opt_p);
      |                                                                          ^
<SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp:1193:74: note: returned from ‘static void* sc_core::sc_object::operator new(std::size_t)’
 1193 |         new sc_cthread_process(name_p, free_host, method_p, host_p, opt_p);
      |                                                                          ^
<SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp: In member function ‘sc_core::sc_process_handle sc_core::sc_simcontext::create_method_process(const char*, bool, sc_core::sc_entry_func, sc_core::sc_process_host*, const sc_core::sc_spawn_options*)’:
<SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp:1210:73: warning: ‘void operator delete(void*, std::size_t)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
 1210 |         new sc_method_process(name_p, free_host, method_p, host_p, opt_p);
      |                                                                         ^
<SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp:1210:73: note: returned from ‘static void* sc_core::sc_object::operator new(std::size_t)’
 1210 |         new sc_method_process(name_p, free_host, method_p, host_p, opt_p);
      |                                                                         ^
<SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp: In member function ‘sc_core::sc_process_handle sc_core::sc_simcontext::create_thread_process(const char*, bool, sc_core::sc_entry_func, sc_core::sc_process_host*, const sc_core::sc_spawn_options*)’:
<SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp:1244:73: warning: ‘void operator delete(void*, std::size_t)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
 1244 |         new sc_thread_process(name_p, free_host, method_p, host_p, opt_p);
      |                                                                         ^
<SCC>/systemc/src/sysc/kernel/sc_simcontext.cpp:1244:73: note: returned from ‘static void* sc_core::sc_object::operator new(std::size_t)’
 1244 |         new sc_thread_process(name_p, free_host, method_p, host_p, opt_p);
      |                                                                         ^

@mikhailmoiseev
Copy link
Contributor

Thank you for installation ICSC with LLVM 18. Will follow your way to check and update the main ICSC repository correspondently.
The issue with cout looks pretty simple to fix, but it needs to have the LLVM 18 environment.
Hope to update and fix it soon.

-MIkhail.

@mikhailmoiseev
Copy link
Contributor

That generally works and tests passed, will commit ICSC with LLVM18 near days.

@mikhailmoiseev
Copy link
Contributor

Feel free to reopen, if you see any problems.

@KlausKoder
Copy link
Author

A small mistake in cmake/svc_target.cmake. CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES doesn't come
from the environment:

   target_include_directories(${exe_target} PUBLIC
            $ENV{ICSC_HOME}/include
            $ENV{ICSC_HOME}/include/sctcommon
            $ENV{ICSC_HOME}/include/sctmemory
            $ENV{ICSC_HOME}/include/sctmemory/utils
<<<<<<< HEAD
            $ENV{CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}
=======
            ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}
>>>>>>> 6907049 (Horrible hack to make x_sctool.cpp find stddef.h)
    )

@KlausKoder
Copy link
Author

I wonder what causes the tests to fail with an Error: Option 'debug-counter' registered more than once! for example:

The following tests FAILED:
	  2 - imm_assert_SYN (Subprocess aborted)
Errors while running CTest

Design unity file: {}/designs/examples/asserts/imm_assert.sctool.cpp

: CommandLine Error: Option 'debug-counter' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options

I can remove the error by removing extra(?) libs in sc_tool/CMakeList.txt as f27df4a

The project is configured using:

cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$ICSC_HOME -DBUILD_SHARED_LIBS=ON

@mikhailmoiseev mikhailmoiseev reopened this Dec 3, 2024
@mikhailmoiseev
Copy link
Contributor

  1. cmake/svc_target.cmake fixed.
  2. In LLVM installation with install.sh there is no LLVM library created. Do you see any issue in the LLVM installation steps?

@KlausKoder
Copy link
Author

Do you see any issue in the LLVM installation steps?

I suspect my issue is related to shared/dynlibs/static libs, I use standard packages:

dnf install cmake clang-devel llvm-devel llvm-googletest protobuf-devel

This is the cmake flags used to build my distributions llvm:


%global cmake_common_args \\\
  | -DLLVM_TARGETS_TO_BUILD=%{targets_to_build} \\\
  | -DLLVM_ENABLE_RTTI=ON \\\
  | -DLLVM_ENABLE_FFI:BOOL=ON \\\
  | -DLLVM_ENABLE_LIBCXX:BOOL=OFF \\\
[...]
  | -DBUILD_SHARED_LIBS=OFF \\\              | < 
  | -DLLVM_BUILD_LLVM_DYLIB=ON \\\           | < Maybe this block?
  | -DLLVM_DYLIB_COMPONENTS="all" \\\        | <
  | -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \\\       | <
[...]
  | -DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF \\\
  | -DLLVM_INSTALL_UTILS:BOOL=ON \\\

The cmake variables BUILD_SHARED_LIBS=... and CMAKE_CXX_STANDARD=..., seemingly, have
no effect. As far as I can see, they are hard-coded in the top-level CMakeList:

{}/systemc-compiler/CMakeLists.txt:   
  set(CMAKE_CXX_STANDARD 17)
  set(BUILD_SHARED_LIBS ON)
  -D__SC_TOOL__ -D__SC_TOOL_ANALYZE__ -DNDEBUG -std=c++17

So maybe it is cleaner not to mention them?

diff --git a/install.sh b/install.sh
index 26d9ede..c507fdc 100755
--- a/install.sh
+++ b/install.sh
@@ -80,8 +80,7 @@ fi
 cd $ICSC_HOME/icsc
 (
     mkdir build_icsc_rel -p && cd build_icsc_rel
-    cmake ../ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$ICSC_HOME \
-              -DCMAKE_CXX_STANDARD=17
+    cmake ../ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$ICSC_HOME
     make -j12
     make install
     
@@ -89,7 +88,7 @@ cd $ICSC_HOME/icsc
     
     mkdir build_icsc_dbg -p && cd build_icsc_dbg
     cmake ../ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$ICSC_HOME \
-              -DCMAKE_CXX_STANDARD=17 -DCMAKE_DEBUG_POSTFIX=d
+              -DCMAKE_DEBUG_POSTFIX=d
     make -j12
     make install

@KlausKoder
Copy link
Author

Regarding the compiler version. -std=c++20 pass with this fix:

diff --git a/sc_tool/lib/sc_tool/elab/ScVerilogModule.h b/sc_tool/lib/sc_tool/elab/ScVerilogModule.h
index aea9193..973cd03 100644
--- a/sc_tool/lib/sc_tool/elab/ScVerilogModule.h
+++ b/sc_tool/lib/sc_tool/elab/ScVerilogModule.h
@@ -400,7 +400,7 @@ public:
     VerilogModule& operator=(const VerilogModule&) = delete;
     VerilogModule& operator=(VerilogModule&&) = delete;
 
-    bool operator == (VerilogModule &other) const { return getName() == other.getName(); }
+    bool operator == (const VerilogModule &other) const { return getName() == other.getName(); }
 
     /// Remove assignments for unused variables (@assignments) and 
     /// update required variables (@requiredVars)

@mikhailmoiseev
Copy link
Contributor

-DLLVM_BUILD_LLVM_DYLIB=ON adds libLLVM.so , that allows to remove extra libraries from sc_tool/CMakeLists.txt.
But even w/o extra libraries I see similar issue:
CommandLine Error: Option 'disable-auto-upgrade-debug-info' registered more than once!

@mikhailmoiseev
Copy link
Contributor

Does -DCMAKE_CXX_STANDARD=17 lead to any problem at your side?
Probably it makes sense to remove it, but needs to be checked at multiple environments. So, I would do such change, if it strongly required only.

@KlausKoder
Copy link
Author

-DLLVM_BUILD_LLVM_DYLIB=ON adds libLLVM.so , that allows to remove extra libraries from sc_tool/CMakeLists.txt. But even w/o extra libraries I see similar issue: CommandLine Error: Option 'disable-auto-upgrade-debug-info' registered more than once!

I don't see that issue. There are two places to patch in sc_tool/CMakeList.txt:

diff --git a/sc_tool/CMakeLists.txt b/sc_tool/CMakeLists.txt
index ba1b948..ecdd6c7 100644
--- a/sc_tool/CMakeLists.txt
+++ b/sc_tool/CMakeLists.txt
@@ -30,8 +30,6 @@ target_link_libraries(SysCRTTI
         PUBLIC
         SVC::systemc
         PRIVATE
-        LLVMCore
-        LLVMSupport
         )
 
 target_include_directories(SysCRTTI PUBLIC

and

 target_link_libraries(SCTool
         PUBLIC
         sc_elab_proto
         SysCRTTI
         PRIVATE
-        LLVMX86AsmParser
-        LLVMX86Desc
-        LLVMX86Info
-        LLVMipo
-        LLVMScalarOpts
-        LLVMInstCombine
-        LLVMTransformUtils
-        LLVMAnalysis
-        LLVMTarget
-        LLVMOption
-        LLVMMCParser
-        LLVMMC
-        LLVMObject
-        LLVMBitReader
-        LLVMCore
-        LLVMSupport
-        LLVMFrontendOpenMP
-        LLVMWindowsDriver
         clang-cpp
+        LLVM
         ${system_libs}
         )
 

@KlausKoder
Copy link
Author

My desktop got updated and I got a new version of LLVM:

-- Found LLVM 19.1.5
-- The CXX compiler identification is GNU 14.2.1
[...]

Version 19.1.5 of llvm delete the method StringReg.equals() in <>/llvm/ADT/StringRef.h, afaics, without deprecation warning, causing ScObjectView.cpp to fail compilation.

-    /// equals - Check for string equality, this is more efficient than
-    /// compare() when the relative ordering of inequal strings isn't needed.
-    [[nodiscard]] bool equals(StringRef RHS) const {
-      return (Length == RHS.Length &&
-              co
mpareMemory(Data, RHS.Data, RHS.Length) == 0);
-    }
-

Changing m.equals(n) to m.compare(n) == 0 fix the error:

ScObjectView.cpp +980

-        if (fieldDecl->getName().equals(*fieldView.getFieldName()))
             return fieldView;
+        if (fieldDecl->getName().compare(*fieldView.getFieldName()) == 0)
             return fieldView;

See 9cd51f8

The tests passes. But the usual scary looking warnings (from gcc 14) persist, same as in original message #75 (comment).

@mikhailmoiseev
Copy link
Contributor

I don't see that issue. There are two places to patch in sc_tool/CMakeList.txt:

Will try to cope with this issue, but have no ideas for now.

Version 19.1.5 of llvm delete the method StringReg.equals() in <>/llvm/ADT/StringRef.h, afaics, without deprecation warning, causing ScObjectView.cpp to fail compilation.

That is fixed. But I did not check it with LLVM 19.

@mikhailmoiseev
Copy link
Contributor

Nothing more to do here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants