[clang] [Clang][counted-by][NFC] Add testcase for non-forward record decl (PR #153338)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 5 10:38:02 PST 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results

* 51685 tests passed
* 889 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### Clang
<details>
<summary>Clang.CodeGen/attr-counted-by.c</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\clang.exe -cc1 -internal-isystem C:\_work\llvm-project\llvm-project\build\lib\clang\22\include -nostdsysteminc -triple x86_64-unknown-linux-gnu -DCOUNTED_BY -O2 -Wall -fsanitize=array-bounds,object-size,local-bounds -fstrict-flex-arrays=3 -emit-llvm -o - C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by.c | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe --check-prefix=SANITIZE-WITH-ATTR C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by.c
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\clang.exe' -cc1 -internal-isystem 'C:\_work\llvm-project\llvm-project\build\lib\clang\22\include' -nostdsysteminc -triple x86_64-unknown-linux-gnu -DCOUNTED_BY -O2 -Wall -fsanitize=array-bounds,object-size,local-bounds -fstrict-flex-arrays=3 -emit-llvm -o - 'C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by.c'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by.c:2506:41: warning: left operand of comma operator has no effect [-Wunused-value]
# |  2506 |   return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# |       |                                         ^
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by.c:2506:48: warning: left operand of comma operator has no effect [-Wunused-value]
# |  2506 |   return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# |       |                                                ^
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by.c:2506:55: warning: left operand of comma operator has no effect [-Wunused-value]
# |  2506 |   return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# |       |                                                       ^
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by.c:2506:58: warning: left operand of comma operator has no effect [-Wunused-value]
# |  2506 |   return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# |       |                                                          ^
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by.c:2506:65: warning: left operand of comma operator has no effect [-Wunused-value]
# |  2506 |   return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# |       |                                                                 ^~
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by.c:2506:61: warning: left operand of comma operator has no effect [-Wunused-value]
# |  2506 |   return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# |       |                                                             ^
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by.c:2506:51: warning: left operand of comma operator has no effect [-Wunused-value]
# |  2506 |   return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# |       |                                                   ^
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by.c:2506:44: warning: left operand of comma operator has no effect [-Wunused-value]
# |  2506 |   return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# |       |                                            ^
# | 8 warnings generated.
# `-----------------------------
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' --check-prefix=SANITIZE-WITH-ATTR 'C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by.c'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by.c:2609:136: error: undefined variable: META2
# | // SANITIZE-WITH-ATTR-NEXT: br i1 [[DOTNOT]], label [[HANDLER_OUT_OF_BOUNDS:%.*]], label [[CONT3:%.*]], !prof [[PROF8]], !nosanitize [[META2]]
# |                                                                                                                                        ^
# | <stdin>:1021:42: note: with "DOTNOT" equal to "%.not"
# |  %.not = icmp eq i16 %.counted_by.load, 0
# |                                          ^
# | <stdin>:1021:42: note: with "PROF8" equal to "!8"
# |  %.not = icmp eq i16 %.counted_by.load, 0
# |                                          ^
# | <stdin>:1022:27: note: possible intended match here
# |  br i1 %.not, label %handler.out_of_bounds, label %cont3, !prof !8, !nosanitize !6
# |                           ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by.c
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |           1016:  
# |           1017: ; Function Attrs: nounwind 
# |           1018: define dso_local ptr @test40(ptr noundef %q) local_unnamed_addr #0 { 
# |           1019: entry: 
# |           1020:  %.counted_by.load = load i16, ptr %q, align 4 
# |           1021:  %.not = icmp eq i16 %.counted_by.load, 0 
# | next:2609'0                                              X error: match failed for invalid pattern
# | next:2609'1                                                undefined variable: META2
# | next:2609'2                                                with "DOTNOT" equal to "%.not"
# | next:2609'3                                                with "PROF8" equal to "!8"
# |           1022:  br i1 %.not, label %handler.out_of_bounds, label %cont3, !prof !8, !nosanitize !6 
# | next:2609'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:2609'4                               ?                                                         possible intended match
# |           1023:  
# | next:2609'0     ~
# |           1024: handler.out_of_bounds: ; preds = %entry 
# | next:2609'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1025:  tail call void @__ubsan_handle_out_of_bounds_abort(ptr nonnull @58, i64 0) #8, !nosanitize !6 
# | next:2609'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1026:  unreachable, !nosanitize !6 
# | next:2609'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1027:  
# | next:2609'0     ~
# |              .
# |              .
# |              .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/153338


More information about the cfe-commits mailing list