Skip to content

Warning in lld/COFF/Writer.cpp while building llvm #130934

Open
@anutosh491

Description

@anutosh491

I am building llvm (clang/lld) against emscripten for a wasm usecase and i see this warning. (Not sure the same shows up while building for other platforms)

Not harmful and can still get my use case working but I thought of reporting it.

│ │ $SRC_DIR/lld/COFF/Writer.cpp:1740:27: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'long' [-Wsign-compare]
 │ │  1740 |   assert(coffHeaderOffset == buf - buffer->getBufferStart());
 │ │       |          ~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 │ │ $BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot/include/assert.h:8:28: note: expanded from macro 'assert'
 │ │     8 | #define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))
 │ │       |                            ^
 │ │ $SRC_DIR/lld/COFF/Writer.cpp:788:7: note: in instantiation of function template specialization '(anonymous namespace)::Writer::writeHeader<llvm::object::pe32plus_header>' requested here
 │ │   788 |       writeHeader<pe32plus_header>();
 │ │       |       ^
 │ │ $SRC_DIR/lld/COFF/Writer.cpp:1773:25: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'long' [-Wsign-compare]
 │ │  1773 |   assert(peHeaderOffset == buf - buffer->getBufferStart());
 │ │       |          ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 │ │ $BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot/include/assert.h:8:28: note: expanded from macro 'assert'
 │ │     8 | #define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))
 │ │       |                            ^
 │ │ $SRC_DIR/lld/COFF/Writer.cpp:1840:26: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'long' [-Wsign-compare]
 │ │  1840 |          dataDirOffset64 == buf - buffer->getBufferStart());
 │ │       |          ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 │ │ $BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot/include/assert.h:8:28: note: expanded from macro 'assert'
 │ │     8 | #define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))
 │ │       |                            ^
 │ │ $SRC_DIR/lld/COFF/Writer.cpp:1740:27: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'long' [-Wsign-compare]
 │ │  1740 |   assert(coffHeaderOffset == buf - buffer->getBufferStart());
 │ │       |          ~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 │ │ $BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot/include/assert.h:8:28: note: expanded from macro 'assert'
 │ │     8 | #define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))
 │ │       |                            ^
 │ │ $SRC_DIR/lld/COFF/Writer.cpp:790:7: note: in instantiation of function template specialization '(anonymous namespace)::Writer::writeHeader<llvm::object::pe32_header>' requested here
 │ │   790 |       writeHeader<pe32_header>();
 │ │       |       ^
 │ │ $SRC_DIR/lld/COFF/Writer.cpp:1773:25: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'long' [-Wsign-compare]
 │ │  1773 |   assert(peHeaderOffset == buf - buffer->getBufferStart());
 │ │       |          ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 │ │ $BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot/include/assert.h:8:28: note: expanded from macro 'assert'
 │ │     8 | #define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))
 │ │       |                            ^
 │ │ $SRC_DIR/lld/COFF/Writer.cpp:1840:26: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'long' [-Wsign-compare]
 │ │  1840 |          dataDirOffset64 == buf - buffer->getBufferStart());
 │ │       |          ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 │ │ $BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot/include/assert.h:8:28: note: expanded from macro 'assert'
 │ │     8 | #define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions