swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.27k stars 10.33k forks source link

[SR-12224] Assertion error in sanitizer: declared as an array with a negative size #54650

Closed swift-ci closed 4 years ago

swift-ci commented 4 years ago
Previous ID SR-12224
Radar rdar://problem/59655505
Original Reporter segabor (JIRA User)
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment Linux csihuhu 5.5.4-arch1-1 \#1 SMP PREEMPT Sat, 15 Feb 2020 00:36:29 +0000 x86_64 GNU/Linux
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | | |Labels | Bug, Linux | |Assignee | danliew (JIRA) | |Priority | Medium | md5: 279cd6497f3cf0471de86b57e6042844

Issue Description:

Latest 5.2-DEVELOPMENT snapshot (namely 5.2-DEVELOPMENT-SNAPSHOT-2020-02-16-a) cannot be built on Arch Linux due to assertion error raised in compiler-rt module.

 + /usr/bin/cmake --build /home/segabor/Workspace/swift-dev/build/buildbot_linux/llvm-linux-x86_64 – -j12 all
 [0/3][ 0%][0.000s] Performing build step for 'compiler-rt'
 [13/1150][ 1%][0.228s] Building CXX object lib/sanitizer_common/CMakeFiles/RTSanitizerCommonNoTermination.i386.dir/sanitizer_platform_limits_posix.cc.o
 FAILED: lib/sanitizer_common/CMakeFiles/RTSanitizerCommonNoTermination.i386.dir/sanitizer_platform_limits_posix.cc.o 
 /home/segabor/Workspace/swift-dev/build/buildbot_linux/llvm-linux-x86_64/./bin/clang++ -DHAVE_RPC_XDR_H=0 -I/home/segabor/Workspace/swift-dev/llvm-project/compiler-rt/lib/sanitizer_common/.. -Wall -std=c++11 -Wno-unused-parameter -O3 -DNDEBUG -m32 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -Wframe-larger-than=570 -Wglobal-constructors -MD -MT lib/sanitizer_common/CMakeFiles/RTSanitizerCommonNoTermination.i386.dir/sanitizer_platform_limits_posix.cc.o -MF lib/sanitizer_common/CMakeFiles/RTSanitizerCommonNoTermination.i386.dir/sanitizer_platform_limits_posix.cc.o.d -o lib/sanitizer_common/CMakeFiles/RTSanitizerCommonNoTermination.i386.dir/sanitizer_platform_limits_posix.cc.o -c /home/segabor/Workspace/swift-dev/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
 /home/segabor/Workspace/swift-dev/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:1131:1: error: 'assertion_failed__1131' declared as an array with a negative size
 CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /home/segabor/Workspace/swift-dev/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1437:3: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
 COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *) NULL)->MEMBER) == \
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /home/segabor/Workspace/swift-dev/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:336:30: note: expanded from macro 'COMPILER_CHECK'
 #define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /home/segabor/Workspace/swift-dev/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:342:57: note: expanded from macro 'IMPL_COMPILER_ASSERT'
 typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
 ^~~~~~~~~~~~~~~
 1 error generated.
 [26/1150][ 2%][0.425s] Building CXX object lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_linux.cc.o
 ninja: build stopped: subcommand failed.
 FAILED: tools/clang/runtime/compiler-rt-stamps/compiler-rt-build 
 cd /home/segabor/Workspace/swift-dev/build/buildbot_linux/llvm-linux-x86_64/tools/clang/runtime/compiler-rt-bins && /usr/bin/cmake --build . && /usr/bin/cmake -E touch /home/segabor/Workspace/swift-dev/build/buildbot_linux/llvm-linux-x86_64/tools/clang/runtime/compiler-rt-stamps//compiler-rt-build
 ninja: build stopped: subcommand failed.
 ./swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
 ./swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
swift-ci commented 4 years ago

Comment by Gábor Sebestyén (JIRA)

Attempted with 5.2-DEVELOPMENT-SNAPSHOT-2020-02-18-a, got the same error. Full build log will be attached.

swift-ci commented 4 years ago

Comment by Gábor Sebestyén (JIRA)

Applying an LLVM patch manually fixed the build https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce

hborla commented 4 years ago

@swift-ci create

swift-ci commented 4 years ago

Comment by Dan Liew (JIRA)

A fix for this has been landed to the apple/stable/20190619 branch in the llvm-project repo (https://github.com/apple/llvm-project/pull/822) ).

This should automatically propagate to the `swift/swift-5.2-branch` of the llvm-project in the next few hours.

Please verify the fix.

swift-ci commented 4 years ago

Comment by Dan Liew (JIRA)

Please verify the fix.

swift-ci commented 4 years ago

Comment by Gábor Sebestyén (JIRA)

As of 5.2-DEVELOPMENT-SNAPSHOT-2020-02-23-a build went fine. Ticket can be closed.

Thanks,

Gábor