[XCore] Fix crash lowering unsized/zero-length-array thread_local globals (#220543)
XCoreLowerThreadLocal expands each thread-local global into an array
with one slot per hardware thread, indexed by core ID -- that requires a
known per-element size. Its "skip what we can't lower" guard was
checking GV->getType()->isSized(), but that's the global's pointer type,
which is always sized regardless of what it points to. The intended
check -- reject an unsized or zero-length-array value type -- was
therefore dead code, and the pass went ahead and built an ArrayType over
the unsized type anyway, producing a malformed GEP that only failed much
later (and much less clearly): a "Broken function found" MachineVerifier
abort, or, if the size check alone is fixed without also handling the
fallthrough, an opaque "SelectionDAGISel::CannotYetSelect" on a
bare GlobalTLSAddress node, since nothing downstream has a fallback
for a global this pass declines to lower.
Fixed by checking whether the pointee type can't be "sized" or its
GV->getGlobalSize() != 0. If so, we report a failure that better points out
the actual issue rather than an ICE somewhere further along in the code.
[3 lines not shown]
[mlir][ODS] Suppress generated ArrayRef Coverity warning (#220601)
Declarative parsers represent fixed-length operands and types as
ArrayRefs to scalar storage. Coverity loses the explicit length at
resolveOperands calls and reports ARRAY_VS_SINGLETON for the generated
code.
Emit the checker-specific suppression at those generated call sites and
test that it remains in the generated parser.
Found by Coverity.
Assisted-by: Codex
DDT: Use proper size when calling kmem_free on ddt_prune_entry_t
Linux and FreeBSD do not need a correct size passed to kmem_free, but
other platforms can.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Signed-off-by: Richard Yao <richard at ryao.dev>
Closes #19029
[DebugInfo] Create concrete lexical block DIEs of scopes with abstract LB DIEs (#220392)
If a lexical scope has an abstract lexical block DIE, do not skip
emission of concrete lexical block DIEs for it in
`DwarfCompileUnit::createAndAddScopeChildren()`, since abstract lexical
block DIE contains children relevant for location ranges of the scope.
[CIR] Honor the Direct coercion offset in x86_64 callconv lowering
When a record's low eightbyte holds no field, the classifier passes it in one
register read from byte 8 rather than byte 0. CallConvLowering had no way to
represent that, so `convertABIArgInfo` rejected the whole signature as NYI.
`ArgClassification` now carries the offset and `emitCoercionToMemory` reads and
writes the coerced scalar through a `u8` `cir.ptr_stride` at that byte. The
offset-zero path is untouched.
A register-tuple coercion at an offset is refused rather than read from the
wrong bytes, a pair SysV cannot currently produce.
Supersedes #203640, which had the coercion mechanism but nothing calling it.
Assisted-by: Cursor / claude-opus-5
Prevent pf dropping TCP state with crafted reset packet.
Revision 1.1212 of pf.c weakened the TCP reset check in stateful
connection tracking to let legitimate resets pass in the backwards
window. Such a reset is accepted only if its acknowledgment number
matches perfectly. But as a workaround for broken stacks, pf
replaces an acknowledgment number of 0 in a reset with the tracked
sequence of the peer. Then the perfect match always succeeds, and
an attacker can spoof resets more easily than intended. Use the
acknowledgment number from the wire, before the workaround has
modified it.
discovered by Minghao Zhang; OK sashan@
libclc: added version 21.1.8
libclc is an open source implementation of the library requirements of
the OpenCL C programming language, as specified by the OpenCL 1.1
Specification. The following sections of the specification impose
library requirements:
6.1: Supported Data Types
6.2.3: Explicit Conversions
6.2.4.2: Reinterpreting Types Using as_type() and as_typen()
6.9: Preprocessor Directives and Macros
6.11: Built-in Functions
9.3: Double Precision Floating-Point
9.4: 64-bit Atomics
9.5: Writing to 3D image memory objects
9.6: Half Precision Floating-Point
libclc is intended to be used with the Clang compiler's OpenCL frontend.
[4 lines not shown]
[mlir][IR] Initialize empty dialect resource handles (#220585)
A default AsmDialectResourceHandle leaves its dialect pointer
indeterminate. Initialize the pointer to null and test all
default-handle accessors.
Valgrind pre-fix trace:
```
OpImplementationTest.cpp:19: Failure
Expected equality of handle.getDialect() and nullptr
handle.getDialect() was 0x120b508
1 FAILED TEST
```
Found by Coverity.
Assisted-by: Codex
[mlir][IR] Initialize empty AsmResourceBlob mutability (#220586)
The default constructor leaves dataIsMutable indeterminate even though
isMutable may be called on an empty blob. Treat default-constructed
blobs as immutable and cover that state with a unit test.
Valgrind pre-fix trace:
```
Invalid read of size 8
at testing::Test::Run()
Invalid write of size 8
Invalid free() / delete / delete[] / realloc()
ERROR SUMMARY: 6 errors from 6 contexts
```
Found by Coverity.
Assisted-by: Codex
[flang-rt] Resolve unit test shared library paths (#220693)
This PR resolves a problem with finding the libflang_rt.runtime.so
library when running flang-rt unit tests whose failure looked like:
FAIL: flang-rt-Unit ::
Runtime/CUDA/./FlangCufRuntimeTests/failed_to_discover_tests_from_gtest
(1 of 17)
******************** TEST 'flang-rt-Unit ::
Runtime/CUDA/./FlangCufRuntimeTests/failed_to_discover_tests_from_gtest'
FAILED ********************
********************
FAIL: flang-rt-Unit ::
Runtime/./RuntimeTests/failed_to_discover_tests_from_gtest (2 of 17)
******************** TEST 'flang-rt-Unit ::
Runtime/./RuntimeTests/failed_to_discover_tests_from_gtest' FAILED
********************
[25 lines not shown]
[LV] Add tests for epilogue vectorization of folded bypass checks (NFC). (#220703)
Add vplan printing and branch weights tests with various cases where
parts of the epilogue skeleton can be folded.