[llvm-bugs] [Bug 52428] New: No uninitialized variable warning for value captured by block.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 5 15:30:39 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52428

            Bug ID: 52428
           Summary: No uninitialized variable warning for value captured
                    by block.
           Product: clang
           Version: 13.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dmaclach at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

```
// Test.c
int main(void)
{
  uint32_t status;
  int token;

  status = notify_register_dispatch("com.eg.random.event", &token,
       dispatch_get_main_queue(), ^(int t) {
         uint64_t state;
         notify_get_state(token, &state);
         printf("com.eg.random.event! %lld\n", state); 
       });

  dispatch_main();
  exit(0);
}

--------------

clang test.c -Wuninitialized -Wconditional-uninitialized -Wall 
```

I would expect there to be an uninitialized warning for token where it is
captured by the block. The code is wrong and I should be using `t` inside the
block but it's really easy to make an error here.d

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211105/3cc5c2a1/attachment-0001.html>


More information about the llvm-bugs mailing list