Changes between Initial Version and Version 1 of Ticket #1847, comment 1


Ignore:
Timestamp:
12/18/24 13:42:31 (6 hours ago)
Author:
zerica
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1847, comment 1

    initial v1  
    66chicken.h:2759:39: runtime error: negation of -9223372036854775808 cannot be represented in type 'long'; cast to an unsigned type to negate this value to itself
    77SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior chicken.h:2759:39
    8 chicken.h:2701:6: runtime error: implicit conversion from type 'long' of value -9223372036854775808 (64-bit, signed) to type 'unsigned long' changed the value to 9223372036854775808 (64-bit, unsigned)
    9 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior chicken.h:2701:6
    10 chicken.h:2704:41: runtime error: negation of -9223372036854775808 cannot be represented in type 'long'; cast to an unsigned type to negate this value to itself
    11 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior chicken.h:2704:41
    12 chicken.h:2704:34: runtime error: implicit conversion from type 'long' of value -9223372036854775808 (64-bit, signed) to type 'unsigned long' changed the value to 9223372036854775808 (64-bit, unsigned)
    13 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior chicken.h:2704:34
    14 Testing signed FFI type "ssize_t" (64 bits):
    15 Can hold maximum value 9223372036854775807...
    16 Can hold minimum value -9223372036854775808...
    17 Testing unsigned FFI type "size_t" (64 bits):
    18 Can hold maximum value 18446744073709551615...
    19 Cannot hold one more than maximum value, 18446744073709551616...
    20 Cannot hold -1 (any fixnum negative value)
    21 tests/a.c:9281:50: runtime error: left shift of 18446744073709551615 by 1 places cannot be represented in type 'unsigned long'
    22 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:9281:50
    23 Cannot hold -2^64 (any bignum negative value < smallest int64)
    24 tests/a.c:8678:16: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    25 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:8678:16
    26 tests/a.c:376:1: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    27 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:376:1
    28 tests/a.c:8636:16: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    29 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:8636:16
    30 tests/a.c:361:1: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    31 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:361:1
    32 tests/a.c:8594:16: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    33 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:8594:16
    34 tests/a.c:346:1: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    35 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:346:1
    36 tests/a.c:8552:16: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    37 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:8552:16
    38 tests/a.c:331:1: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    39 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:331:1
    40 tests/a.c:8510:16: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    41 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:8510:16
    42 tests/a.c:316:1: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    43 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:316:1
    44 tests/a.c:8470:16: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    45 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:8470:16
    46 tests/a.c:301:1: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    47 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:301:1
    48 tests/a.c:8430:16: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    49 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:8430:16
    50 tests/a.c:286:1: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    51 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:286:1
    52 tests/a.c:8390:16: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    53 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:8390:16
    54 tests/a.c:271:1: runtime error: left shift of 18446744073709551606 by 1 places cannot be represented in type 'unsigned long'
    55 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tests/a.c:271:1
    568}}}
     9
     10so the ub seems to occur in this function
     11
     12{{{
     13inline static C_long C_num_to_long(C_word x)
     14{
     15  if(x & C_FIXNUM_BIT) {
     16    return (C_long)C_unfix(x);
     17  } else {
     18    if (C_bignum_negativep(x)) return -(C_long)C_bignum_digits(x)[0];
     19    else return (C_long)C_bignum_digits(x)[0];
     20  }
     21}
     22}}}
     23
     24where `-(C_long)x` is unsound when x is INT64_MIN