Skip to content

[CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) #122653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
32bbbb9
[CodeGen] Migrate away from PointerUnion::dyn_cast (NFC)
kazutakahirata Jan 12, 2025
8a2dad6
[DirectX] Implement the resource.store.rawbuffer intrinsic (#121282)
bogner Jan 13, 2025
a60a590
Fix print module manifest file for macos (#122370)
billhoffman Jan 13, 2025
5b11c97
[RISCV] Rework memcpy test (#120364)
wangpc-pp Jan 13, 2025
db99d5b
Revert "[RISCV] Rework memcpy test" (#122662)
wangpc-pp Jan 13, 2025
f70db68
Reapply "[RISCV] Rework memcpy test (#120364)"
wangpc-pp Jan 13, 2025
94070a5
[SPIRV] convergence anchor intrinsic does not have a parent token (#1…
ssahasra Jan 13, 2025
30e9022
[AMDGPU] Fix an invalid cast in `AMDGPULateCodeGenPrepare::visitLoadI…
shiltian Jan 13, 2025
d9c307d
[AMDGPU][NewPM] Port AMDGPURemoveIncompatibleFunctions to NPM (#122261)
optimisan Jan 13, 2025
7e9123e
[libc][math][c23] Add tanf16 function (#121018)
wldfngrs Jan 13, 2025
e5c7cfa
[CodeGen][NewPM] Use proper NPM AtomicExpandPass in AMDGPU (#122086)
optimisan Jan 13, 2025
f70d782
[libc][complex] fix compiler support matrix for cfloat128 (#122593)
Sh0g0-1758 Jan 13, 2025
6f6306c
[OpenMP] codegen support for masked combined construct masked taskloo…
chandraghale Jan 13, 2025
19df4e0
[mlir][linalg] Fix neutral elt for softmax (#118952)
oowekyala Jan 13, 2025
9280073
Partially revert "[TableGen] Avoid repeated hash lookups (NFC) (#1225…
kazutakahirata Jan 13, 2025
386c2f5
[SLPVectorizer] Refactor HorizontalReduction::createOp (NFC) (#121549)
Mel-Chen Jan 13, 2025
6ac1259
Reapply "Spiller: Detach legacy pass and supply analyses instead (#11…
optimisan Jan 13, 2025
84458e7
[clang][ASTImporter] Not using primary context in lookup table (#118466)
balazske Jan 13, 2025
c879527
[ci] Handle the case where all reported tests pass but the build is s…
DavidSpickett Jan 13, 2025
5e3ad25
[MLIR][NVVM] Fix the datatype error for nvvm.mma.sync when the operan…
xiaoleis-nv Jan 13, 2025
d6708f4
[MachineCP] Correctly handle register masks and sub-registers (#122472)
ostannard Jan 13, 2025
9c6dad0
Revert "[clang] Canonicalize absolute paths in dependency file" (#121…
xtexx Jan 13, 2025
d41b701
[Clang] Add release note for pointer overflow optimization change (#1…
nikic Jan 13, 2025
4942343
[flang][OpenMP] Fix `omp-declarative-allocate-align.f90` expectations…
ergawy Jan 13, 2025
3a52d3e
[TableGen] Use assert instead of PrintFatalError in TGLexer. NFC. (#1…
jayfoad Jan 13, 2025
2a4c6a8
[clang][ASTImporter] Fix unused variable warning (NFC) (#122686)
balazske Jan 13, 2025
c97a19c
[NVPTX] Add float to tf32 conversion intrinsics (#121507)
durga4github Jan 13, 2025
adc92c8
Enabled freethreading support in MLIR python bindings (#122684)
vfdev-5 Jan 13, 2025
a5cd85a
Fix an unused-variable warning in release build.
hokein Jan 13, 2025
25328a9
Remove an extra trailing `` in Modules.rst, NFC
hokein Jan 13, 2025
d04031a
[RISCV] Add Qualcomm uC Xqciint (Interrupts) extension (#122256)
hchandel Jan 13, 2025
6b23b48
Reland "[LoopVectorizer] Add support for partial reductions" with non…
SamTebbs33 Jan 13, 2025
fe97054
Handle leading underscores in update_cc_test_checks.py (#121800)
momchil-velikov Jan 13, 2025
1bd6643
[X86] subvectorwise-store-of-vector-splat.ll - regenerate VPTERNLOG c…
RKSimon Jan 10, 2025
3a22d74
[Polly] Use "is" instead of "==" to check for None (#94021)
e-kwsm Jan 13, 2025
0dc75c6
[cross-project-tests] Use "is" instead of "==" to check for None (#94…
e-kwsm Jan 13, 2025
9baef02
[Polly] Fix invalid escape sequences (#94037)
e-kwsm Jan 13, 2025
75e2396
[AArch64] Fix chain for calls from agnostic-ZA functions.
sdesmalen-arm Jan 13, 2025
cea8dc3
[Polly] Revert changes to isl Python code
nikic Jan 13, 2025
12a7591
[cross-project-tests] Fix invalid escape sequences (#94031)
e-kwsm Jan 13, 2025
7fcfbd8
[AMDGPU][NewPM] Port AMDGPUOpenCLEnqueuedBlockLowering to NPM (#122434)
optimisan Jan 13, 2025
7cc3a34
[Flang][OpenMP] Support teams reductions lowering (#122683)
skatrak Jan 13, 2025
67cdf2a
AMDGPU: Add gfx9 run line to scalar_to_vector test (#122659)
arsenm Jan 13, 2025
9d5264b
DAG: Fold bitcast of scalar_to_vector to anyext (#122660)
arsenm Jan 13, 2025
9a9b71c
[clang] Refactor attr diagnostics to use %select (#122473)
emaxx-google Jan 13, 2025
462d407
[LV] Fix FindLastIV reduction for epilogue vectorization. (#120395)
Mel-Chen Jan 13, 2025
4713917
[NFC][analyzer][docs] Migrate 'annotations.html' to RST (#122246)
NagyDonat Jan 13, 2025
8f35291
LAA: add missed swap when inverting src, sink (#122254)
artagnon Jan 13, 2025
ef85aa9
[LV][EVL] Pre-commit test case for fixed-order recurrence with EVL ta…
Mel-Chen Jan 13, 2025
812c8b9
[NFC][analyzer][docs] Restore/remove orphaned images (#122481)
NagyDonat Jan 13, 2025
876773b
Revert "[MachineCP] Correctly handle register masks and sub-registers…
nikic Jan 13, 2025
3515275
[IR] Introduce captures attribute (#116990)
nikic Jan 13, 2025
ba20f9b
[AArch64] Change feature dependencies of fp8 features (#122280)
Lukacma Jan 13, 2025
35d4720
[clang][OpenMP] Add 'align' modifier for 'allocate' clause (#121814)
ddpagan Jan 13, 2025
91de4ce
[Multilib] Custom flags YAML parsing (#110657)
vhscampos Jan 13, 2025
da5f0de
[Multilib] Add -fmultilib-flag command-line option (#110658)
vhscampos Jan 13, 2025
3958594
[libc++] Replace stable_sort with sort in flat_map (#121431)
huixie90 Jan 13, 2025
f86786e
[libc++] Pass type information down to __libcpp_allocate (#118837)
ldionne Jan 13, 2025
6e66ff3
[libc++][NFC] Use uint32_t instead of __uint32_t on Apple (#122356)
ldionne Jan 13, 2025
e681ed6
[libc++] Deprecate extension `packaged_task::result_type` (#122600)
frederick-vs-ja Jan 13, 2025
4fc486d
[X86] Fold VPERMV3(X,M,Y) -> VPERMV(CONCAT(X,Y),WIDEN(M)) iff the CON…
RKSimon Jan 13, 2025
52b539b
[llvm-objdump] Remove leading whitespace for PT_GNU_PROPERTY. (#121591)
rjmansfield Jan 13, 2025
fd605d0
[libc++] Redefine Fuchsia locale base support on top of the new API (…
ldionne Jan 13, 2025
3d65e9d
Remove StandaloneExtensionPybind11.cpp FT update as does not work wit…
vfdev-5 Jan 13, 2025
b525d7b
[win/asan] GetInstructionSize: Support some more 2 byte instructions.…
bernhardu Jan 13, 2025
6cccd43
[AArch64] Fix aarch64-fujitsu-monaka.c test (#122716)
Lukacma Jan 13, 2025
0ffdf9e
Revert "[Multilib] Custom flags YAML parsing" (#122722)
vhscampos Jan 13, 2025
5e2d309
[libcxx] Don't hold the lock when calling notify_* on gates in std::s…
Brotcrunsher Jan 13, 2025
f7a1264
[SPIRV] Return success when selecting reads and writes. (#122162)
s-perron Jan 13, 2025
9f76de2
[SLP]Do not include subvectors for fully matched buildvectors
alexey-bataev Jan 13, 2025
e70f943
[TySan] Fix struct access with different bases (#120412)
gbMattN Jan 13, 2025
1157ed9
[InstCombine] Fold `(ct{t,l}z Pow2)` -> `Log2(Pow2)` (#122620)
goldsteinn Jan 13, 2025
98ad3e2
[mlir python] Add locking around PyMlirContext::liveOperations. (#122…
hawkinsp Jan 13, 2025
b0ef2d2
[flang][AIX] BIND(C) derived type alignment for AIX (#121505)
kkwli Jan 13, 2025
073be15
[gn build] Port b5ba4f06db2e
llvmgnsyncbot Jan 13, 2025
139b1b4
[gn build] Port cedb44af53f1
llvmgnsyncbot Jan 13, 2025
c76b878
[MLIR][TableGen] Use arg index in InferredResultType constructor. (#1…
schilkp Jan 13, 2025
af4c227
[clang] Add test for CWG170 "Pointer-to-member conversions" (#121667)
Endilll Jan 13, 2025
15dde26
IR: introduce ICmpInst::isImpliedByMatchingCmp (#122597)
artagnon Jan 13, 2025
0164480
[llvm][Docs] Add new LLDB Python guidance to release notes (#122719)
DavidSpickett Jan 13, 2025
86f6a94
[Clang][LLVM][AArch64]Add new feature SSVE-BitPerm (#121947)
CarolineConcatto Jan 13, 2025
413aa5c
[MLIR][NVVM] Enable inlining of func's calling nvvm intrinsics (#122650)
wsmoses Jan 13, 2025
db5063c
[flang] Support discovering LLVM/Clang/MLIR without explicit *_DIR (#…
mgorny Jan 13, 2025
fa28ba3
[AMDGPU][True16][CodeGen] true16 codegen pattern for v_pack_b32_f16 (…
broxigarchen Jan 13, 2025
13a4fbf
[SLP]Check for div/rem instructions before extending with poisons
alexey-bataev Jan 13, 2025
54c1de2
[BoundsChecking] Add guard= pass parameter (#122575)
vitalybuka Jan 13, 2025
ea135e1
[InstCombine] Test for trunc in align assume (NFC)
andjo403 Jan 13, 2025
fec04dc
[ubsan] Pass fsanitize-skip-hot-cutoff into -fsanitize=bounds (#122576)
vitalybuka Jan 13, 2025
6abba98
The _code field in an NSError is signed, not unsigned. (#119764)
jimingham Jan 13, 2025
9c4286b
[HLSL] Adding Flatten and Branch if attributes with test fixes (#122157)
joaosaffran Jan 13, 2025
448569b
[SLP][NFC]Add a test with incorrect extractelement parameter after ex…
alexey-bataev Jan 13, 2025
5cdbaa4
[X86] Use loaded/stored element size when parsing/printing gather/sca…
topperc Jan 13, 2025
a0db95c
[MLIR][LLVM] Fix inlining of a single block ending with unreachable (…
wsmoses Jan 13, 2025
72489ee
[AArch64] Implement FP8 SVE/SME reinterpret intrinsics (#121063)
momchil-velikov Jan 13, 2025
5f18abe
[SLP]Correctly set vector operand for extracts with poisons
alexey-bataev Jan 13, 2025
dc56c62
[libc++][z/OS] __cxx03 subdir was added by mistake (#122763)
perry-ca Jan 13, 2025
4b9d7d0
Revert "[aarch64][win] Add support for import call optimization (equi…
kstoimenov Jan 13, 2025
9bc9486
[lldb] Add amd64 ArchSpec (#122533)
brad0 Jan 13, 2025
92d5c62
[ADT] Deprecate PointerUnion::{is,get} (NFC) (#122623)
kazutakahirata Jan 13, 2025
68123b3
[AST] Migrate away from PointerUnion::dyn_cast (NFC) (#122651)
kazutakahirata Jan 13, 2025
54b3f3b
[Analysis] Migrate away from PointerUnion::dyn_cast (NFC) (#122652)
kazutakahirata Jan 13, 2025
39bf934
Address comments.
kazutakahirata Jan 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
102 changes: 88 additions & 14 deletions .ci/generate_test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ def junit_from_xml(xml):

class TestReports(unittest.TestCase):
def test_title_only(self):
self.assertEqual(_generate_report("Foo", []), ("", "success"))
self.assertEqual(_generate_report("Foo", 0, []), ("", "success"))

def test_no_tests_in_testsuite(self):
self.assertEqual(
_generate_report(
"Foo",
1,
[
junit_from_xml(
dedent(
Expand All @@ -45,6 +46,7 @@ def test_no_failures(self):
self.assertEqual(
_generate_report(
"Foo",
0,
[
junit_from_xml(
dedent(
Expand All @@ -70,10 +72,51 @@ def test_no_failures(self):
),
)

def test_no_failures_build_failed(self):
self.assertEqual(
_generate_report(
"Foo",
1,
[
junit_from_xml(
dedent(
"""\
<?xml version="1.0" encoding="UTF-8"?>
<testsuites time="0.00">
<testsuite name="Passed" tests="1" failures="0" skipped="0" time="0.00">
<testcase classname="Bar/test_1" name="test_1" time="0.00"/>
</testsuite>
</testsuites>"""
)
)
],
buildkite_info={
"BUILDKITE_ORGANIZATION_SLUG": "organization_slug",
"BUILDKITE_PIPELINE_SLUG": "pipeline_slug",
"BUILDKITE_BUILD_NUMBER": "build_number",
"BUILDKITE_JOB_ID": "job_id",
},
),
(
dedent(
"""\
# Foo

* 1 test passed

All tests passed but another part of the build **failed**.

[Download](https://buildkite.com/organizations/organization_slug/pipelines/pipeline_slug/builds/build_number/jobs/job_id/download.txt) the build's log file to see the details."""
),
"error",
),
)

def test_report_single_file_single_testsuite(self):
self.assertEqual(
_generate_report(
"Foo",
1,
[
junit_from_xml(
dedent(
Expand Down Expand Up @@ -166,6 +209,7 @@ def test_report_single_file_multiple_testsuites(self):
self.assertEqual(
_generate_report(
"ABC and DEF",
1,
[
junit_from_xml(
dedent(
Expand Down Expand Up @@ -198,6 +242,7 @@ def test_report_multiple_files_multiple_testsuites(self):
self.assertEqual(
_generate_report(
"ABC and DEF",
1,
[
junit_from_xml(
dedent(
Expand Down Expand Up @@ -238,6 +283,7 @@ def test_report_dont_list_failures(self):
self.assertEqual(
_generate_report(
"Foo",
1,
[
junit_from_xml(
dedent(
Expand Down Expand Up @@ -272,6 +318,7 @@ def test_report_dont_list_failures_link_to_log(self):
self.assertEqual(
_generate_report(
"Foo",
1,
[
junit_from_xml(
dedent(
Expand Down Expand Up @@ -312,6 +359,7 @@ def test_report_size_limit(self):
self.assertEqual(
_generate_report(
"Foo",
1,
[
junit_from_xml(
dedent(
Expand Down Expand Up @@ -351,12 +399,18 @@ def test_report_size_limit(self):
# and output will not be.
def _generate_report(
title,
return_code,
junit_objects,
size_limit=1024 * 1024,
list_failures=True,
buildkite_info=None,
):
if not junit_objects:
# Note that we do not post an empty report, therefore we can ignore a
# non-zero return code in situations like this.
#
# If we were going to post a report, then yes, it would be misleading
# to say we succeeded when the final return code was non-zero.
return ("", "success")

failures = {}
Expand Down Expand Up @@ -385,7 +439,11 @@ def _generate_report(
if not tests_run:
return ("", None)

style = "error" if tests_failed else "success"
style = "success"
# Either tests failed, or all tests passed but something failed to build.
if tests_failed or return_code != 0:
style = "error"

report = [f"# {title}", ""]

tests_passed = tests_run - tests_skipped - tests_failed
Expand All @@ -400,17 +458,17 @@ def plural(num_tests):
if tests_failed:
report.append(f"* {tests_failed} {plural(tests_failed)} failed")

if not list_failures:
if buildkite_info is not None:
log_url = (
"https://buildkite.com/organizations/{BUILDKITE_ORGANIZATION_SLUG}/"
"pipelines/{BUILDKITE_PIPELINE_SLUG}/builds/{BUILDKITE_BUILD_NUMBER}/"
"jobs/{BUILDKITE_JOB_ID}/download.txt".format(**buildkite_info)
)
download_text = f"[Download]({log_url})"
else:
download_text = "Download"
if buildkite_info is not None:
log_url = (
"https://buildkite.com/organizations/{BUILDKITE_ORGANIZATION_SLUG}/"
"pipelines/{BUILDKITE_PIPELINE_SLUG}/builds/{BUILDKITE_BUILD_NUMBER}/"
"jobs/{BUILDKITE_JOB_ID}/download.txt".format(**buildkite_info)
)
download_text = f"[Download]({log_url})"
else:
download_text = "Download"

if not list_failures:
report.extend(
[
"",
Expand All @@ -435,11 +493,23 @@ def plural(num_tests):
"</details>",
]
)
elif return_code != 0:
# No tests failed but the build was in a failed state. Bring this to the user's
# attention.
report.extend(
[
"",
"All tests passed but another part of the build **failed**.",
"",
f"{download_text} the build's log file to see the details.",
]
)

report = "\n".join(report)
if len(report.encode("utf-8")) > size_limit:
return _generate_report(
title,
return_code,
junit_objects,
size_limit,
list_failures=False,
Expand All @@ -449,9 +519,10 @@ def plural(num_tests):
return report, style


def generate_report(title, junit_files, buildkite_info):
def generate_report(title, return_code, junit_files, buildkite_info):
return _generate_report(
title,
return_code,
[JUnitXml.fromfile(p) for p in junit_files],
buildkite_info=buildkite_info,
)
Expand All @@ -463,6 +534,7 @@ def generate_report(title, junit_files, buildkite_info):
"title", help="Title of the test report, without Markdown formatting."
)
parser.add_argument("context", help="Annotation context to write to.")
parser.add_argument("return_code", help="The build's return code.", type=int)
parser.add_argument("junit_files", help="Paths to JUnit report files.", nargs="*")
args = parser.parse_args()

Expand All @@ -477,7 +549,9 @@ def generate_report(title, junit_files, buildkite_info):
if len(buildkite_info) != len(env_var_names):
buildkite_info = None

report, style = generate_report(args.title, args.junit_files, buildkite_info)
report, style = generate_report(
args.title, args.return_code, args.junit_files, buildkite_info
)

if report:
p = subprocess.Popen(
Expand Down
4 changes: 3 additions & 1 deletion .ci/monolithic-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ if [[ -n "${CLEAR_CACHE:-}" ]]; then
fi

function at-exit {
retcode=$?

mkdir -p artifacts
ccache --print-stats > artifacts/ccache_stats.txt

Expand All @@ -37,7 +39,7 @@ function at-exit {
if command -v buildkite-agent 2>&1 >/dev/null
then
python3 "${MONOREPO_ROOT}"/.ci/generate_test_report.py ":linux: Linux x64 Test Results" \
"linux-x64-test-results" "${BUILD_DIR}"/test-results.*.xml
"linux-x64-test-results" $retcode "${BUILD_DIR}"/test-results.*.xml
fi
}
trap at-exit EXIT
Expand Down
4 changes: 3 additions & 1 deletion .ci/monolithic-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ fi

sccache --zero-stats
function at-exit {
retcode=$?

mkdir -p artifacts
sccache --show-stats >> artifacts/sccache_stats.txt

Expand All @@ -36,7 +38,7 @@ function at-exit {
if command -v buildkite-agent 2>&1 >/dev/null
then
python "${MONOREPO_ROOT}"/.ci/generate_test_report.py ":windows: Windows x64 Test Results" \
"windows-x64-test-results" "${BUILD_DIR}"/test-results.*.xml
"windows-x64-test-results" $retcode "${BUILD_DIR}"/test-results.*.xml
fi
}
trap at-exit EXIT
Expand Down
8 changes: 4 additions & 4 deletions clang/docs/LanguageExtensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2137,8 +2137,8 @@ method; it specifies that the method expects its ``self`` parameter to have a
- (void) bar __attribute__((ns_consumes_self));
- (void) baz:(id) __attribute__((ns_consumed)) x;

Further examples of these attributes are available in the static analyzer's `list of annotations for analysis
<https://clang-analyzer.llvm.org/annotations.html#cocoa_mem>`_.
Further examples of these attributes are available in the static analyzer's
`list of annotations for analysis <analyzer/user-docs/Annotations.html#cocoa-mem>`__.

Query for these features with ``__has_attribute(ns_consumed)``,
``__has_attribute(ns_returns_retained)``, etc.
Expand Down Expand Up @@ -4792,8 +4792,8 @@ Extensions for Static Analysis
Clang supports additional attributes that are useful for documenting program
invariants and rules for static analysis tools, such as the `Clang Static
Analyzer <https://clang-analyzer.llvm.org/>`_. These attributes are documented
in the analyzer's `list of source-level annotations
<https://clang-analyzer.llvm.org/annotations.html>`_.
in the analyzer's `list of annotations for analysis
<analyzer/user-docs/Annotations.html>`__.


Extensions for Dynamic Analysis
Expand Down
2 changes: 1 addition & 1 deletion clang/docs/Modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ first include path that would refer to the current file. ``#include_next`` is
interpreted as if the current file had been found in that path.
If this search finds a file named by a module map, the ``#include_next``
directive is translated into an import, just like for a ``#include``
directive.``
directive.

Module maps
-----------
Expand Down
2 changes: 2 additions & 0 deletions clang/docs/OpenMPSupport.rst
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ implementation.
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| memory management | 'allocator' modifier for allocate clause | :good:`done` | https://github.com/llvm/llvm-project/pull/114883 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| memory management | 'align' modifier for allocate clause | :good:`done` | https://github.com/llvm/llvm-project/pull/121814 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| memory management | new memory management routines | :none:`unclaimed` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| memory management | changes to omp_alloctrait_key enum | :none:`unclaimed` | |
Expand Down
24 changes: 24 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,29 @@ code bases.
containing strict-aliasing violations. The new default behavior can be
disabled using ``-fno-pointer-tbaa``.

- Clang will now more aggressively use undefined behavior on pointer addition
overflow for optimization purposes. For example, a check like
``ptr + unsigned_offset < ptr`` will now optimize to ``false``, because
``ptr + unsigned_offset`` will cause undefined behavior if it overflows (or
advances past the end of the object).

Previously, ``ptr + unsigned_offset < ptr`` was optimized (by both Clang and
GCC) to ``(ssize_t)unsigned_offset < 0``. This also results in an incorrect
overflow check, but in a way that is less apparent when only testing with
pointers in the low half of the address space.

To avoid pointer addition overflow, it is necessary to perform the addition
on integers, for example using
``(uintptr_t)ptr + unsigned_offset < (uintptr_t)ptr``. Sometimes, it is also
possible to rewrite checks by only comparing the offset. For example,
``ptr + offset < end_ptr && ptr + offset >= ptr`` can be written as
``offset < (uintptr_t)(end_ptr - ptr)``.

Undefined behavior due to pointer addition overflow can be reliably detected
using ``-fsanitize=pointer-overflow``. It is also possible to use
``-fno-strict-overflow`` to opt-in to a language dialect where signed integer
and pointer overflow are well-defined.

C/C++ Language Potentially Breaking Changes
-------------------------------------------

Expand Down Expand Up @@ -1347,6 +1370,7 @@ OpenMP Support
always build support for AMDGPU and NVPTX targets.
- Added support for combined masked constructs 'omp parallel masked taskloop',
'omp parallel masked taskloop simd','omp masked taskloop' and 'omp masked taskloop simd' directive.
- Added support for align-modifier in 'allocate' clause.

Improvements
^^^^^^^^^^^^
Expand Down
6 changes: 2 additions & 4 deletions clang/docs/UsersManual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1364,10 +1364,8 @@ Controlling Static Analyzer Diagnostics
While not strictly part of the compiler, the diagnostics from Clang's
`static analyzer <https://clang-analyzer.llvm.org>`_ can also be
influenced by the user via changes to the source code. See the available
`annotations <https://clang-analyzer.llvm.org/annotations.html>`_ and the
analyzer's `FAQ
page <https://clang-analyzer.llvm.org/faq.html#exclude_code>`_ for more
information.
`annotations <analyzer/user-docs/Annotations.html>`_ and the analyzer's
`FAQ page <analyzer/user-docs/FAQ.html#exclude-code>`_ for more information.

.. _usersmanual-precompiled-headers:

Expand Down
1 change: 1 addition & 0 deletions clang/docs/analyzer/user-docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ Contents:
user-docs/FilingBugs
user-docs/CrossTranslationUnit
user-docs/TaintAnalysisConfiguration
user-docs/Annotations
user-docs/FAQ
Loading
Loading