Skip to content

Commit ef7498d

Browse files
authored
[src] Fix warnings when compiling for i686-linux-gnu (JuliaLang#45753)
Addressed warnings: ``` /cache/build/default-amdci5-0/julialang/julia-master/src/jitlayers.cpp:499:23: warning: conversion from 'long long unsigned int' to 'size_t' {aka 'unsigned int'} changes value from '18446744073709551615' to '4294967295' [-Woverflow] 499 | size_t optlevel = ~0ull; | ^~~~~ [...] /cache/build/default-amdci5-0/julialang/julia-master/src/jitlayers.cpp:937:71: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Wformat=] 937 | jl_printf(stream, " basicblocks: %lu\n", countBasicBlocks(F)); | ~~^ ~~~~~~~~~~~~~~~~~~~ | | | | long unsigned int int | %u /cache/build/default-amdci5-0/julialang/julia-master/src/jitlayers.cpp:965:71: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Wformat=] 965 | jl_printf(stream, " basicblocks: %lu\n", countBasicBlocks(F)); | ~~^ ~~~~~~~~~~~~~~~~~~~ | | | | long unsigned int int | %u [...] /cache/build/default-amdci5-0/julialang/julia-master/src/codegen.cpp:2934:28: warning: comparison of integer expressions of different signedness: 'ssize_t' {aka 'int'} and 'const uint32_t' {aka 'const unsigned int'} [-Wsign-compare] 2934 | if (i > 0 && i <= jl_datatype_nfields(uty)) ```
1 parent aa17702 commit ef7498d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/codegen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2943,7 +2943,7 @@ static bool emit_f_opfield(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f,
29432943
}
29442944
else if (fld.constant && fld.typ == (jl_value_t*)jl_long_type) {
29452945
ssize_t i = jl_unbox_long(fld.constant);
2946-
if (i > 0 && i <= jl_datatype_nfields(uty))
2946+
if (i > 0 && i <= (ssize_t)jl_datatype_nfields(uty))
29472947
idx = i - 1;
29482948
}
29492949
if (idx != -1) {

src/jitlayers.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "llvm-version.h"
44
#include "platform.h"
5+
#include <stdint.h>
56

67
#include "llvm/IR/Mangler.h"
78
#include <llvm/ADT/StringMap.h>
@@ -496,7 +497,7 @@ static auto countBasicBlocks(const Function &F)
496497
}
497498

498499
void JuliaOJIT::OptSelLayerT::emit(std::unique_ptr<orc::MaterializationResponsibility> R, orc::ThreadSafeModule TSM) {
499-
size_t optlevel = ~0ull;
500+
size_t optlevel = SIZE_MAX;
500501
TSM.withModuleDo([&](Module &M) {
501502
if (jl_generating_output()) {
502503
optlevel = 0;
@@ -518,7 +519,7 @@ void JuliaOJIT::OptSelLayerT::emit(std::unique_ptr<orc::MaterializationResponsib
518519
optlevel = std::min(std::max(optlevel, optlevel_min), this->count);
519520
}
520521
});
521-
assert(optlevel != ~0ull && "Failed to select a valid optimization level!");
522+
assert(optlevel != SIZE_MAX && "Failed to select a valid optimization level!");
522523
this->optimizers[optlevel]->OptimizeLayer.emit(std::move(R), std::move(TSM));
523524
}
524525

@@ -934,7 +935,7 @@ namespace {
934935
// Each function is printed as a YAML object with several attributes
935936
jl_printf(stream, " \"%s\":\n", F.getName().str().c_str());
936937
jl_printf(stream, " instructions: %u\n", F.getInstructionCount());
937-
jl_printf(stream, " basicblocks: %lu\n", countBasicBlocks(F));
938+
jl_printf(stream, " basicblocks: %zd\n", countBasicBlocks(F));
938939
}
939940

940941
start_time = jl_hrtime();
@@ -962,7 +963,7 @@ namespace {
962963
}
963964
jl_printf(stream, " \"%s\":\n", F.getName().str().c_str());
964965
jl_printf(stream, " instructions: %u\n", F.getInstructionCount());
965-
jl_printf(stream, " basicblocks: %lu\n", countBasicBlocks(F));
966+
jl_printf(stream, " basicblocks: %zd\n", countBasicBlocks(F));
966967
}
967968
}
968969
}

0 commit comments

Comments
 (0)