[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-03-22 Thread via cfe-commits
wheatman wrote: I made the changes, added the tests, and fixed some things that the tests found. A few questions. It seems like n3030 is only partially supported, specifically ``` extern enum forward fwd_val0; /* Constraint violation: incomplete type */ extern enum forward* fwd_ptr0; /*

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-03-21 Thread via cfe-commits
https://github.com/wheatman updated https://github.com/llvm/llvm-project/pull/78742 >From df2911ee8f23c9030dce45f835371616cf4355b7 Mon Sep 17 00:00:00 2001 From: Brian Wheatman Date: Fri, 19 Jan 2024 11:13:33 -0500 Subject: [PATCH] [clang][Sema] Fix for overflow in enumerators(#24667) Enums

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-03-20 Thread via cfe-commits
https://github.com/wheatman updated https://github.com/llvm/llvm-project/pull/78742 >From a1275f9711d9e0c485c14e605c677446c4366393 Mon Sep 17 00:00:00 2001 From: Brian Wheatman Date: Fri, 19 Jan 2024 11:13:33 -0500 Subject: [PATCH] [clang][Sema] Fix for overflow in enumerators(#24667) Enums

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-03-20 Thread via cfe-commits
https://github.com/wheatman updated https://github.com/llvm/llvm-project/pull/78742 >From 8b82e3ecf1332880eb6eb2b257533bd86fa3582f Mon Sep 17 00:00:00 2001 From: Brian Wheatman Date: Fri, 19 Jan 2024 11:13:33 -0500 Subject: [PATCH] [clang][Sema] Fix for overflow in enumerators(#24667) Enums

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-03-20 Thread via cfe-commits
https://github.com/wheatman updated https://github.com/llvm/llvm-project/pull/78742 >From 23b742e4ee96412dca667da94ad166d4d36b73f9 Mon Sep 17 00:00:00 2001 From: Brian Wheatman Date: Fri, 19 Jan 2024 11:13:33 -0500 Subject: [PATCH] [clang][Sema] Fix for overflow in enumerators(#24667) Enums

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-03-20 Thread via cfe-commits
https://github.com/wheatman updated https://github.com/llvm/llvm-project/pull/78742 >From 06c87364d11d50284994a14a6dc9b3f510ca8330 Mon Sep 17 00:00:00 2001 From: Brian Wheatman Date: Fri, 19 Jan 2024 11:13:33 -0500 Subject: [PATCH] [clang][Sema] Fix for overflow in enumerators(#24667) Enums

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-03-05 Thread Aaron Ballman via cfe-commits
@@ -19797,6 +19797,19 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum, // - If an initializer is specified for an enumerator, the // initializing value has the same type as the expression. EltTy = Val->getType(); +}

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-03-05 Thread Aaron Ballman via cfe-commits
@@ -135,6 +135,12 @@ C23 Feature Support ``__TYPE_FMTb__`` (e.g., ``__UINT_FAST64_FMTB__``) in C23 mode for use with macros typically exposed from , such as ``PRIb8``. (`#81896: `_). +- Enumerations should allow

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-03-05 Thread Aaron Ballman via cfe-commits
@@ -211,6 +217,8 @@ Bug Fixes in This Version - Clang now doesn't produce false-positive warning `-Wconstant-logical-operand` for logical operators in C23. Fixes (`#64356 `_). +- Fixes miscompilation when an enum has a

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-03-05 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Thank you for working on this! One thing I would like to see are some tests added to `clang/test/C/C2x/` (`n3029.c` and `n3030.c`) that tests the examples and changes from the original papers/final standard to demonstrate the features are complete.

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-03-05 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/78742 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-02-25 Thread via cfe-commits
https://github.com/wheatman updated https://github.com/llvm/llvm-project/pull/78742 >From 5a3d785ef4eaa83d8944dedbb4cb1b79914fdacc Mon Sep 17 00:00:00 2001 From: Brian Wheatman Date: Fri, 19 Jan 2024 11:13:33 -0500 Subject: [PATCH] [clang][Sema] Fix for overflow in enumerators(#24667) Enums

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-02-25 Thread via cfe-commits
@@ -18,6 +19,40 @@ enum x // expected-warning {{enumeration values exceed rang { y = -9223372036854775807LL-1, // expected-warning {{ISO C restricts enumerator values to range of 'int'}} z = 9223372036854775808ULL };// expected-warning {{ISO C

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-02-25 Thread via cfe-commits
https://github.com/wheatman updated https://github.com/llvm/llvm-project/pull/78742 >From 294e0995a8e41623e7f82c4f11d2f93c64f4e403 Mon Sep 17 00:00:00 2001 From: Brian Wheatman Date: Fri, 19 Jan 2024 11:13:33 -0500 Subject: [PATCH] [clang][Sema] Fix for overflow in enumerators(#24667) Enums

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-02-23 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I think a more appropriate title would be "Fix for overflow in enumerators" https://github.com/llvm/llvm-project/pull/78742 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-02-23 Thread Shafik Yaghmour via cfe-commits
@@ -18,6 +19,40 @@ enum x // expected-warning {{enumeration values exceed rang { y = -9223372036854775807LL-1, // expected-warning {{ISO C restricts enumerator values to range of 'int'}} z = 9223372036854775808ULL };// expected-warning {{ISO C

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-02-23 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/78742 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-02-18 Thread via cfe-commits
wheatman wrote: I believe I have correct implementations added for N3029 and N3030. I also tried to add tests. One thing I was not sure about was how to add tests that have different expected behavior for different versions. I just used `#if __STDC_VERSION__ < 202311L` but please let me

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-02-18 Thread via cfe-commits
https://github.com/wheatman updated https://github.com/llvm/llvm-project/pull/78742 >From 6bbd4953ff86a120097fae7bb83e00989392c14f Mon Sep 17 00:00:00 2001 From: Brian Wheatman Date: Fri, 19 Jan 2024 11:13:33 -0500 Subject: [PATCH] [clang][Sema] Fix for enums overflowing (#24667) Enums which

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-02-18 Thread via cfe-commits
https://github.com/wheatman updated https://github.com/llvm/llvm-project/pull/78742 >From 88a908062d5d217d529b48028bd861bdf6fa9e76 Mon Sep 17 00:00:00 2001 From: Brian Wheatman Date: Fri, 19 Jan 2024 11:13:33 -0500 Subject: [PATCH] [clang][Sema] Fix for enums overflowing (#24667) Enums which

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-02-12 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > @AaronBallman I am a little confused about what is the correct behavior for > one the the cases in the test file for c. > > ```c++ > enum PR4515 {PR4515a=1u,PR4515b=(PR4515a-2)/2}; > int CheckPR4515[PR4515b==0?1:-1]; > ``` > > At present since everything is ints this

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-02-10 Thread via cfe-commits
wheatman wrote: @AaronBallman I am a little confused about what is the correct behavior for one the the cases in the test file for c. ```cpp enum PR4515 {PR4515a=1u,PR4515b=(PR4515a-2)/2}; int CheckPR4515[PR4515b==0?1:-1]; ``` At present since everything is ints this works fine, but some things

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-02-01 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: The rules between C and C++ aren't quite the same. C prohibits auto-increment from changing from signed to unsigned. C23 6.7.2.2p12: > A signed integer type is chosen if the previous enumeration constant being > added is of signed > integer type. An unsigned integer type

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-01-27 Thread via cfe-commits
https://github.com/wheatman updated https://github.com/llvm/llvm-project/pull/78742 >From 82d227ec4f4d52231fbafd1193f8f1448e8f9c4e Mon Sep 17 00:00:00 2001 From: Brian Wheatman Date: Fri, 19 Jan 2024 11:13:33 -0500 Subject: [PATCH] [clang][Sema] Fix for enums overflowing (#24667) Enums which

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-01-27 Thread via cfe-commits
@@ -19807,20 +19807,46 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum, // sufficient to contain the incremented value. If no such type // exists, the program is ill-formed. QualType T = getNextLargerIntegralType(Context,

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-01-27 Thread via cfe-commits
@@ -19807,20 +19807,46 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum, // sufficient to contain the incremented value. If no such type // exists, the program is ill-formed. QualType T = getNextLargerIntegralType(Context,

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-01-27 Thread via cfe-commits
https://github.com/wheatman updated https://github.com/llvm/llvm-project/pull/78742 >From 73a0cf747ef506398a489d69a32e5525f53539b0 Mon Sep 17 00:00:00 2001 From: Brian Wheatman Date: Fri, 19 Jan 2024 11:13:33 -0500 Subject: [PATCH] [clang][Sema] Fix for enums overflowing (#24667) Enums which

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-01-27 Thread via cfe-commits
https://github.com/cor3ntin commented: For the C changes, we should make sure we implement the relevant changes of https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3029.htm and https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3030.htm https://github.com/llvm/llvm-project/pull/78742

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-01-27 Thread via cfe-commits
@@ -19807,20 +19807,46 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum, // sufficient to contain the incremented value. If no such type // exists, the program is ill-formed. QualType T = getNextLargerIntegralType(Context,

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-01-27 Thread via cfe-commits
@@ -19807,20 +19807,46 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum, // sufficient to contain the incremented value. If no such type // exists, the program is ill-formed. QualType T = getNextLargerIntegralType(Context,

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-01-27 Thread via cfe-commits
wheatman wrote: @cor3ntin I tried to ask for your review since it was just what github recommended, if you can't do it, could you please suggest somebody else. Thanks. https://github.com/llvm/llvm-project/pull/78742 ___ cfe-commits mailing list

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-01-23 Thread via cfe-commits
https://github.com/wheatman updated https://github.com/llvm/llvm-project/pull/78742 >From f9a3be9571c8dc7ee72615bc3c21ee8adcb96411 Mon Sep 17 00:00:00 2001 From: Brian Wheatman Date: Fri, 19 Jan 2024 11:13:33 -0500 Subject: [PATCH] [clang][Sema] Fix for enums overflowing (#24667) Enums which

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-01-19 Thread via cfe-commits
https://github.com/wheatman updated https://github.com/llvm/llvm-project/pull/78742 >From 58d6df871eed40db23a4f182f9cb7989de1b2677 Mon Sep 17 00:00:00 2001 From: Brian Wheatman Date: Fri, 19 Jan 2024 11:13:33 -0500 Subject: [PATCH] [clang][Sema] Fix for enums overflowing (#24667) Enums which

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-01-19 Thread via cfe-commits
https://github.com/wheatman updated https://github.com/llvm/llvm-project/pull/78742 >From 62b80540e0cccbc938eb74f1d77ebdf2140e8192 Mon Sep 17 00:00:00 2001 From: Brian Wheatman Date: Fri, 19 Jan 2024 11:13:33 -0500 Subject: [PATCH] [clang][Sema] Fix for enums overflowing (#24667) Enums which

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-01-19 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 5f41cef58f72ebe950cc9777a8e29d1d28e543d4 0bee966adc8c16ecdf6aa6d8a47f4837ebc3d771 --

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-01-19 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (wheatman) Changes Enums which do not have a specified type can only grow to bigger types which contain more bits than the prior types. This means that the largest signed integer type cannot grow to the largest unsigned integer

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-01-19 Thread via cfe-commits
https://github.com/wheatman created https://github.com/llvm/llvm-project/pull/78742 Enums which do not have a specified type can only grow to bigger types which contain more bits than the prior types. This means that the largest signed integer type cannot grow to the largest unsigned integer