[all-commits] [llvm/llvm-project] dd0f64: [Sema] Add check for bitfield assignments to large...
vabridgers via All-commits
all-commits at lists.llvm.org
Thu Oct 12 11:14:35 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: dd0f642e6ec5049ccabe3f462cc427ffe213829b
https://github.com/llvm/llvm-project/commit/dd0f642e6ec5049ccabe3f462cc427ffe213829b
Author: vabridgers <58314289+vabridgers at users.noreply.github.com>
Date: 2023-10-12 (Thu, 12 Oct 2023)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/DiagnosticGroups.td
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/Sema/SemaChecking.cpp
A clang/test/SemaCXX/bitfield-width.c
Log Message:
-----------
[Sema] Add check for bitfield assignments to larger integral types (#68276)
We noticed that clang does not check for bitfield assignment widths,
while gcc does check this.
gcc produced a warning like so for it's -Wconversion flag:
```
$ gcc -Wconversion -c test.c
test.c: In function 'foo':
test.c:10:15: warning: conversion from 'int' to 'signed char:7' may change value [-Wconversion]
10 | vxx.bf = x; // no warning
| ^
```
This change simply adds this check for integral types under the
-Wbitfield-conversion compiler option.
More information about the All-commits
mailing list