diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-10-30 14:51:02 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2024-10-30 14:51:02 +0100 |
commit | d7f2c1bff6993cba1e46fd6902776778612c290d (patch) | |
tree | 8cd9855d9ea9770805896f12b2ec1cf970888aff /gcc/tree-vectorizer.h | |
parent | a65e1487cda969e4763ae84577bf3e0d9e2b34aa (diff) | |
download | gcc-d7f2c1bff6993cba1e46fd6902776778612c290d.zip gcc-d7f2c1bff6993cba1e46fd6902776778612c290d.tar.gz gcc-d7f2c1bff6993cba1e46fd6902776778612c290d.tar.bz2 |
c: Diagnose char argument to __builtin_stdc_*
When working on __builtin_stdc_rotate_*, I've noticed that while the
second argument to those is explicitly allowed to have char type,
the first argument to all the stdc_* type-generic functions is
- standard unsigned integer type, excluding bool;
- extended unsigned integer type;
- or, bit-precise unsigned integer type whose width matches a standard
or extended integer type, excluding bool.
but the __builtin_stdc_* lowering code was diagnosing just
!INTEGRAL_TYPE_P
ENUMERAL_TYPE
BOOLEAN_TYPE
!TYPE_UNSIGNED
Now, with -funsigned-char plain char type is TYPE_UNSIGNED, yet it isn't
allowed because it isn't standard unsigned integer type, nor
extended unsigned integer type, nor bit-precise unsigned integer type.
The following patch diagnoses char arguments and adds testsuite coverage
for that.
Or should I make it a pedwarn instead?
2024-10-30 Jakub Jelinek <jakub@redhat.com>
gcc/c/
* c-parser.cc (c_parser_postfix_expression): Diagnose if
first __builtin_stdc_* argument has char type even when
-funsigned-char.
gcc/testsuite/
* gcc.dg/builtin-stdc-bit-3.c: New test.
* gcc.dg/builtin-stdc-rotate-3.c: New test.
Diffstat (limited to 'gcc/tree-vectorizer.h')
0 files changed, 0 insertions, 0 deletions