abs(offset) is not the same as addr_t(-offset) AFAICT offset is positive so we 
are casting a small negative number to an unsigned type which will result in a 
really large value e.g. https://godbolt.org/z/B2Z7Ok

> On Jun 4, 2019, at 6:49 PM, Fangrui Song via lldb-commits 
> <lldb-commits@lists.llvm.org> wrote:
> 
> Author: maskray
> Date: Tue Jun  4 18:49:06 2019
> New Revision: 362570
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=362570&view=rev
> Log:
> Fix -Wsign-compare by explicit cast after r362557
> 
> Modified:
>    
> lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
> 
> Modified: 
> lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp?rev=362570&r1=362569&r2=362570&view=diff
> ==============================================================================
> --- 
> lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp 
> (original)
> +++ 
> lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp 
> Tue Jun  4 18:49:06 2019
> @@ -819,7 +819,7 @@ bool x86AssemblyInspectionEngine::local_
>   int offset;
>   if (pc_rel_branch_or_jump_p (instruction_length, offset) && offset != 0) {
>     addr_t next_pc_value = current_func_text_offset + instruction_length;
> -    if (offset < 0 && abs (offset) > current_func_text_offset) {
> +    if (offset < 0 && addr_t(-offset) > current_func_text_offset) {
>       // Branch target is before the start of this function
>       return false;
>     }
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to