[clang-tools-extra] [clang] [llvm] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-13 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: This change introduces a crash with `-fsanitize=array-bounds`. A reproducer from `cvise`: ```c struct irq_data { struct irq_domain *domain; } irq_domain_fix_revmap_d; struct irq_domain { struct irq_domain *parent; int revmap_size; struct irq_data *revmap[] __attribut

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-05 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: For what it's worth, I see a new crash on the latest version of this PR, in case it is not known. ``` $ make -skj"$(nproc)" ARCH=arm64 LLVM=1 mrproper allmodconfig net/ipv4/udp_tunnel_nic.o clang: /home/nathan/cbl/src/llvm-project/llvm/lib/IR/Instructions.cpp:3342: static

[clang-tools-extra] [libc] [libcxx] [llvm] [compiler-rt] [flang] [clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-18 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: The latest version of this change causes test failures for me: ``` $ cmake \ -B build \ -G Ninja \ -S llvm \ --log-level=NOTICE \ -Wno-dev \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER=clang \ -DCMAKE_CXX_COM

[clang] Revert counted_by attribute feature (PR #75857)

2023-12-18 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: > @nathanchance can you test this please to verify it's unbreaking the linux > kernel builds? A quick initial test shows this resolves the two cases that I found in https://github.com/llvm/llvm-project/issues/73168. I can do a fuller set of builds if necessary but since th

[libcxx] [compiler-rt] [flang] [libc] [llvm] [clang] [Clang] Use correct base expression for counted_by field (#73168) (PR #73465)

2023-11-28 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: For what it's worth, this resolves both the issues that I reported at https://github.com/llvm/llvm-project/issues/73168, at least when building the full two files that I noticed had a problem before. I can do more builds later if necessary. https://github.com/llvm/llvm-pro

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-20 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: I see a crash from an unreachable statement while building the Linux kernel with debug info enabled after this change. A trivial reproducer from `cvise`: ```c struct { int num_counters; long value[] __attribute__((__counted_by__(num_counters))); } agent_send_response_por

[clang] Unwrap CountAttributed for debug info (PR #86017)

2024-03-20 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: Thanks, this resolves my reported issue! https://github.com/llvm/llvm-project/pull/86017 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Split -Wcast-function-type into a separate group (PR #86131)

2024-03-21 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: This seems reasonable to me. From the perspective of the Linux kernel, this seems like it should be a no-op, as we enable `-Wcast-function-type` and disable `-Wcast-function-type-strict` (under a normal build, it is on with `W=1`) explicitly: ``` $ rg 'cast-function-type(-

[clang] [Clang][Sema] Fix missing warning when comparing mismatched enums in … (PR #81418)

2024-02-27 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: For what it's worth, this change adds several instances of `-Wenum-enum-conversion` for the Linux kernel: https://github.com/ClangBuiltLinux/linux/issues/2002. I assume this is intentional given the nature of the change as a whole but neither the tests nor the release note

[clang] Support C++20 Modules in clang-repl (PR #79261)

2024-01-30 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: > But due to I can't reproduce the failure, @nathanchance would you like to > make this? I don't want to make something that I can't test. I don't mind submitting something if I have some guidance around how this should be handled (I am a little lost in this thread at the m

[clang] Support C++20 Modules in clang-repl (PR #79261)

2024-01-30 Thread Nathan Chancellor via cfe-commits
@@ -0,0 +1,31 @@ +// UNSUPPORTED: system-aix +// +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: split-file %s %t +// +// RUN: %clang -std=c++20 %t/mod.cppm --precompile \ +// RUN: -o %t/mod.pcm +// RUN: %clang %t/mod.pcm -c -o %t/mod.o +// RUN: %clang -shared %t/mod.o -o %t/

[clang] Support C++20 Modules in clang-repl (PR #79261)

2024-01-30 Thread Nathan Chancellor via cfe-commits
@@ -0,0 +1,31 @@ +// UNSUPPORTED: system-aix +// +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: split-file %s %t +// +// RUN: %clang -std=c++20 %t/mod.cppm --precompile \ +// RUN: -o %t/mod.pcm +// RUN: %clang %t/mod.pcm -c -o %t/mod.o +// RUN: %clang -shared %t/mod.o -o %t/

[clang] Support C++20 Modules in clang-repl (PR #79261)

2024-01-24 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: For what it's worth, this test appears to fail when `LLVM_DEFAULT_TARGET_TRIPLE` is changed (my script sets it to the output of my Linux distribution's `clang -print-target-triple`) ``` error: PCH file was compiled for the target 'x86_64-pc-linux-gnu' but the current trans

[clang] Support C++20 Modules in clang-repl (PR #79261)

2024-01-25 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: This is out of my wheelhouse to debug to be honest but it seems to me that `clang-repl` does not respect `LLVM_DEFAULT_TARGET_TRIPLE` somehow? This test does the same thing as other tests to build modules but this appears to be the only one that uses `clang-repl` to consume

[clang] Support C++20 Modules in clang-repl (PR #79261)

2024-01-26 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: @vgvassilev Yes, it appears so, I tried one of the examples from [the documentation](https://clang.llvm.org/docs/ClangRepl.html) since I have no prior experience with `clang-repl`. ``` $ clang-repl --version LLVM (http://llvm.org/): LLVM version 19.0.0git Optimized buil

[clang] 9ed4a94 - [clang] Expose unreachable fallthrough annotation warning

2021-08-16 Thread Nathan Chancellor via cfe-commits
Author: Nathan Chancellor Date: 2021-08-16T17:14:55-07:00 New Revision: 9ed4a94d6451046a51ef393cd62f00710820a7e8 URL: https://github.com/llvm/llvm-project/commit/9ed4a94d6451046a51ef393cd62f00710820a7e8 DIFF: https://github.com/llvm/llvm-project/commit/9ed4a94d6451046a51ef393cd62f00710820a7e8.d

[clang] 17f4f26 - Revert "Reapply [IR] Mark and constant expressions as undesirable"

2023-07-21 Thread Nathan Chancellor via cfe-commits
Author: Nathan Chancellor Date: 2023-07-21T15:57:03-07:00 New Revision: 17f4f262fc5c4361cf43e91f2137ff7b2dcadc62 URL: https://github.com/llvm/llvm-project/commit/17f4f262fc5c4361cf43e91f2137ff7b2dcadc62 DIFF: https://github.com/llvm/llvm-project/commit/17f4f262fc5c4361cf43e91f2137ff7b2dcadc62.d

[clang] a22d385 - [Sema] Do not emit -Wmissing-variable-declarations for register variables

2023-08-08 Thread Nathan Chancellor via cfe-commits
Author: Nathan Chancellor Date: 2023-08-08T13:41:21-07:00 New Revision: a22d385f9656c95f5ce4155ea705aab6f8ef6d82 URL: https://github.com/llvm/llvm-project/commit/a22d385f9656c95f5ce4155ea705aab6f8ef6d82 DIFF: https://github.com/llvm/llvm-project/commit/a22d385f9656c95f5ce4155ea705aab6f8ef6d82.d

[clang] [Clang][LoongArch] Generate _mcount instead of mcount (PR #65657)

2023-09-07 Thread Nathan Chancellor via cfe-commits
https://github.com/nathanchance review_requested https://github.com/llvm/llvm-project/pull/65657 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][LoongArch] Generate _mcount instead of mcount (PR #65657)

2023-09-07 Thread Nathan Chancellor via cfe-commits
https://github.com/nathanchance created https://github.com/llvm/llvm-project/pull/65657: When building the LoongArch Linux kernel without `CONFIG_DYNAMIC_FTRACE`, the build fails to link because the mcount symbol is `mcount`, not `_mcount` like GCC generates and the kernel expects: ``` ld.lld

[clang] [Clang][LoongArch] Generate _mcount instead of mcount (PR #65657)

2023-09-07 Thread Nathan Chancellor via cfe-commits
https://github.com/nathanchance review_requested https://github.com/llvm/llvm-project/pull/65657 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][LoongArch] Generate _mcount instead of mcount (PR #65657)

2023-09-07 Thread Nathan Chancellor via cfe-commits
https://github.com/nathanchance review_requested https://github.com/llvm/llvm-project/pull/65657 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][LoongArch] Generate _mcount instead of mcount (PR #65657)

2023-09-07 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: cc @xen0n https://github.com/llvm/llvm-project/pull/65657 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][LoongArch] Generate _mcount instead of mcount (PR #65657)

2023-09-08 Thread Nathan Chancellor via cfe-commits
https://github.com/nathanchance closed https://github.com/llvm/llvm-project/pull/65657 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 877210f - [Sema] Do not emit -Wunused-variable for variables declared with cleanup attribute

2023-06-05 Thread Nathan Chancellor via cfe-commits
Author: Nathan Chancellor Date: 2023-06-05T10:54:47-07:00 New Revision: 877210faa447f4cc7db87812f8ed80e398fedd61 URL: https://github.com/llvm/llvm-project/commit/877210faa447f4cc7db87812f8ed80e398fedd61 DIFF: https://github.com/llvm/llvm-project/commit/877210faa447f4cc7db87812f8ed80e398fedd61.d

[clang] deecf89 - [Clang] Add release note for 877210faa447

2023-06-05 Thread Nathan Chancellor via cfe-commits
Author: Nathan Chancellor Date: 2023-06-05T12:14:51-07:00 New Revision: deecf89a1361cf3407f0fe32e7085127ec0865dc URL: https://github.com/llvm/llvm-project/commit/deecf89a1361cf3407f0fe32e7085127ec0865dc DIFF: https://github.com/llvm/llvm-project/commit/deecf89a1361cf3407f0fe32e7085127ec0865dc.d

[clang] [llvm] [AArch64] Add soft-float ABI (PR #74460)

2024-02-16 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: For what it's worth, this breaks building the Linux kernel for `ARCH=arm64` pretty badly, with errors in several drivers: ``` $ make -skj"$(nrpoc)" ARCH=arm64 LLVM=1 mrproper defconfig all ... drivers/clk/qcom/gcc-ipq6018.c:896:2: error: expression requires 'double' type su

[clang] [llvm] Revert "[AArch64] Add soft-float ABI (#74460)" (PR #82032)

2024-02-16 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: This does not appear to drop `clang/test/Driver/aarch64-soft-float-abi.c` which was added by that change, do the tests pass with that test still present? I am guessing there was a conflict because of the forward fix in 5b8e7ed787f6e537876c4fdafd070eba9681f343. Regardless,

[clang] [llvm] Remove support for 3DNow!, both intrinsics and builtins. (PR #96246)

2024-07-17 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: I am seeing a lot of ``` '-3dnow' is not a recognized feature for this target (ignoring feature) '-3dnowa' is not a recognized feature for this target (ignoring feature) ``` while building the Linux kernel (which has `-mno-3dnow` in `arch/x86/Makefile`), is this intentional

[clang] [Clang] Loop over FieldDecls instead of all Decls (PR #99574)

2024-07-21 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: I see a crash in `drivers/thermal/thermal_core.c` in Linux kernels without commit [daeeb032f42d](https://git.kernel.org/linus/daeeb032f42d066a49e07b7f6effc9f51b7a5479) ("thermal: core: Move threshold out of struct thermal_trip") after this change. `cvise` spits out: ```c

[clang] be8180a - [clang][driver] Warn when '-mno-outline-atomics' is used with a non-AArch64 triple

2021-12-23 Thread Nathan Chancellor via cfe-commits
Author: Nathan Chancellor Date: 2021-12-23T12:36:42-07:00 New Revision: be8180af5854806a343c3dd334d97ba2c4bfadfa URL: https://github.com/llvm/llvm-project/commit/be8180af5854806a343c3dd334d97ba2c4bfadfa DIFF: https://github.com/llvm/llvm-project/commit/be8180af5854806a343c3dd334d97ba2c4bfadfa.d

[clang] ef58ae8 - [RISCV] Fix mcount name

2021-03-24 Thread Nathan Chancellor via cfe-commits
Author: Nathan Chancellor Date: 2021-03-24T18:11:37-07:00 New Revision: ef58ae86ba778ed7d01cd3f6bd6d08f943abab44 URL: https://github.com/llvm/llvm-project/commit/ef58ae86ba778ed7d01cd3f6bd6d08f943abab44 DIFF: https://github.com/llvm/llvm-project/commit/ef58ae86ba778ed7d01cd3f6bd6d08f943abab44.d

[clang] [llvm] [PowerPC][ISelLowering] Support -mstack-protector-guard=tls (PR #110928)

2024-10-07 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: With [my series to fix `arch/powerpc`](https://git.kernel.org/pub/scm/linux/kernel/git/nathan/linux.git/log/?h=b4/powerpc-fix-stackprotector-test-clang) for this implementation applied to Linux, `CONFIG_HAVE_STACKPROTECTOR` is properly set and the Linux kernel dump test mod

[clang] [libcxx] [clang] Warn about memset/memcpy to NonTriviallyCopyable types (PR #111434)

2024-10-29 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: Is it expected that this warns for C code? I only see `cxx` in this change but I see a new instance of this warning in my Linux kernel builds: ``` drivers/net/ethernet/netronome/nfp/nfdk/rings.c:60:18: warning: first argument in call to '__builtin_memset' is a pointer to no

[clang] [libcxx] [clang] Warn about memset/memcpy to NonTriviallyCopyable types (PR #111434)

2024-10-29 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: > @nathanchance could you share your preprocessed source so that I can get a > reproducer? Thanks! Sure thing! ``` $ clang --target=x86_64-linux-gnu -fcf-protection -fsyntax-only -Wno-{address-of-packed-member,constant-logical-operand,gnu,unused-value} -Wnontrivial-memacc

[clang] [llvm] [PowerPC][ISelLowering] Support -mstack-protector-guard=tls (PR #110928)

2024-10-03 Thread Nathan Chancellor via cfe-commits
@@ -3605,7 +3605,8 @@ static void RenderSSPOptions(const Driver &D, const ToolChain &TC, StringRef Value = A->getValue(); if (!EffectiveTriple.isX86() && !EffectiveTriple.isAArch64() && !EffectiveTriple.isARM() && !EffectiveTriple.isThumb() && -!Effecti

[clang] [Clang][counted_by] Refactor __builtin_dynamic_object_size on FAMs (PR #122198)

2025-01-31 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: This breaks `ARCH=arm64 allmodconfig` for me. ``` $ echo CONFIG_WERROR=n >kernel/configs/no-werror.config $ make -skj"$(nproc)" ARCH=arm64 LLVM=1 mrproper {allmod,no-werror.}config drivers/net/ethernet/sfc/falcon/falcon.o PLEASE submit a bug report to https://github.com/llv

[clang] [Clang][counted_by] Don't treat a __bdos argument as an array if it isn't (PR #125298)

2025-01-31 Thread Nathan Chancellor via cfe-commits
@@ -0,0 +1,85 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -DCOUNTED_BY -O2 -Wall -Wno-int-conversion -fsanitize=array-bounds,object-size,local-bounds -fstrict-flex-

[clang] [Clang][counted_by] Don't treat a __bdos argument as an array if it isn't (PR #125298)

2025-01-31 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: This tentatively looks good to me. Do you need a reduced test case for this? `cvise` gave me: ```c typedef struct { char __padding[0]; } spinlock_t; struct { int priv_len; spinlock_t addr_list_lock; char *dev_addr; char priv[] __attribute__((__counted_by__(priv_len

[clang] [Sema] Diagnose tautological bounds checks (PR #120222)

2024-12-18 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: @nikic I noticed your comment on #118472 (the motivator for this change AFAICT): > `-fwrapv` should already cover pointers but it does not seem like this warning takes that into account (see the last example below)? I noticed a few instances of this warning in the Linux ker

[clang] [Sema] Fix tautological bounds check warning with -fwrapv (PR #120480)

2024-12-18 Thread Nathan Chancellor via cfe-commits
https://github.com/nathanchance updated https://github.com/llvm/llvm-project/pull/120480 >From 0eb68a5e438701a92dcedefc26a99c8dd48d0bed Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Wed, 18 Dec 2024 14:03:14 -0700 Subject: [PATCH 1/3] [Sema] Fix tautological bounds check warning with -

[clang] [Sema] Fix tautological bounds check warning with -fwrapv (PR #120480)

2024-12-18 Thread Nathan Chancellor via cfe-commits
https://github.com/nathanchance closed https://github.com/llvm/llvm-project/pull/120480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema] Fix tautological bounds check warning with -fwrapv (PR #120480)

2024-12-18 Thread Nathan Chancellor via cfe-commits
https://github.com/nathanchance created https://github.com/llvm/llvm-project/pull/120480 The tautological bounds check warning added in #120222 does not take into account whether signed integer overflow is well defined or not, which could result in a developer removing a bounds check that may

[clang] [Sema] Diagnose tautological bounds checks (PR #120222)

2024-12-18 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: > @nathanchance You are correct, this warning should indeed respect > `-fwrapv`/`-fno-strict-overflow`. Your patch looks reasonable to me as well. Thanks for the confirmation, I have submitted https://github.com/llvm/llvm-project/pull/120480 for this. https://github.com/ll

[clang] [Sema] Fix tautological bounds check warning with -fwrapv (PR #120480)

2024-12-18 Thread Nathan Chancellor via cfe-commits
https://github.com/nathanchance updated https://github.com/llvm/llvm-project/pull/120480 >From 0eb68a5e438701a92dcedefc26a99c8dd48d0bed Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Wed, 18 Dec 2024 14:03:14 -0700 Subject: [PATCH 1/2] [Sema] Fix tautological bounds check warning with -

[clang] [Sema] Fix tautological bounds check warning with -fwrapv (PR #120480)

2024-12-18 Thread Nathan Chancellor via cfe-commits
@@ -1,40 +1,72 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -DFWRAPV -fwrapv -verify %s nathanchance wrote: Ah yes, that is much cleaner. Done in 8504a0d758c06fa9f3b95117fdb05021d75afe8d. https://github.com/llvm/llvm-project/