Commit Graph

197944 Commits

Author SHA1 Message Date
Rainer Orth 85b45cccdf libsanitizer: Fix asan SEGVs with gld on Solaris
When using GNU ld on Solaris, a large number of asan tests SEGV, while
Solaris ld is fine.  This happens inside the __tls_get_addr interceptor,
which is highly glibc-specific.  Therefore this patch disables that
interceptor.

Posted upstream at https://reviews.llvm.org/D141385.

Tested on i386-pc-solaris2.11 and sparc-sun-solaris2.11.

2023-01-17  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libsanitizer:
	* sanitizer_common/sanitizer_platform_interceptors.h: Cherry-pick
	llvm-project revision 951cf656b2faaf6fc0baa867293c0cb0ab131951.
2023-01-17 10:56:20 +01:00
GCC Administrator f457a62e63 Daily bump. 2023-01-17 00:18:06 +00:00
Andrew Pinski 35627c5fb6 Remove reference to Solaris 9 in comment of add_options_for_tls
Since r5-172-gd9f069ab4f6450, the code no longer matches the
comment as the code for Solaris 9 support was removed.
This just updates the comment to reference AIX only as
the code does.

Committed as obvious.

gcc/testsuite/ChangeLog:

	* lib/target-supports.exp (add_options_for_tls): Remove
	reference to Solaris 9 in comments.
2023-01-16 23:57:20 +00:00
Joseph Myers 8ed40069e7 Add cpplib ka.po
* ka.po: New.
2023-01-16 22:43:24 +00:00
H.J. Lu a396a12359 x86: Disable -mforce-indirect-call for PIC in 32-bit mode
-mforce-indirect-call generates invalid instruction in 32-bit MI thunk
since there are no available scratch registers in 32-bit PIC mode.
Disable -mforce-indirect-call for PIC in 32-bit mode when generating
MI thunk.

gcc/

	PR target/105980
	* config/i386/i386.cc (x86_output_mi_thunk): Disable
	-mforce-indirect-call for PIC in 32-bit mode.

gcc/testsuite/

	PR target/105980
	* g++.target/i386/pr105980.C: New test.
2023-01-16 14:11:12 -08:00
Gaius Mulley 2bf9bbfe5b Remove YEAR const from mcOptions.mod and use result from time
This patch removes the hard coded constant YEAR and replaces
its use by a call to a new procedure function getYear.
It also emits a GPL v3 boilerplate.

gcc/m2/ChangeLog:

	* mc-boot-ch/Glibc.c (libc_time): New function.
	(libc_localtime): New function.
	* mc-boot/GDynamicStrings.c: Regenerate.
	* mc-boot/GFIO.c: Regenerate.
	* mc-boot/GFormatStrings.c: Regenerate.
	* mc-boot/GIndexing.c: Regenerate.
	* mc-boot/GM2Dependent.c: Regenerate.
	* mc-boot/GM2EXCEPTION.c: Regenerate.
	* mc-boot/GPushBackInput.c: Regenerate.
	* mc-boot/GRTExceptions.c: Regenerate.
	* mc-boot/GRTint.c: Regenerate.
	* mc-boot/GStdIO.c: Regenerate.
	* mc-boot/GStringConvert.c: Regenerate.
	* mc-boot/GSysStorage.c: Regenerate.
	* mc-boot/Gdecl.c: Regenerate.
	* mc-boot/GmcComment.c: Regenerate.
	* mc-boot/GmcComp.c: Regenerate.
	* mc-boot/GmcDebug.c: Regenerate.
	* mc-boot/GmcMetaError.c: Regenerate.
	* mc-boot/GmcOptions.c: Regenerate.
	* mc-boot/GmcStack.c: Regenerate.
	* mc-boot/GnameKey.c: Regenerate.
	* mc-boot/GsymbolKey.c: Regenerate.
	* mc-boot/Gkeyc.c: Regenerate.
	* mc/decl.mod (putFieldRecord): Change NulName to NulKey
	and fix type comparision.
	* mc/mcOptions.mod (YEAR): Remove.
	(getYear): New procedure function.
	(displayVersion): Use result from getYear instead of YEAR.
	Emit boilerplate for GPL v3.
	(gplBody): Use result from getYear instead of YEAR.
	(glplBody): Use result from getYear instead of YEAR.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-01-16 18:45:52 +00:00
Gaius Mulley a0c595386f Detect errors when dereferencing an undeclared variable.
Attempting to dereference an undeclared variable will cause an ICE.
Also attempting to pass an undeclared variable as an array of type
will also cause an ICE.  This patch detects both conditions and
generates an appropriate error.

gcc/m2/ChangeLog:

	* gm2-compiler/M2Quads.mod (AssignUnboundedVar): Check Type
	against NulSym and call MetaErrorT1 if necessary.
	(AssignUnboundedNonVar): Check Type against NulSym and
	call MetaErrorT1 if necessary.
	(BuildDesignatorPointer): Check Type1 against NulSym and
	call MetaErrorT1 if necessary.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-01-16 18:09:04 +00:00
Jan Hubicka b1f30bf42d Fix wrong code issues with ipa-sra
Fix wrong code issues in ipa-sra where we are trying to prove that on every
execution of a given function a call to other function will happen.  The code
uses post dominators and makes a wrong query (which passes only for first BB in
function). Hoever post-dominators are only valid if fake edges for every
possible reason for fuction execution to terminate are added.

Fixing this using postdominators is somewhat costy since one needs to walk
whole body and add a lot of fake edges. I ended up implementing a special
purpose function for this which is also useful in ipa-modref and other places
that does similar analysis.  One does not need to modify CFG to use it and
moreover for complex functions it usually stops on first unanalyzed function
call and ends up being relatively cheap.

Bootstrapped/regtested x86_64-linux, plan to commit it shortly.

gcc/ChangeLog:

2023-01-16  Jan Hubicka  <hubicka@ucw.cz>

	PR ipa/106077
	* ipa-modref.cc (modref_access_analysis::analyze): Use
	find_always_executed_bbs.
	* ipa-sra.cc (process_scan_results): Likewise.
	* ipa-utils.cc (stmt_may_terminate_function_p): New function.
	(find_always_executed_bbs): New function.
	* ipa-utils.h (stmt_may_terminate_function_p): Declare.
	(find_always_executed_bbs): Declare.

gcc/testsuite/ChangeLog:

2023-01-16  Jan Hubicka  <hubicka@ucw.cz>

	* g++.dg/tree-ssa/pr106077.C: New test.
2023-01-16 18:14:45 +01:00
Jonathan Wakely d694a3d575 libstdc++: Fix --with-default-libstdcxx-abi=gcc4-compatible build
When building src/c++20/tzdb.cc we currently get a build error for
--with-default-libstdcxx-abi=gcc4-compatible because std::chrono::tzdb
and related types are not declared for the gcc4-compatible ABI (unless
--disable-libstdcxx-dual-abi is also used, so that the gcc4-compatible
ABI is the only one built).

Define _GLIBCXX_USE_CXX11_ABI in tzdb.cc so that for a dual-abi build we
always build it for the cxx11 ABI.

libstdc++-v3/ChangeLog:

	* src/c++20/tzdb.cc (_GLIBCXX_USE_CXX11_ABI): Define to 1.
2023-01-16 16:09:42 +00:00
Marc Poulhiès b22634281f ada: Update copyright years.
gcc/ada/

	* gcc-interface/Make-lang.in: Update copyright years.
	* gcc-interface/Makefile.in: Likewise.
	* gcc-interface/ada-builtin-types.def: Likewise.
	* gcc-interface/ada-builtins.def: Likewise.
	* gcc-interface/ada-tree.def: Likewise.
	* gcc-interface/ada-tree.h: Likewise.
	* gcc-interface/ada.h: Likewise.
	* gcc-interface/config-lang.in: Likewise.
	* gcc-interface/cuintp.cc: Likewise.
	* gcc-interface/decl.cc: Likewise.
	* gcc-interface/gadaint.h: Likewise.
	* gcc-interface/gigi.h: Likewise.
	* gcc-interface/lang-specs.h: Likewise.
	* gcc-interface/lang.opt: Likewise.
	* gcc-interface/misc.cc: Likewise.
	* gcc-interface/system.ads: Likewise.
	* gcc-interface/targtyps.cc: Likewise.
	* gcc-interface/trans.cc: Likewise.
	* gcc-interface/utils.cc: Likewise.
	* gcc-interface/utils2.cc: Likewise.
2023-01-16 15:44:55 +01:00
Eric Botcazou fe67b75f59 ada: Fix typo in comment
gcc/ada/

	* exp_ch3.adb (Make_Allocator_For_Return): Fix typo in comment.
2023-01-16 15:44:55 +01:00
Eric Botcazou 9cfa7d7e3c ada: Fix latent bug exposed by recent work on extended return statements
When the type of the return object is a constrained array, there may be an
implicit sliding that needs to be preserved during the expansion.

gcc/ada/

	* exp_ch3.adb (Make_Allocator_For_Return): Convert the expression
	to the return object's type in the constrained array case as well.
2023-01-16 15:44:55 +01:00
Eric Botcazou 3b4c6e6771 ada: Fix pessimization of some CW objects initialized with function call
The recent removal of the unconditional call to Remove_Side_Effects on the
expression of an object declaration or an allocator with a class-wide type
has introduced a pessimization in the former case for function calls that
return a specific tagged type, because the object ultimately created on the
primary stack has changed from being of a specific tagged type to being of
the class-wide type, the latter type always formally requiring finalization.

With the current finalization machinery, this means that a dispatching call
to the Deep_Finalize routine is generated, which is unnecessary.  Although
this is a generic finalization issue with class-wide objects, this restores
the previous behavior in this case to fix the pessimization for now.

gcc/ada/

	* exp_ch3.adb (Expand_N_Object_Declaration): For a class-wide non-
	interface stand-alone object initialized by a function call, call
	Remove_Side_Effects on the expression to capture the result.
2023-01-16 15:44:55 +01:00
Eric Botcazou 39a7b60338 ada: Use static references to tag in more cases for interface objects
This extends the use of static references to the interface tag in more cases
for (class-wide) interface objects, e.g. for initialization expressions that
are qualified aggregates or nondispatching calls returning a specific tagged
type implementing the interface.

gcc/ada/

	* exp_util.ads (Has_Tag_Of_Type): Declare.
	* exp_util.adb (Has_Tag_Of_Type): Move to package level.  Recurse on
	qualified expressions.
	* exp_ch3.adb (Expand_N_Object_Declaration): Use a static reference
	to the interface tag in more cases for class-wide interface objects.
2023-01-16 15:44:55 +01:00
Eric Botcazou b7ed6c43a8 ada: Fix benign pasto in new predicate
gcc/ada/

	* exp_util.adb (Make_CW_Equivalent_Type.Has_Tag_Of_Type): Fix pasto.
2023-01-16 15:44:55 +01:00
Eric Botcazou 00fdfe9de2 ada: Fix premature finalization of temporaries for interface objects
This restores the proper finalization of temporaries for interface objects
in the case where the initializing expression is not of an interface type.

It turns out that neither Is_Temporary_For_Interface_Object nor its previous
incarnation are sufficient to catch all the various cases, so it is replaced
by a small enhancement to Is_Aliased, which is more robust.

gcc/ada/

	* exp_util.adb (Is_Temporary_For_Interface_Object): Delete.
	(Is_Finalizable_Transient.Is_Aliased): Deal with the specific case
	of temporaries generated for interface objects.
2023-01-16 15:44:55 +01:00
Eric Botcazou 1f038e845b ada: Further optimize interface objects initialized with function calls
This further optimizes the usual case of (class-wide) interface objects that
are initialized with calls to functions whose result type is the type of the
objects (this is not necessary as any result type implementing the interface
would do) by avoiding a back-and-forth displacement of the objects' address.

This exposed a latent issue whereby the displacement was missing in the case
of a simple return statement whose expression is a call to a function whose
result type is a specific tagged type that needs finalization.

And, in order to avoid pessimizing the expanded code, this in turn required
avoiding to create temporaries for allocators by calling Remove_Side_Effects
up front, in the common cases when they are not necessary.

gcc/ada/

	* exp_ch3.adb (Expand_N_Object_Declaration): Do not generate a back-
	and-forth displacement of the object's address when using a renaming
	for an interface object with an expression of the same type.
	* exp_ch4.adb (Expand_Allocator_Expression): Do not remove the side
	effects of the expression up front for the simple allocators. Do not
	call the Adjust primitive if the expression is a function call.
	* exp_ch6.adb (Expand_Ctrl_Function_Call): Do not expand the call
	unnecessarily for a special return object.
	(Expand_Simple_Function_Return): Restore the displacement of the
	return object's address in the case where the expression is the call
	to a function whose result type is a type that needs finalization.
	* exp_util.adb (Expand_Subtype_From_Expr): Do not remove the side
	effects of the expression before calling Make_Subtype_From_Expr.
	(Make_CW_Equivalent_Type): If the expression has the tag of its type
	and this type has a uniform size, use 'Object_Size of this type in
	lieu of 'Size of the expression to compute the expression's size.
2023-01-16 15:44:54 +01:00
Eric Botcazou e59cd0db82 ada: Put back conversion to interface in more cases
This needs to be done for all expressions with class-wide type.

gcc/ada/

	* exp_ch3.adb (Make_Allocator_For_Return): Put back an interface
	conversion for expressions with non-interface class-wide type.
2023-01-16 15:44:54 +01:00
Eric Botcazou 24993939b7 ada: Lift restriction on optimization of aliased objects
It turns out that the only blocking case is an aliased object whose nominal
subtype is an unconstrained array because the bounds must be allocated.

gcc/ada/

	* exp_ch3.adb (Expand_N_Object_Declaration): Also optimize aliased
	objects if their nominal subtype is not an unconstrained array.
2023-01-16 15:44:54 +01:00
Eric Botcazou 8daf80ff0e ada: Optimize interface objects initialized with function calls
This optimizes the implementation of (class-wide) interface objects that are
initialized with function calls, by avoiding an unnecessary copy operation.
This also removes useless access checks generated by the expansion of return
statements involving class-wide types.

gcc/ada/

	* exp_ch3.adb (Expand_N_Object_Declaration): Factor out conditions
	needed for an initializating expression that is a function call to
	be renamable into the Is_Renamable_Function_Call predicate.
	Use it to implement the renaming in the case of class-wide interface
	objects.  Remove an interface conversion on all paths, separate and
	optimize the renaming path in the special expansion for interfaces.
	(Is_Renamable_Function_Call): New predicate.
	(Make_Allocator_For_Return): Put back an interface conversion.
	* exp_ch6.adb (Apply_CW_Accessibility_Check): Remove useless access
	checks on RE_Tag_Ptr.
2023-01-16 15:44:54 +01:00
Jan Hubicka 967592488c Disable gather/scatter for zen4
this patch adds more tunes for zen4:
 - new tunes for avx512 scater instructions.
   In micro benchmarks these seems consistent loss compared to open-coded coe
 - disable use of gather for zen4
   While these are win for a micro benchmarks (based on TSVC), enabling gather
   is a loss for parest. So for now it seems safe to keep it off.
 - disable pass to avoid FMA chains for znver4 since fmadd was optimized and does not seem
   to cause regressions.

	* config/i386/i386.cc (ix86_vectorize_builtin_scatter): Guard scatter
	by TARGET_USE_SCATTER.
	* config/i386/i386.h (TARGET_USE_SCATTER_2PARTS,
	TARGET_USE_SCATTER_4PARTS, TARGET_USE_SCATTER): New macros.
	* config/i386/x86-tune.def (TARGET_USE_SCATTER_2PARTS,
	TARGET_USE_SCATTER_4PARTS, TARGET_USE_SCATTER): New tunes.
	(X86_TUNE_AVOID_256FMA_CHAINS, X86_TUNE_AVOID_512FMA_CHAINS): Disable
	for znver4.  (X86_TUNE_USE_GATHER): Disable for zen4.
2023-01-16 15:40:45 +01:00
Richard Biener 6347bbec3e solaris2: Don't add crtfastmath.o for -shared
Don't add crtfastmath.o for -shared to avoid altering the FP
environment when loading a shared library.

	PR target/55522
	* config/sol2.h (ENDFILE_SPEC): Don't add crtfastmath.o for -shared.
2023-01-16 14:30:55 +01:00
Stam Markianos-Wright 8a1360e72d arm: Split up MVE _Generic associations to prevent type clashes [PR107515]
With these previous patches:
https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606586.html
https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606587.html
we enabled the MVE overloaded _Generic associations to handle more
scalar types, however at PR 107515 we found a new regression that
wasn't detected in our testing:

With glibc's posix/types.h:
```
typedef signed int __int32_t;
...
typedef __int32_t int32_t;
```
We would get a `error: '_Generic' specifies two compatible types`
from `__ARM_mve_coerce3` because of `type: param`, when `type` is
`int` and `int32_t: param` both being the same under the hood.

The same did not happen with Newlib's header sys/_stdint.h:
```
typedef long int __int32_t;
...
typedef __int32_t int32_t ;
```
which worked fine, because it uses `long int`.

The same could feasibly happen in `__ARM_mve_coerce2` between
`__fp16` and `float16_t`.

The solution here is to break the _Generic down so that the similar
types don't appear at the same level, as is done in `__ARM_mve_typeid`

gcc/ChangeLog:
	PR target/96795
	PR target/107515
	* config/arm/arm_mve.h (__ARM_mve_coerce2): Split types.
	(__ARM_mve_coerce3): Likewise.

gcc/testsuite/ChangeLog:
	PR target/96795
	PR target/107515
	* gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-fp.c: New test.
	* gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c: New test.
2023-01-16 12:03:42 +00:00
Richard Biener 2f81164255 Bump BASE-VER to 13.0.1 now that we are in stage4.
* BASE-VER: Bump to 13.0.1.
2023-01-16 12:44:25 +01:00
Gaius Mulley 101c16b8fb Update gcc/m2/mc/mcOptions.mod copyright and dates
Annual update of dates.  Also change the GPL boilerplate
emitted to GPL v3.

gcc/m2/ChangeLog:

	* mc/mcOptions.mod (displayVersion): Change GPLv2 to GPLv3.
	(YEAR) set to 2023.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-01-16 11:33:25 +00:00
Jakub Jelinek 83ffe9cde7 Update copyright years. 2023-01-16 11:52:17 +01:00
Andrew Carlotti a31becca48 Allow build_popcount_expr to use an IFN
gcc/ChangeLog:

	* tree-ssa-loop-niter.cc (build_popcount_expr): Add IFN support.

gcc/testsuite/ChangeLog:

	* g++.dg/tree-ssa/pr86544.C: Add .POPCOUNT to tree scan regex.
	* gcc.dg/tree-ssa/popcount.c: Likewise.
	* gcc.dg/tree-ssa/popcount2.c: Likewise.
	* gcc.dg/tree-ssa/popcount3.c: Likewise.
	* gcc.target/aarch64/popcount4.c: Likewise.
	* gcc.target/i386/pr95771.c: Likewise, and...
	* gcc.target/i386/pr95771-2.c: ...split int128 test from above,
	since this would emit just a single IFN if a TI optab is added.
2023-01-16 10:40:52 +00:00
Andrew Carlotti 4798080d4a Add c[lt]z idiom recognition
This recognises the patterns of the form:
  while (n & 1) { n >>= 1 }

Unfortunately there are currently two issues relating to this patch.

Firstly, simplify_using_initial_conditions does not recognise that
	(n != 0) and ((n & 1) == 0) implies that ((n >> 1) != 0).

This preconditions arise following the loop copy-header pass, and the
assumptions returned by number_of_iterations_exit_assumptions then
prevent final value replacement from using the niter result.

I'm not sure what is the best way to fix this - one approach could be to
modify simplify_using_initial_conditions to handle this sort of case,
but it seems that it basically wants the information that ranger could
give anway, so would something like that be a better option?

The second issue arises in the vectoriser, which is able to determine
that the niter->assumptions are always true.
When building with -march=armv8.4-a+sve -S -O3, we get this codegen:

foo (unsigned int b) {
    int c = 0;

    if (b == 0)
      return PREC;

    while (!(b & (1 << (PREC - 1)))) {
        b <<= 1;
        c++;
    }

    return c;
}

foo:
.LFB0:
        .cfi_startproc
        cmp     w0, 0
        cbz     w0, .L6
        blt     .L7
        lsl     w1, w0, 1
        clz     w2, w1
        cmp     w2, 14
        bls     .L8
        mov     x0, 0
        cntw    x3
        add     w1, w2, 1
        index   z1.s, #0, #1
        whilelo p0.s, wzr, w1
.L4:
        add     x0, x0, x3
        mov     p1.b, p0.b
        mov     z0.d, z1.d
        whilelo p0.s, w0, w1
        incw    z1.s
        b.any   .L4
        add     z0.s, z0.s, #1
        lastb   w0, p1, z0.s
        ret
        .p2align 2,,3
.L8:
        mov     w0, 0
        b       .L3
        .p2align 2,,3
.L13:
        lsl     w1, w1, 1
.L3:
        add     w0, w0, 1
        tbz     w1, #31, .L13
        ret
        .p2align 2,,3
.L6:
        mov     w0, 32
        ret
        .p2align 2,,3
.L7:
        mov     w0, 0
        ret
        .cfi_endproc

In essence, the vectoriser uses the niter information to determine
exactly how many iterations of the loop it needs to run. It then uses
SVE whilelo instructions to run this number of iterations. The original
loop counter is also vectorised, despite only being used in the final
iteration, and then the final value of this counter is used as the
return value (which is the same as the number of iterations it computed
in the first place).

This vectorisation is obviously bad, and I think it exposes a latent
bug in the vectoriser, rather than being an issue caused by this
specific patch.

gcc/ChangeLog:

	* tree-ssa-loop-niter.cc (number_of_iterations_cltz): New.
	(number_of_iterations_bitcount): Add call to the above.
	(number_of_iterations_exit_assumptions): Add EQ_EXPR case for
	c[lt]z idiom recognition.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/cltz-max.c: New test.
	* gcc.dg/tree-ssa/clz-char.c: New test.
	* gcc.dg/tree-ssa/clz-int.c: New test.
	* gcc.dg/tree-ssa/clz-long-long.c: New test.
	* gcc.dg/tree-ssa/clz-long.c: New test.
	* gcc.dg/tree-ssa/ctz-char.c: New test.
	* gcc.dg/tree-ssa/ctz-int.c: New test.
	* gcc.dg/tree-ssa/ctz-long-long.c: New test.
	* gcc.dg/tree-ssa/ctz-long.c: New test.
2023-01-16 10:40:52 +00:00
Andrew Carlotti 0419b9b800 docs: Add popcount, clz and ctz target attributes
gcc/ChangeLog:

	* doc/sourcebuild.texi: Add missing target attributes.
2023-01-16 10:40:51 +00:00
Andrew Carlotti d347fbf774 Add cltz_complement idiom recognition
This recognises patterns of the form:
while (n) { n >>= 1 }

This patch results in improved (but still suboptimal) codegen:

foo (unsigned int b) {
    int c = 0;

    while (b) {
        b >>= 1;
        c++;
    }

    return c;
}

foo:
.LFB11:
        .cfi_startproc
        cbz     w0, .L3
        clz     w1, w0
        tst     x0, 1
        mov     w0, 32
        sub     w0, w0, w1
        csel    w0, w0, wzr, ne
        ret

The conditional is unnecessary. phiopt could recognise a redundant csel
(using cond_removal_in_builtin_zero_pattern) when one of the inputs is a
clz call, but it cannot recognise the redunancy when the input is (e.g.)
(32 - clz).

I could perhaps extend this function to recognise this pattern in a later
patch, if this is a good place to recognise more patterns.

gcc/ChangeLog:

	PR tree-optimization/94793
	* tree-scalar-evolution.cc (expression_expensive_p): Add checks
	for c[lt]z optabs.
	* tree-ssa-loop-niter.cc (build_cltz_expr): New.
	(number_of_iterations_cltz_complement): New.
	(number_of_iterations_bitcount): Add call to the above.

gcc/testsuite/ChangeLog:

	* lib/target-supports.exp (check_effective_target_clz)
	(check_effective_target_clzl, check_effective_target_clzll)
	(check_effective_target_ctz, check_effective_target_clzl)
	(check_effective_target_ctzll): New.
	* gcc.dg/tree-ssa/cltz-complement-max.c: New test.
	* gcc.dg/tree-ssa/clz-complement-char.c: New test.
	* gcc.dg/tree-ssa/clz-complement-int.c: New test.
	* gcc.dg/tree-ssa/clz-complement-long-long.c: New test.
	* gcc.dg/tree-ssa/clz-complement-long.c: New test.
	* gcc.dg/tree-ssa/ctz-complement-char.c: New test.
	* gcc.dg/tree-ssa/ctz-complement-int.c: New test.
	* gcc.dg/tree-ssa/ctz-complement-long-long.c: New test.
	* gcc.dg/tree-ssa/ctz-complement-long.c: New test.
2023-01-16 10:40:51 +00:00
Jakub Jelinek 3e087d9ab8 contrib: Yet another update-copyright.py tweak [PR108413]
Ignore __builtins.di like object.d is already ignored.

2023-01-16  Jakub Jelinek  <jakub@redhat.com>

	PR other/108413
	* update-copyright.py (LibPhobosFilter): Add __builtins.di to
	skipped files.
2023-01-16 11:38:33 +01:00
Jonathan Wakely fa16c7d899 libstdc++: Fix copyright notice to use usual form [PR108413]
libstdc++-v3/ChangeLog:

	PR libstdc++/108413
	* include/c_compatibility/stdatomic.h: Change copyright line to
	be consistent with other headers contributed under DCO terms.
	* include/std/expected: Add full stop to copyright line.
	* src/c++20/tzdb.cc: Likewise.
2023-01-16 10:31:10 +00:00
Jonathan Wakely dfc5ea6b0e doc: Fix grammar typo in description of malloc attribute
gcc/ChangeLog:

	* doc/extend.texi (Common Function Attributes): Fix grammar.
2023-01-16 10:28:54 +00:00
Jonathan Wakely 8da14bd45e libatomic: Use config/mingw/lock.c for --enable-threads=single
Without this change bootstrap fails for x86_64-w64-mingw32 with
--disable-threads=single because there is no lock.c file chosen by
libatomic's configure.

libatomic/ChangeLog:

	* configure.tgt (config_path) [target_thread_file=single]:
	Use 'mingw' config.
2023-01-16 10:28:53 +00:00
Jakub Jelinek c841bde5ac riscv: Fix up Copyright lines [PR108413]
These 2 files had incorrectly formatted Copyright lines (no space between
Copyright and (C)) which makes update-copyright.py upset.

2023-01-16  Jakub Jelinek  <jakub@redhat.com>

	PR other/108413
	* config/riscv/riscv-vsetvl.h: Add space in between Copyright and (C).
	* config/riscv/riscv-vsetvl.cc: Likewise.
2023-01-16 11:22:09 +01:00
Jakub Jelinek d1c6a352ca contrib: Partial fix for failed update-copyright --this year [PR108413]
As mentioned on IRC or in PR108413, the last update-copyright.py --this year
failed and that is why we are in a strange state where some copyrights have
been updated and others have not.
The full list of errors I got was I think:
gcc/m2/mc-boot/GmcOptions.c: unrecognised copyright: comment (f, (const char *) "Copyright (C) ''2021'' Free Software Foundation, Inc.", 53);
gcc/m2/mc-boot/GmcOptions.c: unrecognised copyright: comment (f, (const char *) "Copyright (C) ''2021'' Free Software Foundation, Inc.", 53);
gcc/testsuite/gm2/switches/pedantic-params/pass/Strings.mod: unrecognised copyright holder: Faculty of Information Technology,
gcc/testsuite/gm2/switches/pedantic-params/pass/Strings2.mod: unrecognised copyright holder: Faculty of Information Technology,
libphobos/libdruntime/__builtins.di: unrecognised copyright: * Copyright: Copyright Digital Mars 2022
libstdc++-v3/src/c++17/fast_float/fast_float.h: unrecognised copyright holder: The fast_float authors
libstdc++-v3/include/c_compatibility/stdatomic.h: unrecognised copyright holder: The GCC developers

The following patch deals with the gcc/testsuite/gm2 ones and
with the fast_float.h one, ok for trunk?

Not really sure what we should do in the GmcOptions.c case
(perhaps obfuscate it in the source somehow by splitting
the string literals into different substrings
Perhaps "Copy" "right (" "C) ''..." would do it?  Or do we want
to bump there each year (manually or by the script)?
E.g. in gcc.cc we have
      printf ("Copyright %s 2023 Free Software Foundation, Inc.\n",
              _("(C)"));
which also prints (C) nicer in Unicode if possible and is updated
by hand each year.

I have no idea about the libphobos case, we have tons of
libphobos/src/std/format/spec.d:Copyright: Copyright The D Language Foundation 2000-2013.
libphobos/src/std/random.d:Copyright: Copyright Andrei Alexandrescu 2008 - 2009, Joseph Rushton Wakeling 2012.
etc. lines and those aren't reported as errors.

And the last one is that I think for The GCC developers we should treat it
similarly like FSF and bump copyright on it.
Would
        canon_gcc = 'The GCC developers'
        self.add_package_author ('The GCC developers', canon_gcc)
        self.add_package_author ('The GCC Developers', canon_gcc)
or something similar do the trick?

2023-01-16  Jakub Jelinek  <jakub@redhat.com>

	PR other/108413
	* update-copyright.py (TestsuiteFilter): Add .mod and .rs extensions.
	(GCCCopyright): Add 'The fast_float authors' as external author.
2023-01-16 11:03:30 +01:00
Jakub Jelinek 6b0907b4fc x86: Avoid -Wuninitialized warnings on _mm*_undefined_* in C++ [PR105593]
In https://gcc.gnu.org/pipermail/gcc-patches/2023-January/609844.html
I've posted a patch to allow ignoring -Winit-self using GCC diagnostic
pragmas, such that one can mark self-initialization as intentional
disabling of -Wuninitialized warnings.

The following incremental patch uses that in the x86 intrinsic
headers.

2023-01-16  Jakub Jelinek  <jakub@redhat.com>

	PR c++/105593
gcc/
	* config/i386/xmmintrin.h (_mm_undefined_ps): Temporarily
	disable -Winit-self using pragma GCC diagnostic ignored.
	* config/i386/emmintrin.h (_mm_undefined_pd, _mm_undefined_si128):
	Likewise.
	* config/i386/avxintrin.h (_mm256_undefined_pd, _mm256_undefined_ps,
	_mm256_undefined_si256): Likewise.
	* config/i386/avx512fintrin.h (_mm512_undefined_pd,
	_mm512_undefined_ps, _mm512_undefined_epi32): Likewise.
	* config/i386/avx512fp16intrin.h (_mm_undefined_ph,
	_mm256_undefined_ph, _mm512_undefined_ph): Likewise.
gcc/testsuite/
	* g++.target/i386/pr105593.C: New test.
2023-01-16 09:41:38 +01:00
Jakub Jelinek 98b41fd404 c, c++: Allow ignoring -Winit-self through pragmas [PR105593]
As mentioned in the PR, various x86 intrinsics need to return
an uninitialized vector.  Currently they use self initialization
to avoid -Wuninitialized warnings, which works fine in C, but
doesn't work in C++ where -Winit-self is enabled in -Wall.
We don't have an attribute to mark a variable as knowingly
uninitialized (the uninitialized attribute exists but means
something else, only in the -ftrivial-auto-var-init context),
and trying to suppress either -Wuninitialized or -Winit-self
inside of the _mm_undefined_ps etc. intrinsic definitions
doesn't work, one needs to currently disable through pragmas
-Wuninitialized warning at the point where _mm_undefined_ps etc.
result is actually used, but that goes against the intent of
those intrinsics.

The -Winit-self warning option actually doesn't do any warning,
all we do is record a suppression for -Winit-self if !warn_init_self
on the decl definition and later look that up in uninit pass.

The following patch changes those !warn_init_self tests which
are true only based on the command line option setting, not based
on GCC diagnostic pragma overrides to
!warning_enabled_at (DECL_SOURCE_LOCATION (decl), OPT_Winit_self)
such that it takes them into account.

2023-01-16  Jakub Jelinek  <jakub@redhat.com>

	PR c++/105593
gcc/c/
	* c-parser.cc (c_parser_initializer): Check warning_enabled_at
	at the DECL_SOURCE_LOCATION (decl) for OPT_Winit_self instead
	of warn_init_self.
gcc/cp/
	* decl.cc (cp_finish_decl): Check warning_enabled_at
	at the DECL_SOURCE_LOCATION (decl) for OPT_Winit_self instead
	of warn_init_self.
gcc/testsuite/
	* c-c++-common/Winit-self3.c: New test.
	* c-c++-common/Winit-self4.c: New test.
	* c-c++-common/Winit-self5.c: New test.
2023-01-16 09:40:14 +01:00
Kewen Lin 074b0c03ea rs6000: Teach rs6000_opaque_type_invalid_use_p about inline asm [PR108272]
As PR108272 shows, there are some invalid uses of MMA opaque
types in inline asm statements.  This patch is to teach the
function rs6000_opaque_type_invalid_use_p for inline asm,
check and error any invalid use of MMA opaque types in input
and output operands.

	PR target/108272

gcc/ChangeLog:

	* config/rs6000/rs6000.cc (rs6000_opaque_type_invalid_use_p): Add the
	support for invalid uses in inline asm, factor out the checking and
	erroring to lambda function check_and_error_invalid_use.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/pr108272-1.c: New test.
	* gcc.target/powerpc/pr108272-2.c: New test.
	* gcc.target/powerpc/pr108272-3.c: New test.
	* gcc.target/powerpc/pr108272-4.c: New test.
2023-01-16 02:15:39 -06:00
GCC Administrator cc44e55e55 Daily bump. 2023-01-16 00:17:33 +00:00
Gerald Pfeifer b1c2182bd9 libstdc++: Move www.open-std.org in status part of manual to https
libstdc++-v3/ChangeLog:

2023-01-15  Gerald Pfeifer  <gerald@pfeifer.com>

	* doc/xml/manual/status_cxx2014.xml: Switch www.open-std.org to
	https.
	* doc/xml/manual/status_cxx2017.xml: Ditto.
	* doc/xml/manual/status_cxx2020.xml: Ditto.
	* doc/xml/manual/status_cxx2023.xml: Ditto.
	* doc/html/manual/status.html: Regenerate.
2023-01-15 23:43:06 +01:00
Jonathan Wakely 05cd79c242 libstdc++: Remove dg-xfail-run-if in std/time/tzdb_list/1.cc
Use the global override_used to tell whether the target supports the
override functionality that the test_reload and test_erase functions
rely on.

libstdc++-v3/ChangeLog:

	* testsuite/std/time/tzdb_list/1.cc: Remove dg-xfail-run-if
	and fail gracefully if defining the weak symbol doesn't work.
2023-01-15 16:45:57 +00:00
François Dumont 5c9833d878 libstdc++: [_GLIBCXX_DEBUG] Complete deadlock fix on safe iterators [PR108288]
Complete fix on all _Safe_iterator post-increment and post-decrement implementations
and on _Safe_local_iterator.

libstdc++-v3/ChangeLog:

	PR libstdc++/108288
	* include/debug/safe_iterator.h (_Safe_iterator<>::operator++(int)): Extend deadlock
	fix to other iterator category.
	(_Safe_iterator<>::operator--(int)): Likewise.
	* include/debug/safe_local_iterator.h (_Safe_local_iterator<>::operator++(int)):
	Fix deadlock.
	* testsuite/util/debug/unordered_checks.h (invalid_local_iterator_pre_increment): New.
	(invalid_local_iterator_post_increment): New.
	* testsuite/23_containers/unordered_map/debug/invalid_local_iterator_post_increment_neg.cc:
	New test.
	* testsuite/23_containers/unordered_map/debug/invalid_local_iterator_pre_increment_neg.cc:
	New test.
2023-01-15 17:05:00 +01:00
Aldy Hernandez 844190af17 [PR107608] [range-ops] Avoid folding into INF when flag_trapping_math.
As discussed in the PR, for trapping math, do not fold overflowing
operations into +-INF as doing so could elide a trap.

There is a minor adjustment to known_isinf() where it was mistakenly
returning true for an [infinity U NAN], whereas it should only return
true when the range is exclusively +INF or -INF.  This is benign, as
there were no users of known_isinf up to now.

Tested on x86-64 Linux.

I also ran the glibc testsuite (git sources) on x86-64 and this patch
fixes:

-FAIL: math/test-double-lgamma
-FAIL: math/test-double-log1p
-FAIL: math/test-float-lgamma
-FAIL: math/test-float-log1p
-FAIL: math/test-float128-catan
-FAIL: math/test-float128-catanh
-FAIL: math/test-float128-lgamma
-FAIL: math/test-float128-log
-FAIL: math/test-float128-log1p
-FAIL: math/test-float128-y0
-FAIL: math/test-float128-y1
-FAIL: math/test-float32-lgamma
-FAIL: math/test-float32-log1p
-FAIL: math/test-float32x-lgamma
-FAIL: math/test-float32x-log1p
-FAIL: math/test-float64-lgamma
-FAIL: math/test-float64-log1p
-FAIL: math/test-float64x-lgamma
-FAIL: math/test-ldouble-lgamma

	PR tree-optimization/107608

gcc/ChangeLog:

	* range-op-float.cc (range_operator_float::fold_range): Avoid
	folding into INF when flag_trapping_math.
	* value-range.h (frange::known_isinf): Return false for possible NANs.
2023-01-15 16:42:56 +01:00
Jonathan Wakely 5ba715ed1a libstdc++: Remove unconditional -pthread from test options
This shouldn't be in the common options, it's already added for the
relevant targets using dg-additional-options.

libstdc++-v3/ChangeLog:

	* testsuite/30_threads/jthread/jthread.cc: Remove -pthread from
	dg-options.
2023-01-15 13:51:05 +00:00
Gerald Pfeifer b92e553558 config-list.mk: Modernize FreeBSD targets towards version 13
contrib/ChangeLog:

2023-01-15  Gerald Pfeifer  <gerald@pfeifer.com>

	* config-list.mk: Update FreeBSD targets to version 13.
	Add aarch64-freebsd13.
2023-01-15 14:38:32 +01:00
Gaius Mulley c8f2be5d43 Bugfix to allow testsuite/gm2/pim/pass/arraybool.mod to compile on ppc64le
This bug is exposed on the ppc64le platform.  The expression
parser P3Build.bnf (and PHBuild.bnf) BuiltNot omitted to record
the current token position on the quad stack.  The patch changes
all occurances of NEW to newBoolFrame to ensure that the tokenno
recorded in the bool frame is set to a sensible value.
BuildNot is fixed and improved to generate a virtual token
recording the position of the subexpression.

gcc/m2/ChangeLog:

	* gm2-compiler/M2LexBuf.mod (isSrcToken): Add block comment.
	Remove dead code.
	* gm2-compiler/M2Quads.def (BuildNot): Add notTokPos parameter.
	* gm2-compiler/M2Quads.mod (BuildNot): Add notTokPos parameter.
	Create and push virtual token.
	(PopBooltok): New procedure.
	(PushBooltok): New procedure.
	(PushBool): Re-implement using PushBooltok.
	(PopBool): Re-implement using PopBooltok.
	* gm2-compiler/P3Build.bnf (ConstFactor): Record token
	position of NOT.
	(Factor): Record token position	of NOT.
	* gm2-compiler/PHBuild.bnf (ConstFactor): Record token
	position of NOT.
	(Relation): Push token position.
	(UnaryOrConstTerm): Push token position.
	(AddOperator): Push token position.
	(MulOperator): Push token position.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-01-15 13:13:40 +00:00
Jonathan Wakely 4dc4584b60 libstdc++: Fix narrowing conversion in std/time/clock/utc/io.cc
For a port with signed char and unsigned wchar_t initializing a wchar_t
array with a char is a narrowing conversion. The code is wrong for
assuming that (int)'a' == (int)L'a' anyway, so fix it properly by using
ctype<wchar_t>::widen(char).

libstdc++-v3/ChangeLog:

	* testsuite/std/time/clock/utc/io.cc: Use ctype to widen char.
2023-01-15 12:44:23 +00:00
Xianmiao Qu e658e8157d C-SKY: Support --with-float=softfp in configuration.
Missed it before, it needs to be used when compiling non-multilib.

gcc/
	* config.gcc (csky-*-*): Support --with-float=softfp.
2023-01-15 10:04:35 +08:00
GCC Administrator 5013c3bb3e Daily bump. 2023-01-15 00:17:49 +00:00