alibaba / alibaba/xoc

Fixes to build

Open
#9 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
117
Forks
58
PR merge metrics
No merged PRs in 30d

Description

I just cloned this project (actually https://github.com/stevenknown/xoc but it has not enabled issues there) and tried to build but got some warnings and an error related to try use of HeapSort::HeapValVector<T> hdata(data); with clang++ (6 and 11) and g++9.

Here is the output of git diff -u of my changes to be able to build it:

diff --git a/com/flty.cpp b/com/flty.cpp
index 0a44cbf..5f02c1b 100644
--- a/com/flty.cpp
+++ b/com/flty.cpp
@@ -129,7 +129,7 @@ void Float::dump() const
 {
     StrBuf buf(16);
     format(buf);
-    fprintf(stdout, buf.buf);
+    fprintf(stdout, "%s", buf.buf);
 }
 
 } //namespace xcom
diff --git a/com/rational.cpp b/com/rational.cpp
index 4464267..8b8911f 100644
--- a/com/rational.cpp
+++ b/com/rational.cpp
@@ -139,7 +139,7 @@ void Rational::dump() const
 {
     StrBuf buf(16);
     format(buf);
-    fprintf(stdout, buf.buf);
+    fprintf(stdout, "%s", buf.buf);
 }
 
 
diff --git a/com/sort.cpp b/com/sort.cpp
index 8c2acc7..b37a75c 100644
--- a/com/sort.cpp
+++ b/com/sort.cpp
@@ -54,7 +54,7 @@ public:
     DumpHeap(Vector<T> & data)
     {
         if (data.get_last_idx() < 0) { return; }
-        HeapSort::HeapValVector<T> hdata(data);
+        HeapSort<int>::HeapValVector<T> hdata(data);
         m_pool = smpoolCreate(64, MEM_COMM);
         UINT node_count = 1;
         for (UINT i = hdata.get_begin_idx(); i <= hdata.get_end_idx(); i++) {
diff --git a/com/sort.h b/com/sort.h
index a2ea8cd..3659dda 100644
--- a/com/sort.h
+++ b/com/sort.h
@@ -120,7 +120,7 @@ void Bucket<T>::dump()
     INT j = 0;
     printf("\nBUCKET");
     for (UINT i = 0; i < Hash<T>::m_bucket_size; i++) {
-        printf("\n\tB%d:", i);
+        printf("\n\tB%ud:", i);
         HC<T> * elemhc = (HC<T>*)HB_member(Hash<T>::m_bucket[i]);
         while (elemhc != nullptr) {
             printf("%f,", HC_val(elemhc));
diff --git a/dex/dex_const_info.h b/dex/dex_const_info.h
index d006707..91351f1 100644
--- a/dex/dex_const_info.h
+++ b/dex/dex_const_info.h
@@ -110,7 +110,13 @@ author: Su Zhenyu
 #define HAS_PREDICATE_REGISTER false
 
 //Define the max/min integer value range of target machine.
+#ifdef MIN_HOST_INT_VALUE
+#undef MIN_HOST_INT_VALUE
+#endif
 #define MIN_HOST_INT_VALUE 0x80000000
+#ifdef MAX_HOST_INT_VALUE
+#undef MAX_HOST_INT_VALUE
+#endif
 #define MAX_HOST_INT_VALUE 0x7fffFFFF
 #define EPSILON 0.000001

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the reported changes in com/flty.cpp, com/rational.cpp, com/sort.cpp, com/sort.h, and dex/dex_const_info.h. Start by reproducing the build with clang++ or g++9 and compare the compiler diagnostics with the supplied diff. Done means the project builds successfully with the affected compilers and the reported error is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.