Changeset 831aa466 in mainline for uspace/lib/c/generic/ubsan.c


Ignore:
Timestamp:
2018-06-26T23:16:12Z (7 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2fc9bfd
Parents:
70fae4e
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-26 23:06:11)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-26 23:16:12)
Message:

Fix cases of undefined behavior found by ubsan.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/ubsan.c

    r70fae4e r831aa466  
    9898#endif
    9999void __ubsan_handle_nonnull_return(struct nonnull_return_data *data);
     100void __ubsan_handle_builtin_unreachable(struct unreachable_data *data);
    100101
    101102static void print_loc(const char *func, struct source_location *loc)
     
    107108                f += sizeof(func_prefix);
    108109
    109         PRINTF("Undefined behavior %s at %s:%" PRIu32 " col %" PRIu32 "\n",
     110        PRINTF("####### Undefined behavior %s at %s:%" PRIu32 " col %" PRIu32 "\n",
    110111            f, loc->file_name, loc->line, loc->column);
    111112}
     
    115116{
    116117        print_loc(__func__, &data->loc);
     118        PRINTF("Type: %s, alignment: %lu, type_check_kind: %hhu\n",
     119            data->type->type_name, data->alignment, data->type_check_kind);
    117120        ubsan_panic();
    118121}
     
    219222        ubsan_panic();
    220223}
     224
     225void __ubsan_handle_builtin_unreachable(struct unreachable_data *data)
     226{
     227        print_loc(__func__, &data->loc);
     228        ubsan_panic();
     229}
     230
Note: See TracChangeset for help on using the changeset viewer.