chromium / subspace

A concept-centered standard library for C++20, enabling safer and more reliable products and a more modern feel for C++ code.; Also home of Subdoc the code-documentation generator.
https://suslib.cc
Apache License 2.0
89 stars 15 forks source link

Use seto to look for overflow #405

Open danakj opened 11 months ago

danakj commented 11 months ago

From https://research.checkpoint.com/2023/rust-binary-analysis-feature-by-feature/ we see rust generates seto for integer math, meaning it uses the overflow register rather than checking values being added.

From https://stackoverflow.com/questions/48020613/gcc-inline-asm-x86-cpu-flags-as-input-dependency we see there is __builtin_add_overflow which should generate seto usage.

There’s also some inline asm there but that breaks other optimizations in c++.