Go to file
Jakub Jelinek f76ae4369c C _BitInt incremental fixes [PR102989]
On Wed, Aug 09, 2023 at 09:17:57PM +0000, Joseph Myers wrote:
> > - _Complex _BitInt(N) isn't supported; again mainly because none of the psABIs
> >   mention how those should be passed/returned; in a limited way they are
> >   supported internally because the internal functions into which
> >   __builtin_{add,sub,mul}_overflow{,_p} is lowered return COMPLEX_TYPE as a
> >   hack to return 2 values without using references/pointers
>
> What happens when the usual arithmetic conversions are applied to
> operands, one of which is a complex integer type and the other of which is
> a wider _BitInt type?  I don't see anything in the code to disallow this
> case (which would produce an expression with a _Complex _BitInt type), or
> any testcases for it.

I've added a sorry for that case (+ return the narrower COMPLEX_TYPE).
Also added testcase to verify we don't create VECTOR_TYPEs of BITINT_TYPE
even if they have mode precision and suitable size (others were rejected
already before).

> Other testcases I think should be present (along with any corresponding
> changes needed to the code itself):
>
> * Verifying that the new integer constant suffix is rejected for C++.

Done.

> * Verifying appropriate pedwarn-if-pedantic for the new constant suffix
> for versions of C before C2x (and probably for use of _BitInt type
> specifiers before C2x as well) - along with the expected -Wc11-c2x-compat
> handling (in C2x mode) / -pedantic -Wno-c11-c2x-compat in older modes.

Done.

Here is an incremental patch which does that.

2023-09-06  Jakub Jelinek  <jakub@redhat.com>

	PR c/102989
gcc/c/
	* c-decl.cc (finish_declspecs): Emit pedwarn_c11 on _BitInt.
	* c-typeck.cc (c_common_type): Emit sorry for common type between
	_Complex integer and larger _BitInt and return the _Complex integer.
gcc/c-family/
	* c-attribs.cc (type_valid_for_vector_size): Reject vector types
	with BITINT_TYPE elements even if they have mode precision and
	suitable size.
gcc/testsuite/
	* gcc.dg/bitint-19.c: New test.
	* gcc.dg/bitint-20.c: New test.
	* gcc.dg/bitint-21.c: New test.
	* gcc.dg/bitint-22.c: New test.
	* gcc.dg/bitint-23.c: New test.
	* gcc.dg/bitint-24.c: New test.
	* gcc.dg/bitint-25.c: New test.
	* gcc.dg/bitint-26.c: New test.
	* gcc.dg/bitint-27.c: New test.
	* g++.dg/ext/bitint1.C: New test.
	* g++.dg/ext/bitint2.C: New test.
	* g++.dg/ext/bitint3.C: New test.
	* g++.dg/ext/bitint4.C: New test.
libcpp/
	* expr.cc (cpp_classify_number): Diagnose wb literal suffixes
	for -pedantic* before C2X or -Wc11-c2x-compat.
2023-09-06 17:39:15 +02:00
c++tools
config
contrib Daily bump. 2023-09-05 13:34:14 +00:00
fixincludes
gcc C _BitInt incremental fixes [PR102989] 2023-09-06 17:39:15 +02:00
gnattools
gotools
include
INSTALL
intl
libada
libatomic
libbacktrace
libcc1
libcody
libcpp C _BitInt incremental fixes [PR102989] 2023-09-06 17:39:15 +02:00
libdecnumber
libffi
libgcc libgcc _BitInt support [PR102989] 2023-09-06 17:33:05 +02:00
libgfortran
libgm2
libgo
libgomp Daily bump. 2023-09-05 13:34:14 +00:00
libiberty
libitm
libobjc
libphobos
libquadmath
libsanitizer
libssp
libstdc++-v3 Daily bump. 2023-09-05 13:34:14 +00:00
libvtv
lto-plugin
maintainer-scripts
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2023-09-05 13:34:14 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS
Makefile.def
Makefile.in
Makefile.tpl
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.