Skip to content
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

error "__builtin_uaddll_overflow’在此作用域中尚未声明" #74

Open
giobyhu opened this issue Jun 12, 2023 · 7 comments
Open

error "__builtin_uaddll_overflow’在此作用域中尚未声明" #74

giobyhu opened this issue Jun 12, 2023 · 7 comments

Comments

@giobyhu
Copy link

giobyhu commented Jun 12, 2023

__builtin_uaddll_overflow’在此作用域中尚未声明

@giobyhu
Copy link
Author

giobyhu commented Jun 12, 2023

sonic/include/sonic/internal/arch/avx2/simd.h:50:49: 错误:不能在初始化时将‘__m128i {aka __vector(2) long long int}’转换为‘long long int’
sonic_force_inline base128() : value{__m128i()} {}

__builtin_uaddll_overflow’在此作用域中尚未声明

-mavx2 -mpclmul -mbmi都加了

@giobyhu
Copy link
Author

giobyhu commented Jun 12, 2023

sonic_force_inline base128() : value{__m128i()} {} 改为 sonic_force_inline base128() : value(_mm_setzero_si128()) {}
sonic_force_inline base256() : value{__m256i()} {} 改为 sonic_force_inline base256() : value(_mm256_setzero_si256()) {}
sonic_force_inline bool AddOverflow(uint64_t value1, uint64_t value2,
uint64_t* result) {
return __builtin_uaddll_overflow(
value1, value2, reinterpret_cast<unsigned long long*>(result));
}
改为
sonic_force_inline bool AddOverflow(uint64_t value1, uint64_t value2,
uint64_t* result) {
if (value1 > std::numeric_limits<uint64_t>::max() - value2) {
// Overflow would occur
return true;
}
result = value1 + value2;
return false;
//return __builtin_uaddll_overflow(
//value1, value2, reinterpret_cast<unsigned long long
>(result));
}
临时解决编译不通过的问题

@liuq19
Copy link
Collaborator

liuq19 commented Jun 13, 2023

感谢反馈,看起来是环境中该编译器不支持 __builtin_uaddll_overflow 扩展

@giobyhu
Copy link
Author

giobyhu commented Jun 13, 2023

@liuq19 还有一个问题,不知道有没有人反馈过。首页-usage-Getting and Setting-print_member 写的是sonic_json::Node& key = m->name; 编译出错
example里写的是const sonic_json::Node& key = m->name;

@liuq19
Copy link
Collaborator

liuq19 commented Jun 16, 2023

正确应该是 const sonic_json::Node& key = m->name, 目的是防止用户将 object 暴露的 key set 成非string的类型,后续我们会更新readme,感谢~

@liuq19 还有一个问题,不知道有没有人反馈过。首页-usage-Getting and Setting-print_member 写的是sonic_json::Node& key = m->name; 编译出错 example里写的是const sonic_json::Node& key = m->name;

@xiegx94
Copy link
Collaborator

xiegx94 commented Jul 3, 2023

@liuq19 还有一个问题,不知道有没有人反馈过。首页-usage-Getting and Setting-print_member 写的是sonic_json::Node& key = m->name; 编译出错 example里写的是const sonic_json::Node& key = m->name;

fixed #79

@qshanz373
Copy link
Collaborator

感谢反馈,看起来是环境中该编译器不支持 __builtin_uaddll_overflow 扩展

编译器有个内置的函数来 check builtin 是否支持,我们可以加上这个 check,这样可以更友好的提前暴露这个问题?

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

4 participants