https://bugs.llvm.org/show_bug.cgi?id=52421

            Bug ID: 52421
           Summary: Inconsistent UndefinedSanitizer report
           Product: clang
           Version: 13.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

Hi there,

I found that the UndefinedSanitizer would report runtime error on the follow
code:

$cat a.c
int main() {
    double x = 2147483649;
    int y = x;
}
$
$clang-13 -fsanitize=undefined a.c ; ./a.out
a.c:3:10: runtime error: 2.14748e+09 is outside the range of representable
values of type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior a.c:3:10


However, if I changed the 'double' type to 'long', the error report went away.
$cat a.c
int main() {
    long x = 2147483649;
    int y = x;
}
$
$clang-13 -fsanitize=undefined a.c ; ./a.out
$

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to