Skip to content

Commit

Permalink
Fix -Werror=type-limits. (rapidsai#15635)
Browse files Browse the repository at this point in the history
I'm compiling cuDF as a part of another application and ran into errors from `-Werror=type-limits`. There are a few comparisons between unsigned types like `value < 0`, which is never true. This PR removes those impossible code paths.

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - MithunR (https://github.com/mythrocks)
  - David Wendt (https://github.com/davidwendt)

URL: rapidsai#15635
  • Loading branch information
bdice authored May 2, 2024
1 parent 541b53a commit e3ea523
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cpp/src/io/comp/cpu_unbz2.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2023, NVIDIA CORPORATION.
* Copyright (c) 2018-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -221,7 +221,7 @@ int32_t bz2_decompress_block(unbz_state_s* s)
if (getbits(s, 1)) return BZ_DATA_ERROR; // blockRandomized not supported (old bzip versions)

s->origPtr = getbits(s, 24);
if (s->origPtr < 0 || s->origPtr > 10 + 100000 * s->blockSize100k) return BZ_DATA_ERROR;
if (s->origPtr > 10 + 100000 * s->blockSize100k) return BZ_DATA_ERROR;

// Receive the mapping table
inUse16 = getbits(s, 16);
Expand Down Expand Up @@ -436,7 +436,7 @@ int32_t bz2_decompress_block(unbz_state_s* s)
}

// Now we know what nblock is, we can do a better sanity check on s->origPtr.
if (s->origPtr < 0 || s->origPtr >= nblock) return BZ_DATA_ERROR;
if (s->origPtr >= nblock) return BZ_DATA_ERROR;

// compute the T^(-1) vector
{
Expand Down
2 changes: 0 additions & 2 deletions cpp/src/io/parquet/reader_impl_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ void metadata::sanitize_schema()
// This code attempts to make this less messy for the code that follows.

std::function<void(size_t)> process = [&](size_t schema_idx) -> void {
if (schema_idx < 0) { return; }
auto& schema_elem = schema[schema_idx];
if (schema_idx != 0 && schema_elem.type == UNDEFINED_TYPE) {
auto const parent_type = schema[schema_elem.parent_idx].converted_type;
Expand Down Expand Up @@ -723,7 +722,6 @@ aggregate_reader_metadata::select_columns(std::optional<std::vector<std::string>
int schema_idx,
std::vector<cudf::io::detail::inline_column_buffer>& out_col_array,
bool has_list_parent) {
if (schema_idx < 0) { return false; }
auto const& schema_elem = get_schema(schema_idx);

// if schema_elem is a stub then it does not exist in the column_name_info and column_buffer
Expand Down

0 comments on commit e3ea523

Please sign in to comment.