[gcc r14-9718] Use fatal_error instead of internal_error for when ZSTD is not enabled
https://gcc.gnu.org/g:22f48d78f033922fd2fbf9252041cd97ce201052 commit r14-9718-g22f48d78f033922fd2fbf9252041cd97ce201052 Author: Andrew Pinski Date: Thu Mar 28 16:46:33 2024 -0700 Use fatal_error instead of internal_error for when ZSTD is not enabled This changes an internal error to be a fatal error for when the ZSTD is not enabled but the section was compressed as ZSTD. Committed as approved after bootstrap/test on x86_64-linux-gnu. gcc/ChangeLog: * lto-compress.cc (lto_end_uncompression): Use fatal_error instead of internal_error when ZSTD is not enabled. Signed-off-by: Andrew Pinski Diff: --- gcc/lto-compress.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/lto-compress.cc b/gcc/lto-compress.cc index c167ac967aa..bebf0277ef6 100644 --- a/gcc/lto-compress.cc +++ b/gcc/lto-compress.cc @@ -408,7 +408,7 @@ lto_end_uncompression (struct lto_compression_stream *stream, } #endif if (compression == ZSTD) -internal_error ("compiler does not support ZSTD LTO compression"); +fatal_error (UNKNOWN_LOCATION, "compiler does not support ZSTD LTO compression"); lto_uncompression_zlib (stream); }
[gcc r14-9717] testsuite: Add a test case for negating FP vectors containing zeros
https://gcc.gnu.org/g:26a723625bb63e42b8c78bbce52ba0286eefda1c commit r14-9717-g26a723625bb63e42b8c78bbce52ba0286eefda1c Author: Xi Ruoyao Date: Tue Feb 6 17:49:50 2024 +0800 testsuite: Add a test case for negating FP vectors containing zeros Recently I've fixed two wrong FP vector negate implementation which caused wrong sign bits in zeros in targets (r14-8786 and r14-8801). To prevent a similar issue from happening again, add a test case. Tested on x86_64 (with SSE2, AVX, AVX2, and AVX512F), AArch64, MIPS (with MSA), LoongArch (with LSX and LASX). gcc/testsuite: * gcc.dg/vect/vect-neg-zero.c: New test. Diff: --- gcc/testsuite/gcc.dg/vect/vect-neg-zero.c | 38 +++ 1 file changed, 38 insertions(+) diff --git a/gcc/testsuite/gcc.dg/vect/vect-neg-zero.c b/gcc/testsuite/gcc.dg/vect/vect-neg-zero.c new file mode 100644 index 000..21fa00cfa15 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-neg-zero.c @@ -0,0 +1,38 @@ +/* { dg-add-options ieee } */ +/* { dg-additional-options "-fno-associative-math -fsigned-zeros" } */ + +double x[4] = {-0.0, 0.0, -0.0, 0.0}; +float y[8] = {-0.0, 0.0, -0.0, 0.0, -0.0, -0.0, 0.0, 0.0}; + +static __attribute__ ((always_inline)) inline void +test (int factor) +{ + double a[4]; + float b[8]; + + asm ("" ::: "memory"); + + for (int i = 0; i < 2 * factor; i++) +a[i] = -x[i]; + + for (int i = 0; i < 4 * factor; i++) +b[i] = -y[i]; + +#pragma GCC novector + for (int i = 0; i < 2 * factor; i++) +if (__builtin_signbit (a[i]) == __builtin_signbit (x[i])) + __builtin_abort (); + +#pragma GCC novector + for (int i = 0; i < 4 * factor; i++) +if (__builtin_signbit (b[i]) == __builtin_signbit (y[i])) + __builtin_abort (); +} + +int +main (void) +{ + test (1); + test (2); + return 0; +}
[gcc r14-9715] [committed] Provide suitable output template for zero_extendqihi2 on H8
https://gcc.gnu.org/g:c1e66532cbb424bd7ea8c3b2c1ffea4bb5233309 commit r14-9715-gc1e66532cbb424bd7ea8c3b2c1ffea4bb5233309 Author: Jeff Law Date: Thu Mar 28 16:56:53 2024 -0600 [committed] Provide suitable output template for zero_extendqihi2 on H8 Segher's recent combine change, quite unexpectedly, triggered a regression on the H8 port. It failed to build newlib. The zero_extendqihi2 pattern provided two alternatives. One where the source and destination matched. That turns into a suitable instruction trivially. The second alternative was actually meant to capture cases where the value is coming from memory. What was missing here was the reg->reg case where the source and destination do not match. That fell into the second case which was requested to be split by the pattern's output template. The splitter had a suitable condition to make sure it only triggered in the right cases. Unfortunately with the pattern requiring a split in a case where the splitter was going to fail led to the fault. So regardless of what's going on in the combiner, this code was just wrong. Fixed thusly by providing a suitable output template for the reg->reg case. Regression tested on h8300-elf. Pushing to the trunk. gcc/ * config/h8300/extensions.md (zero_extendqihi*): Add output template for reg->reg case where the regs don't match. Diff: --- gcc/config/h8300/extensions.md | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gcc/config/h8300/extensions.md b/gcc/config/h8300/extensions.md index 7149dc0ac52..a1e8c4abd37 100644 --- a/gcc/config/h8300/extensions.md +++ b/gcc/config/h8300/extensions.md @@ -12,8 +12,8 @@ }) (define_insn_and_split "*zero_extendqihi2" - [(set (match_operand:HI 0 "register_operand" "=r,r") - (zero_extend:HI (match_operand:QI 1 "general_operand_src" "0,g>")))] + [(set (match_operand:HI 0 "register_operand" "=r,r,r") + (zero_extend:HI (match_operand:QI 1 "general_operand_src" "0,r,g>")))] "" "#" "&& reload_completed" @@ -21,14 +21,15 @@ (clobber (reg:CC CC_REG))])]) (define_insn "*zero_extendqihi2" - [(set (match_operand:HI 0 "register_operand" "=r,r") - (zero_extend:HI (match_operand:QI 1 "general_operand_src" "0,g>"))) + [(set (match_operand:HI 0 "register_operand" "=r,r,r") + (zero_extend:HI (match_operand:QI 1 "general_operand_src" "0,r,g>"))) (clobber (reg:CC CC_REG))] "" "@ extu.w %T0 + mov.b\t%X1,%R0\;extu.w\t%T0 #" - [(set_attr "length" "2,10")]) + [(set_attr "length" "2,4,10")]) ;; Split the zero extension of a general operand (actually a memory ;; operand) into a load of the operand and the actual zero extension
[gcc r14-9714] Fix failure of c-c++-common/analyzer/stdarg-pr111289-int.c on hpux
https://gcc.gnu.org/g:86b0b1bec6790f84b7a56fcef2a0a6c8cd91ffef commit r14-9714-g86b0b1bec6790f84b7a56fcef2a0a6c8cd91ffef Author: John David Anglin Date: Thu Mar 28 18:32:12 2024 + Fix failure of c-c++-common/analyzer/stdarg-pr111289-int.c on hpux 2024-03-28 John David Anglin gcc/testsuite/ChangeLog: PR analyzer/111289 * c-c++-common/analyzer/stdarg-pr111289-int.c: Don't include . Diff: --- gcc/testsuite/c-c++-common/analyzer/stdarg-pr111289-int.c | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/testsuite/c-c++-common/analyzer/stdarg-pr111289-int.c b/gcc/testsuite/c-c++-common/analyzer/stdarg-pr111289-int.c index 33d83169c3e..8faa58c9480 100644 --- a/gcc/testsuite/c-c++-common/analyzer/stdarg-pr111289-int.c +++ b/gcc/testsuite/c-c++-common/analyzer/stdarg-pr111289-int.c @@ -1,6 +1,5 @@ #include #include -#include typedef unsigned int mode_t;
[gcc r14-9713] c++: __is_constructible ref binding [PR100667]
https://gcc.gnu.org/g:8bb3ef3f6e335e8794590fb712a2661d11d21973 commit r14-9713-g8bb3ef3f6e335e8794590fb712a2661d11d21973 Author: Jason Merrill Date: Wed Mar 27 16:14:01 2024 -0400 c++: __is_constructible ref binding [PR100667] The requirement that a type argument be complete is excessive in the case of direct reference binding to the same type, which does not rely on any properties of the type. This is LWG 2939. PR c++/100667 gcc/cp/ChangeLog: * semantics.cc (same_type_ref_bind_p): New. (finish_trait_expr): Use it. gcc/testsuite/ChangeLog: * g++.dg/ext/is_constructible8.C: New test. Diff: --- gcc/cp/semantics.cc | 54 gcc/testsuite/g++.dg/ext/is_constructible8.C | 31 2 files changed, 78 insertions(+), 7 deletions(-) diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index adb1ba48d29..9838331d2a9 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -12607,6 +12607,45 @@ check_trait_type (tree type, int kind = 1) return true; } +/* True iff the conversion (if any) would be a direct reference + binding, not requiring complete types. This is LWG2939. */ + +static bool +same_type_ref_bind_p (cp_trait_kind kind, tree type1, tree type2) +{ + tree from, to; + switch (kind) +{ + /* These put the target type first. */ +case CPTK_IS_CONSTRUCTIBLE: +case CPTK_IS_NOTHROW_CONSTRUCTIBLE: +case CPTK_IS_TRIVIALLY_CONSTRUCTIBLE: +case CPTK_REF_CONSTRUCTS_FROM_TEMPORARY: +case CPTK_REF_CONVERTS_FROM_TEMPORARY: + to = type1; + from = type2; + break; + + /* These put it second. */ +case CPTK_IS_CONVERTIBLE: +case CPTK_IS_NOTHROW_CONVERTIBLE: + to = type2; + from = type1; + break; + +default: + gcc_unreachable (); +} + + if (TREE_CODE (to) != REFERENCE_TYPE || !from) +return false; + if (TREE_CODE (from) == TREE_VEC && TREE_VEC_LENGTH (from) == 1) +from = TREE_VEC_ELT (from, 0); + return (TYPE_P (from) + && (same_type_ignoring_top_level_qualifiers_p + (non_reference (to), non_reference (from; +} + /* Process a trait expression. */ tree @@ -12666,20 +12705,21 @@ finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2) return error_mark_node; break; -case CPTK_IS_ASSIGNABLE: case CPTK_IS_CONSTRUCTIBLE: - if (!check_trait_type (type1)) - return error_mark_node; - break; - case CPTK_IS_CONVERTIBLE: -case CPTK_IS_NOTHROW_ASSIGNABLE: case CPTK_IS_NOTHROW_CONSTRUCTIBLE: case CPTK_IS_NOTHROW_CONVERTIBLE: -case CPTK_IS_TRIVIALLY_ASSIGNABLE: case CPTK_IS_TRIVIALLY_CONSTRUCTIBLE: case CPTK_REF_CONSTRUCTS_FROM_TEMPORARY: case CPTK_REF_CONVERTS_FROM_TEMPORARY: + /* Don't check completeness for direct reference binding. */; + if (same_type_ref_bind_p (kind, type1, type2)) + break; + gcc_fallthrough (); + +case CPTK_IS_ASSIGNABLE: +case CPTK_IS_NOTHROW_ASSIGNABLE: +case CPTK_IS_TRIVIALLY_ASSIGNABLE: if (!check_trait_type (type1) || !check_trait_type (type2)) return error_mark_node; diff --git a/gcc/testsuite/g++.dg/ext/is_constructible8.C b/gcc/testsuite/g++.dg/ext/is_constructible8.C new file mode 100644 index 000..a27ec6eddd7 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/is_constructible8.C @@ -0,0 +1,31 @@ +// PR c++/100667 +// { dg-do compile { target c++11 } } + +struct T; + +#define SA(X) static_assert ((X), #X); + +SA (__is_constructible(T&&, T)); +SA (__is_constructible(const T&, T)); +SA (!__is_constructible(T&, T)); +SA (__is_nothrow_constructible(T&&, T)); +SA (__is_nothrow_constructible(const T&, T)); +SA (!__is_nothrow_constructible(T&, T)); +SA (__is_trivially_constructible(T&&, T)); +SA (__is_trivially_constructible(const T&, T)); +SA (!__is_trivially_constructible(T&, T)); + +SA (__is_convertible(T, T&&)); +SA (__is_convertible(T, const T&)); +SA (!__is_convertible(T, T&)); +SA (__is_nothrow_convertible(T, T&&)); +SA (__is_nothrow_convertible(T, const T&)); +SA (!__is_nothrow_convertible(T, T&)); + +// All false because either the conversion fails or it doesn't bind a temporary +SA (!__reference_constructs_from_temporary (T&&, T)); +SA (!__reference_constructs_from_temporary (const T&, T)); +SA (!__reference_constructs_from_temporary (T&, T)); +SA (!__reference_converts_from_temporary (T&&, T)); +SA (!__reference_converts_from_temporary (const T&, T)); +SA (!__reference_converts_from_temporary (T&, T));
[gcc r14-9712] Fortran: fix DATA and derived types with pointer components [PR114474]
https://gcc.gnu.org/g:bbb7c513dddc5c9b2d5e9b78bc1c2f85a0cfe07e commit r14-9712-gbbb7c513dddc5c9b2d5e9b78bc1c2f85a0cfe07e Author: Harald Anlauf Date: Wed Mar 27 21:18:04 2024 +0100 Fortran: fix DATA and derived types with pointer components [PR114474] When matching actual arguments in match_actual_arg, these are initially treated as a possible dummy procedure, assuming that the correct type is determined later. This resolution could fail when the procedure is a derived type constructor with a pointer component and appears in a DATA statement, where the pointer shall be associated with an initial data target. Check for those cases where the type obviously has not been resolved yet, and which were missed because there was no component reference. gcc/fortran/ChangeLog: PR fortran/114474 * primary.cc (gfc_variable_attr): Catch variables used in structure constructors within DATA statements that are still tagged with a temporary type BT_PROCEDURE from match_actual_arg and which have the target attribute, and fix their typespec. gcc/testsuite/ChangeLog: PR fortran/114474 * gfortran.dg/data_pointer_3.f90: New test. Diff: --- gcc/fortran/primary.cc | 12 + gcc/testsuite/gfortran.dg/data_pointer_3.f90 | 77 2 files changed, 89 insertions(+) diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc index 0ab69bb9dce..5dd6875a4a6 100644 --- a/gcc/fortran/primary.cc +++ b/gcc/fortran/primary.cc @@ -2804,6 +2804,18 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts) if (ts != NULL && expr->ts.type == BT_UNKNOWN) *ts = sym->ts; + /* Catch left-overs from match_actual_arg, where an actual argument of a + procedure is given a temporary ts.type == BT_PROCEDURE. The fixup is + needed for structure constructors in DATA statements, where a pointer + is associated with a data target, and the argument has not been fully + resolved yet. Components references are dealt with further below. */ + if (ts != NULL + && expr->ts.type == BT_PROCEDURE + && expr->ref == NULL + && attr.flavor != FL_PROCEDURE + && attr.target) +*ts = sym->ts; + has_inquiry_part = false; for (ref = expr->ref; ref; ref = ref->next) if (ref->type == REF_INQUIRY) diff --git a/gcc/testsuite/gfortran.dg/data_pointer_3.f90 b/gcc/testsuite/gfortran.dg/data_pointer_3.f90 new file mode 100644 index 000..49c288e93b9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/data_pointer_3.f90 @@ -0,0 +1,77 @@ +! { dg-do compile } +! PR fortran/114474 - DATA and derived types with pointer components + +program pr114474 + implicit none + integer, target :: ii = 42! initial data target + + integer, target :: jj = 24 + integer, pointer:: qq => jj + ! ii and jj resolve slightly differently when the data statement below + ! is reached, as jj is resolved outside the structure constructor first + + type t + integer, pointer :: h + end type t + + integer, target :: kk(7) = 23 + integer, pointer:: ll(:) => kk + + type t1 + integer :: m(7) + end type t1 + + type(t) :: x1, x2, x3, x4, x5 + type(t), parameter :: z1 = t(null()) + + type(t1), target:: tt = t1([1,2,3,4,5,6,7]) + type(t1), parameter :: vv = t1(22) + type(t1):: w1, w2 + integer, pointer :: p1(:) => tt% m + + data x1 / t(null()) / + data x2 / t(ii) / ! ii is initial data target + data x3 / t(jj) / ! jj is resolved differently... + data x4 / t(tt%m(3)) / ! pointer association with 3rd element + + data w1 / t1(12) / + data w2 / t1(vv%m) / + + if ( associated (x1% h)) stop 1 + if (.not. associated (x2% h)) stop 2 + if (.not. associated (x3% h)) stop 3 + if (.not. associated (x4% h)) stop 4 + if (x2% h /= 42) stop 5 + if (x3% h /= 24) stop 6 + if (x4% h /= 3) stop 7 + + if (any (w1%m /= 12 )) stop 8 + if (any (w2%m /= vv%m)) stop 9 +end + + +subroutine sub + implicit none + + interface + real function myfun (x) + real, intent(in) :: x + end function myfun + end interface + + type u + procedure(myfun), pointer, nopass :: p + end type u + + type(u):: u3 = u(null()) + type(u), parameter :: u4 = u(null()) + type(u):: u1, u2 + + data u1 / u(null()) / + data u2 / u(myfun) / +end + +real function myfun (x) + real, intent(in) :: x + myfun = x +end function myfun
[gcc r14-9711] RISC-V: testsuite: ensure vtype is call clobbered
https://gcc.gnu.org/g:c1424628dc95829408882f01cbf0dd61566dc312 commit r14-9711-gc1424628dc95829408882f01cbf0dd61566dc312 Author: Vineet Gupta Date: Wed Mar 27 14:55:04 2024 -0700 RISC-V: testsuite: ensure vtype is call clobbered Per classic Vector calling convention ABI, vtype is call clobbered, so ensure gcc regenerates a VSETVLI in following cases: - after a function call. - after an inline asm fragment which clobbers vtype. ATM gcc seems to be doing the right thing, but a test can never hurt. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/vtype-call-clobbered.c: New Test. Signed-off-by: Vineet Gupta Diff: --- .../gcc.target/riscv/rvv/vtype-call-clobbered.c| 47 ++ 1 file changed, 47 insertions(+) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vtype-call-clobbered.c b/gcc/testsuite/gcc.target/riscv/rvv/vtype-call-clobbered.c new file mode 100644 index 000..be9f312aa50 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vtype-call-clobbered.c @@ -0,0 +1,47 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64 -O2" } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ + +#include "riscv_vector.h" + +extern void can_clobber_vtype(); + +static inline void v_loop (void * restrict in, void * restrict out, int n) +{ + for (int i = 0; i < n; i++) +{ + vuint8mf8_t v = *(vuint8mf8_t*)(in + i); + *(vuint8mf8_t*)(out + i) = v; +} +} + +/* Two V instructions back-back. + Only 1 vsetvli insn. */ +void +vec1 (void * restrict in, void * restrict out1, void * restrict out2, int n) +{ + v_loop(in, out1, n); + v_loop(in, out2, n); +} + +/* Two V instructions seperated by a function call. + Both need to have a corresponding vsetvli insn. */ +void +vec2 (void * restrict in, void * restrict out1, void * restrict out2, int n) +{ + v_loop(in, out1, n); + can_clobber_vtype(); + v_loop(in, out2, n); +} + +/* Two V instructions seperated by an inline asm with vtype clobber. + Both need to have a corresponding vsetvli insn. */ +void +vec3 (void * restrict in, void * restrict out1, void * restrict out2, int n) +{ + v_loop(in, out1, n); + asm volatile("":::"vtype"); + v_loop(in, out2, n); +} + +/* { dg-final { scan-assembler-times {vsetvli} 5 } } */
[gcc r14-9710] PR modula2/114520 Incorrect ordering of import/export statements cause confusion
https://gcc.gnu.org/g:aeee63ffbf4f4fbc4d90d8aae808d6b67f0148a3 commit r14-9710-gaeee63ffbf4f4fbc4d90d8aae808d6b67f0148a3 Author: Gaius Mulley Date: Thu Mar 28 16:49:44 2024 + PR modula2/114520 Incorrect ordering of import/export statements cause confusion The error recovery causes misleading error messages to appear if an EXPORT and IMPORT statement are in the wrong order. This patch detects the incorrect order and issues an error message and prevents error recovery. The fix should be improved and made more general if another similar case is required. gcc/m2/ChangeLog: PR modula2/114520 * gm2-compiler/P0SyntaxCheck.bnf (DetectImport): New procedure. (EnableImportCheck): New boolean. (Expect): Call DetectImport. (Export): Set EnableImportCheck TRUE before ';' and FALSE afterwards. Signed-off-by: Gaius Mulley Diff: --- gcc/m2/gm2-compiler/P0SyntaxCheck.bnf | 31 +++ 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/gcc/m2/gm2-compiler/P0SyntaxCheck.bnf b/gcc/m2/gm2-compiler/P0SyntaxCheck.bnf index c1c86c1827d..07f861adac9 100644 --- a/gcc/m2/gm2-compiler/P0SyntaxCheck.bnf +++ b/gcc/m2/gm2-compiler/P0SyntaxCheck.bnf @@ -82,9 +82,10 @@ CONST (* giving up. *) VAR - seenError : BOOLEAN ; - LastIdent : Name ; - InsertCount: CARDINAL ; + EnableImportCheck, + seenError: BOOLEAN ; + LastIdent: Name ; + InsertCount : CARDINAL ; PROCEDURE ErrorString (s: String) ; @@ -319,6 +320,21 @@ BEGIN END PeepToken ; +(* + DetectImport - checks whether the next token is an import or from and if so + generates an error message. This is called after an export + statement to notify the user that the ordering is incorrect. +*) + +PROCEDURE DetectImport ; +BEGIN + IF (currenttoken = importtok) OR (currenttoken = fromtok) + THEN + ErrorArray ('an {%AkIMPORT} statement must preceed an {%kEXPORT} statement') + END +END DetectImport ; + + (* Expect - *) @@ -328,6 +344,10 @@ BEGIN IF currenttoken=t THEN GetToken ; + IF EnableImportCheck + THEN + DetectImport + END ; IF Pass0 THEN PeepToken (stopset0, stopset1, stopset2) @@ -347,6 +367,7 @@ END Expect ; PROCEDURE CompilationUnit () : BOOLEAN ; BEGIN seenError := FALSE ; + EnableImportCheck := FALSE ; InsertCount := 0 ; FileUnit (SetOfStop0{eoftok}, SetOfStop1{}, SetOfStop2{}) ; RETURN NOT seenError @@ -883,7 +904,9 @@ Priority := "[" ConstExpression "]" =: Export := "EXPORT" ( "QUALIFIED" IdentList | "UNQUALIFIED" IdentList | IdentList - ) ";" =: + ) % EnableImportCheck := TRUE % + ";" % EnableImportCheck := FALSE % + =: Import := "FROM" Ident "IMPORT" IdentList ";" | "IMPORT"% PushTtok (ImportTok, GetTokenNo () -1)
[gcc r13-8503] Fortran: Fix assumed length chars and len inquiry [PR103716]
https://gcc.gnu.org/g:48d23749534ca96b3f0883579b44700a17e83d15 commit r13-8503-g48d23749534ca96b3f0883579b44700a17e83d15 Author: Paul Thomas Date: Tue May 23 06:46:37 2023 +0100 Fortran: Fix assumed length chars and len inquiry [PR103716] 2023-05-23 Paul Thomas gcc/fortran PR fortran/103716 * resolve.cc (gfc_resolve_ref): Conversion of array_ref into an element should be done for all characters without a len expr, not just deferred lens, and for integer expressions. * trans-expr.cc (conv_inquiry): For len and kind inquiry refs, set the se string_length to NULL_TREE. gcc/testsuite/ PR fortran/103716 * gfortran.dg/pr103716.f90 : New test. (cherry picked from commit 842a432b02238361ecc601d301ac400a7f30f4fa) Diff: --- gcc/fortran/resolve.cc | 4 +++- gcc/fortran/trans-expr.cc | 2 ++ gcc/testsuite/gfortran.dg/pr103716.f90 | 15 +++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 4475c864277..e12997bc4a0 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -5526,7 +5526,9 @@ gfc_resolve_ref (gfc_expr *expr) case REF_INQUIRY: /* Implement requirement in note 9.7 of F2018 that the result of the LEN inquiry be a scalar. */ - if (ref->u.i == INQUIRY_LEN && array_ref && expr->ts.deferred) + if (ref->u.i == INQUIRY_LEN && array_ref + && ((expr->ts.type == BT_CHARACTER && !expr->ts.u.cl->length) + || expr->ts.type == BT_INTEGER)) { array_ref->u.ar.type = AR_ELEMENT; expr->rank = 0; diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index 316ad684a64..3f3f0123dc3 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -2875,11 +2875,13 @@ conv_inquiry (gfc_se * se, gfc_ref * ref, gfc_expr *expr, gfc_typespec *ts) case INQUIRY_KIND: res = build_int_cst (gfc_typenode_for_spec (&expr->ts), ts->kind); + se->string_length = NULL_TREE; break; case INQUIRY_LEN: res = fold_convert (gfc_typenode_for_spec (&expr->ts), se->string_length); + se->string_length = NULL_TREE; break; default: diff --git a/gcc/testsuite/gfortran.dg/pr103716.f90 b/gcc/testsuite/gfortran.dg/pr103716.f90 new file mode 100644 index 000..4f78900839e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr103716.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! +! The gimplifier used to throw a fit on thes two functions. +! +! Contributed by Gerhard Steinmetz +! +function f1(x) + character(*) :: x(*) + print *, g(x%len) +end + +function f2(x) + character(*) :: x(3) + print *, g(x%len) +end
[gcc r14-9709] PR modula2/114517 gm2 does not allow comparison operator hash in column one
https://gcc.gnu.org/g:04799f03e8d01b903295ef3a100a0117b7ddbf5e commit r14-9709-g04799f03e8d01b903295ef3a100a0117b7ddbf5e Author: Gaius Mulley <(no_default)> Date: Thu Mar 28 14:57:49 2024 + PR modula2/114517 gm2 does not allow comparison operator hash in column one This patch allows -fno-cpp to be supplied to gm2. Without this patch it causes an ICE. The patch allows -fno-cpp to turn off cpp flags. These are tested in m2.flex to decide whether a change of state is allowed (enabling handling of #line directives). gcc/ChangeLog: PR modula2/114517 * doc/gm2.texi: Mention gm2 treats a # in the first column as a preprocessor directive unless -fno-cpp is supplied. gcc/m2/ChangeLog: PR modula2/114517 * gm2-compiler/M2Options.def (SetCpp): Add comment. (GetCpp): Move after SetCpp. (GetLineDirectives): New procedure function. * gm2-compiler/M2Options.mod (GetLineDirectives): New procedure function. * gm2-gcc/m2options.h (M2Options_GetLineDirectives): New prototype. * gm2-lang.cc (gm2_langhook_init_options): OPT_fcpp only assert if !value. * m2.flex: Test GetLineDirectives before changing to LINE0 state. gcc/testsuite/ChangeLog: PR modula2/114517 * gm2/cpp/fail/hashfirstcolumn2.mod: New test. * gm2/imports/fail/imports-fail.exp: New test. * gm2/imports/fail/localmodule2.mod: New test. * gm2/imports/run/pass/localmodule.mod: New test. Signed-off-by: Gaius Mulley <(no_default)> Diff: --- gcc/doc/gm2.texi | 3 +- gcc/m2/gm2-compiler/M2Options.def | 36 +- gcc/m2/gm2-compiler/M2Options.mod | 10 ++ gcc/m2/gm2-gcc/m2options.h | 1 + gcc/m2/gm2-lang.cc | 3 +- gcc/m2/m2.flex | 10 -- gcc/testsuite/gm2/cpp/fail/hashfirstcolumn2.mod| 18 +++ gcc/testsuite/gm2/imports/fail/imports-fail.exp| 36 ++ gcc/testsuite/gm2/imports/fail/localmodule2.mod| 27 gcc/testsuite/gm2/imports/run/pass/localmodule.mod | 27 10 files changed, 153 insertions(+), 18 deletions(-) diff --git a/gcc/doc/gm2.texi b/gcc/doc/gm2.texi index 028a0715f64..9f6d4140e42 100644 --- a/gcc/doc/gm2.texi +++ b/gcc/doc/gm2.texi @@ -1657,7 +1657,8 @@ The preprocessor @samp{cpp} can be invoked via the @samp{-fcpp} command line option. This in turn invokes @samp{cpp} with the following arguments @samp{-traditional -lang-asm}. These options preserve comments and all quotations. @samp{gm2} treats a @samp{#} -character in the first column as a preprocessor directive. +character in the first column as a preprocessor directive unless +@samp{-fno-cpp} is supplied. For example here is a module which calls @code{FatalError} via the macro @code{ERROR}. diff --git a/gcc/m2/gm2-compiler/M2Options.def b/gcc/m2/gm2-compiler/M2Options.def index 90b5178f88a..e4ebf41802f 100644 --- a/gcc/m2/gm2-compiler/M2Options.def +++ b/gcc/m2/gm2-compiler/M2Options.def @@ -328,6 +328,28 @@ PROCEDURE SetObj (arg: ADDRESS) ; PROCEDURE GetObj () : ADDRESS ; +(* + SetCpp - enables the source to be preprocessed and enables the +recognition of C preprocessor line directives. +*) + +PROCEDURE SetCpp (value: BOOLEAN) : BOOLEAN ; + + +(* + GetCpp - returns TRUE if the C preprocessor was used. +*) + +PROCEDURE GetCpp () : BOOLEAN ; + + +(* + GetLineDirectives - returns TRUE if line directives are allowed. +*) + +PROCEDURE GetLineDirectives () : BOOLEAN ; + + (* SetScaffoldDynamic - set the -fscaffold-dynamic flag. *) @@ -467,20 +489,6 @@ PROCEDURE SetQuiet (value: BOOLEAN) : BOOLEAN ; PROCEDURE SetCC1Quiet (value: BOOLEAN) ; -(* - SetCpp - -*) - -PROCEDURE SetCpp (value: BOOLEAN) : BOOLEAN ; - - -(* - GetCpp - returns TRUE if the C preprocessor was used. -*) - -PROCEDURE GetCpp () : BOOLEAN ; - - (* SetM2g - set the -fm2-g flag. *) diff --git a/gcc/m2/gm2-compiler/M2Options.mod b/gcc/m2/gm2-compiler/M2Options.mod index 30203158e5c..b0de8cdfe82 100644 --- a/gcc/m2/gm2-compiler/M2Options.mod +++ b/gcc/m2/gm2-compiler/M2Options.mod @@ -672,6 +672,16 @@ BEGIN END GetCpp ; +(* + GetLineDirectives - returns TRUE if line directives are allowed. +*) + +PROCEDURE GetLineDirectives () : BOOLEAN ; +BEGIN + RETURN LineDirectives +END GetLineDirectives ; + + (* SetPPOnly - set the PPonly (preprocess only) to value. *) diff --git a/gcc/m2/gm2-gcc/m2options.h b/gcc/m2/gm2-gcc/m2options.h index a03fdc5975f..4b3a23f18db 100644 --- a/gcc/m2/gm2-gcc/m2options.h +++ b/gcc/m2/gm2-gcc/m2options.h @@ -104,6 +104,7 @@ EXTERN void M2Options_FinaliseOptions (void); EXTERN void
[gcc r14-9708] predict: Fix comment typo
https://gcc.gnu.org/g:44ab31419cf366e889a019a2fe31638c6f093729 commit r14-9708-g44ab31419cf366e889a019a2fe31638c6f093729 Author: Jakub Jelinek Date: Thu Mar 28 15:12:08 2024 +0100 predict: Fix comment typo I've noticed a typo in a comment. 2024-03-28 Jakub Jelinek * predict.cc (estimate_bb_frequencies): Fix comment typo, scalling -> scaling. Diff: --- gcc/predict.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/predict.cc b/gcc/predict.cc index c1c48bf3df1..43e3694cb42 100644 --- a/gcc/predict.cc +++ b/gcc/predict.cc @@ -4035,7 +4035,7 @@ estimate_bb_frequencies () /* Scaling frequencies up to maximal profile count may result in frequent overflows especially when inlining loops. - Small scalling results in unnecesary precision loss. Stay in + Small scaling results in unnecesary precision loss. Stay in the half of the (exponential) range. */ freq_max = (sreal (1) << (profile_count::n_bits / 2)) / freq_max; if (freq_max < 16)
[gcc r14-9707] profile-count: Avoid overflows into uninitialized [PR112303]
https://gcc.gnu.org/g:d5a3b4afcdf4d517334a2717dbb65ae0d2c26507 commit r14-9707-gd5a3b4afcdf4d517334a2717dbb65ae0d2c26507 Author: Jakub Jelinek Date: Thu Mar 28 15:00:44 2024 +0100 profile-count: Avoid overflows into uninitialized [PR112303] The testcase in the patch ICEs with --- gcc/tree-scalar-evolution.cc +++ gcc/tree-scalar-evolution.cc @@ -3881,7 +3881,7 @@ final_value_replacement_loop (class loop *loop) /* Propagate constants immediately, but leave an unused initialization around to avoid invalidating the SCEV cache. */ - if (CONSTANT_CLASS_P (def) && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rslt)) + if (0 && CONSTANT_CLASS_P (def) && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rslt)) replace_uses_by (rslt, def); /* Create the replacement statements. */ (the addition of the above made the ICE latent), because profile_count addition doesn't check for overflows and if unlucky, we can even overflow into the uninitialized value. Getting really huge profile counts is very easy even when not using recursive inlining in loops, e.g. __attribute__((noipa)) void bar (void) { __builtin_exit (0); } __attribute__((noipa)) void foo (void) { for (int i = 0; i < 1000; ++i) for (int j = 0; j < 1000; ++j) for (int k = 0; k < 1000; ++k) for (int l = 0; l < 1000; ++l) for (int m = 0; m < 1000; ++m) for (int n = 0; n < 1000; ++n) for (int o = 0; o < 1000; ++o) for (int p = 0; p < 1000; ++p) for (int q = 0; q < 1000; ++q) for (int r = 0; r < 1000; ++r) for (int s = 0; s < 1000; ++s) for (int t = 0; t < 1000; ++t) for (int u = 0; u < 1000; ++u) for (int v = 0; v < 1000; ++v) for (int w = 0; w < 1000; ++w) for (int x = 0; x < 1000; ++x) for (int y = 0; y < 1000; ++y) for (int z = 0; z < 1000; ++z) for (int a = 0; a < 1000; ++a) for (int b = 0; b < 1000; ++b) bar (); } int main () { foo (); } reaches the maximum count already on the 11th loop. Some other methods of profile_count like apply_scale already do use MIN (val, max_count) before assignment to m_val, this patch just extends that to operator{+,+=} methods. Furthermore, one overload of apply_probability wasn't using safe_scale_64bit and so could very easily overflow as well - prob is required to be [0, 1] and if m_val is near the max_count, it can overflow even with multiplications by 8. 2024-03-28 Jakub Jelinek PR tree-optimization/112303 * profile-count.h (profile_count::operator+): Perform addition in uint64_t variable and set m_val to MIN of that val and max_count. (profile_count::operator+=): Likewise. (profile_count::operator-=): Formatting fix. (profile_count::apply_probability): Use safe_scale_64bit even in the int overload. * gcc.c-torture/compile/pr112303.c: New test. Diff: --- gcc/profile-count.h| 12 gcc/testsuite/gcc.c-torture/compile/pr112303.c | 25 + 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/gcc/profile-count.h b/gcc/profile-count.h index b3d776475e2..6bbd476cb7f 100644 --- a/gcc/profile-count.h +++ b/gcc/profile-count.h @@ -910,7 +910,8 @@ public: profile_count ret; gcc_checking_assert (compatible_p (other)); - ret.m_val = m_val + other.m_val; + uint64_t ret_val = m_val + other.m_val; + ret.m_val = MIN (ret_val, max_count); ret.m_quality = MIN (m_quality, other.m_quality); return ret; } @@ -929,7 +930,8 @@ public: else { gcc_checking_assert (compatible_p (other)); - m_val += other.m_val; + uint64_t ret_val = m_val + other.m_val; + m_val = MIN (ret_val, max_count); m_quality = MIN (m_quality, other.m_quality); } return *this; @@ -957,7 +959,7 @@ public: else { gcc_checking_assert (compatible_p (other)); - m_val = m_val >= other.m_val ? m_val - other.m_val: 0; + m_val = m_val >= other.m_val ? m_val - other.m_val : 0; m_quality = MIN (m_quality, other.m_quality); } return *this; @@ -1127,7 +1129,9 @@ public: if (!initialized_p ()) return uninitialized (); profile_count ret; - ret.m_val = RDIV (m_val * prob, REG_BR_PROB_BASE); + uint64_t tmp; + safe_scale_64bit (m_val, prob, REG_BR_PROB_BASE, &tmp); + ret.m_val = tmp; ret.m_quality = MIN (m_quality, ADJUSTED); return ret; } diff --git a/gcc/testsuite/gcc.c-torture/compile/pr112303.c b/gcc/testsuite/gcc.c-torture/compile/pr112303.c new file mode 100644 index 000..01937da53cf --- /dev/null +
[gcc r14-9706] [testsuite] Fixup dg-options in {gcc, g++, gfortran}.dg/vect.exp tests
https://gcc.gnu.org/g:b8e7aaaf350a4584d9b76e8dd69daa2203bac339 commit r14-9706-gb8e7aaaf350a4584d9b76e8dd69daa2203bac339 Author: Maxim Kuvyrkov Date: Wed Mar 13 06:48:47 2024 + [testsuite] Fixup dg-options in {gcc,g++,gfortran}.dg/vect.exp tests Testsuites driven by vect.exp rely on check_vect_support_and_set_flags to set appropriate DEFAULT_VECTFLAGS for a given target (e.g., add -mfpu=neon for arm-linux-gnueabi). Unfortunately, these flags are overwritten by dg-options directive, which can cause tests to fail. Behavior of dg-options is documented in vect.exp files, but not all developers look at the .exp file when adding a new testcase. This caused a few dg-options directives to be used instead of the more appropriate dg-additional-options. This patch changes target-independent dg-options into dg-additional-options. This patch does not touch target-specific dg-options and target-specific tests to avoid disturbing the gentle balance of target-specific vectorization. This patch also removes a couple of unneeded "dg-do run" directives to avoid failures on compile-only targets. Default action is, again, set by check_vect_support_and_set_flags. Lastly, I avoided renaming tests that use -O options to O-* filename format because this support is not consistent between gcc.dg/vect/, g++.dg/vect/, and gfortran.dg/vect/ testsuites. It seems dg-additional-options is cleaner. This patch does the following, 1. do not change target-specific tests, e.g., gcc.dg/vect/costmodel/riscv/*; 2. do not change { dg-options FOO { target { target-*-pattern } } }; 3. do not remove { dg-do run { target { target-*-pattern } } }; 4. change { dg-options FOO } to { dg-additional-options FOO }; 5. remove { dg-do run } in several tests, where it is clearly not needed. gcc/testsuite/ChangeLog: PR testsuite/114307 * gcc.dg/vect/vect-cond-reduc-in-order-2-signed-zero.c: Remove dg-run. * gcc.dg/vect/complex/complex-operations-run.c: Likewise. * gcc.dg/vect/pr113576.c: Remove dg-run. Use dg-additional-options for test-specific flags. * gcc.dg/vect/gimplefe-40.c: Use dg-additional-options for test-specific flags. * gcc.dg/vect/gimplefe-41.c: Likewise. * gcc.dg/vect/pr101145inf.c: Likewise. * gcc.dg/vect/pr101145inf_1.c: Likewise. * gcc.dg/vect/pr108316.c: Likewise. * gcc.dg/vect/pr109011-1.c: Likewise. * gcc.dg/vect/pr109011-2.c: Likewise. * gcc.dg/vect/pr109011-3.c: Likewise. * gcc.dg/vect/pr109011-4.c: Likewise. * gcc.dg/vect/pr109011-5.c: Likewise. * gcc.dg/vect/pr111846.c: Likewise. * gcc.dg/vect/pr111860-2.c: Likewise. * gcc.dg/vect/pr111860-3.c: Likewise. * gcc.dg/vect/pr113002.c: Likewise. * gcc.dg/vect/pr84711.c: Likewise. * gcc.dg/vect/pr85597.c: Likewise. * gcc.dg/vect/pr88497-1.c: Likewise. * gcc.dg/vect/pr88497-2.c: Likewise. * gcc.dg/vect/pr88497-3.c: Likewise. * gcc.dg/vect/pr88497-4.c: Likewise. * gcc.dg/vect/pr88497-5.c: Likewise. * gcc.dg/vect/pr88497-7.c: Likewise. * gcc.dg/vect/pr92347.c: Likewise. * gcc.dg/vect/pr93069.c: Likewise. * gcc.dg/vect/pr97241.c: Likewise. * gcc.dg/vect/pr99102.c: Likewise. * gcc.dg/vect/vect-early-break_65.c: Likewise. * gcc.dg/vect/vect-fold-1.c: Likewise. * gcc.dg/vect/vect-ifcvt-19.c: Likewise. * gcc.dg/vect/vect-ifcvt-20.c: Likewise. * gcc.dg/vect/vect-reduc-epilogue-gaps.c: Likewise. * gcc.dg/vect/vect-singleton_1.c: Likewise. * g++.dg/vect/pr84556.cc: Likewise. * gfortran.dg/vect/fast-math-mgrid-resid.f: Likewise. * gfortran.dg/vect/pr77848.f: Likewise. * gfortran.dg/vect/pr90913.f90: Likewise. Diff: --- gcc/testsuite/g++.dg/vect/pr84556.cc | 2 +- gcc/testsuite/gcc.dg/vect/complex/complex-operations-run.c | 1 - gcc/testsuite/gcc.dg/vect/gimplefe-40.c| 2 +- gcc/testsuite/gcc.dg/vect/gimplefe-41.c| 2 +- gcc/testsuite/gcc.dg/vect/pr101145inf.c| 2 +- gcc/testsuite/gcc.dg/vect/pr101145inf_1.c | 2 +- gcc/testsuite/gcc.dg/vect/pr108316.c | 2 +- gcc/testsuite/gcc.dg/vect/pr109011-1.c | 2 +- gcc/testsuite/gcc.dg/vect/pr109011-2.c | 2 +- gcc/testsuite/gcc.dg/vect/pr109011-3.c | 2 +- gcc/testsuite/gcc.dg/vect/pr109011-4.c | 2 +- gcc/testsuite/gcc.dg/ve
[gcc r14-9705] Hash operands of PHI in ipa-icf
https://gcc.gnu.org/g:0923fe2d4808c16b72c1d1bfe28220dd326d8b76 commit r14-9705-g0923fe2d4808c16b72c1d1bfe28220dd326d8b76 Author: Jan Hubicka Date: Thu Mar 28 13:24:54 2024 +0100 Hash operands of PHI in ipa-icf This patch fixes cache colision on function whose body differs only by constants at PHI operands. As for if (test) a = cst1; else a = cst2; gcc/ChangeLog: PR middle-end/113907 * ipa-icf.cc (sem_function::init): Hash PHI operands (sem_function::compare_phi_node): Add argument about preserving order Diff: --- gcc/ipa-icf.cc | 19 +++ 1 file changed, 19 insertions(+) diff --git a/gcc/ipa-icf.cc b/gcc/ipa-icf.cc index 120d8544988..e84922c3ef8 100644 --- a/gcc/ipa-icf.cc +++ b/gcc/ipa-icf.cc @@ -1387,6 +1387,23 @@ sem_function::init (ipa_icf_gimple::func_checker *checker) cfg_checksum = iterative_hash_host_wide_int (e->flags, cfg_checksum); + /* TODO: We should be able to match PHIs with different order of + parameters. This needs to be also updated in + sem_function::compare_phi_node. */ + gphi_iterator si; + for (si = gsi_start_nonvirtual_phis (bb); !gsi_end_p (si); +gsi_next_nonvirtual_phi (&si)) + { + hstate.add_int (GIMPLE_PHI); + gphi *phi = si.phi (); + m_checker->hash_operand (gimple_phi_result (phi), hstate, 0, +func_checker::OP_NORMAL); + hstate.add_int (gimple_phi_num_args (phi)); + for (unsigned int i = 0; i < gimple_phi_num_args (phi); i++) + m_checker->hash_operand (gimple_phi_arg_def (phi, i), + hstate, 0, func_checker::OP_NORMAL); + } + for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { @@ -1579,6 +1596,8 @@ sem_function::compare_phi_node (basic_block bb1, basic_block bb2) if (size1 != size2) return return_false (); + /* TODO: We should be able to match PHIs with different order of +parameters. This needs to be also updated in sem_function::init. */ for (i = 0; i < size1; ++i) { t1 = gimple_phi_arg (phi1, i)->def;
[gcc(refs/vendors/redhat/heads/gcc-14-branch)] Merge commit 'r14-9704-g7942558f27038461f948ca10140a156ae678cdf8' into redhat/gcc-14-branch
https://gcc.gnu.org/g:55ddd689eced99251ba4bea38c076ed8d072d7ee commit 55ddd689eced99251ba4bea38c076ed8d072d7ee Merge: 6b39b05bec8 7942558f270 Author: Jakub Jelinek Date: Thu Mar 28 12:29:08 2024 +0100 Merge commit 'r14-9704-g7942558f27038461f948ca10140a156ae678cdf8' into redhat/gcc-14-branch Diff: contrib/ChangeLog | 10 + contrib/gcc_update |8 + contrib/unicode/gen_libstdcxx_unicode_data.py |6 +- gcc/ChangeLog | 718 + gcc/DATESTAMP |2 +- gcc/analyzer/ChangeLog | 199 ++ gcc/analyzer/access-diagram.cc | 591 ++-- gcc/analyzer/access-diagram.h | 38 +- gcc/analyzer/analyzer-selftests.cc |1 + gcc/analyzer/analyzer-selftests.h |2 +- gcc/analyzer/analyzer.h| 11 +- gcc/analyzer/bounds-checking.cc| 148 +- gcc/analyzer/call-summary.cc | 12 + gcc/analyzer/constraint-manager.cc | 14 +- gcc/analyzer/engine.cc |7 + gcc/analyzer/kf.cc | 157 +- gcc/analyzer/region-model-manager.cc | 162 +- gcc/analyzer/region-model-manager.h|7 +- gcc/analyzer/region-model.cc | 91 +- gcc/analyzer/region.cc | 67 +- gcc/analyzer/region.h |3 + gcc/analyzer/sm-malloc.cc | 30 + gcc/analyzer/sm-taint.cc | 58 +- gcc/analyzer/svalue.cc | 156 +- gcc/analyzer/svalue.h | 49 +- gcc/asan.cc|4 + gcc/btfout.cc | 30 +- gcc/builtins.cc| 12 +- gcc/c-family/ChangeLog | 23 + gcc/c-family/c-common.cc | 14 +- gcc/c-family/c-omp.cc | 51 +- gcc/c-family/c-pretty-print.cc |2 + gcc/cfganal.cc | 15 +- gcc/cfgloopmanip.cc|2 +- gcc/combine.cc | 11 + gcc/common/config/i386/cpuinfo.h | 16 + gcc/common/config/i386/i386-common.cc |6 +- gcc/common/config/i386/i386-cpuinfo.h |2 + gcc/common/config/riscv/riscv-common.cc| 138 +- gcc/config.gcc | 18 +- gcc/config/aarch64/aarch64-cores.def |4 +- gcc/config/aarch64/aarch64-feature-deps.h |6 +- gcc/config/aarch64/aarch64-option-extensions.def |6 +- gcc/config/aarch64/aarch64-sys-regs.def|1 + gcc/config/alpha/alpha.cc |3 +- gcc/config/arc/arc.cc |3 +- gcc/config/arm/arm-mve-builtins.cc |2 +- gcc/config/avr/avr-protos.h|1 + gcc/config/avr/avr.cc | 37 +- gcc/config/avr/avr.md | 60 +- gcc/config/avr/constraints.md | 17 +- gcc/config/bpf/btfext-out.cc |5 +- gcc/config/bpf/core-builtins.cc| 70 +- gcc/config/csky/csky.cc|3 +- gcc/config/epiphany/epiphany.cc|3 +- gcc/config/ft32/ft32.cc|7 +- gcc/config/gcn/gcn-hsa.h |5 +- gcc/config/gcn/gcn-opts.h |6 +- gcc/config/gcn/gcn-run.cc |8 +- gcc/config/gcn/gcn.cc | 54 +- gcc/config/gcn/gcn.h |6 +- gcc/config/gcn/gcn.md | 86 +- gcc/config/gcn/gcn.opt |6 + gcc/config/gcn/mkoffload.cc| 10 + gcc/config/gcn/t-omp-device|2 +- gcc/config/i386/driver-i386.cc |5 + gcc/config/i386/i386-c.cc |7 + gcc/config/i386/i386-features.cc | 127 +- gcc/config/i386/i386-features.h|4 +- gcc/config/i386/i386-options.cc|6 +- gcc/config/i386/i386.cc|6 +- gcc/config/i386/i386.h |4 +- gcc/config/i386/i386.md| 18 +- gcc/config/i386/sse.md | 22 +- gcc/config/i386/x86-tune-costs.h | 136 + gcc/config/i386/x86-tune-sched.cc |
[gcc/redhat/heads/gcc-14-branch] (206 commits) Merge commit 'r14-9704-g7942558f27038461f948ca10140a156ae67
The branch 'redhat/heads/gcc-14-branch' was updated to point to: 55ddd689ece... Merge commit 'r14-9704-g7942558f27038461f948ca10140a156ae67 It previously pointed to: 6b39b05bec8... Merge commit 'r14-9499-g53fb2cf75965e4dbcf145a12d8ae41f4667 Diff: Summary of changes (added commits): --- 55ddd68... Merge commit 'r14-9704-g7942558f27038461f948ca10140a156ae67 7942558... testsuite: Add testcase for already fixed PR [PR109925] (*) 7f233fe... fortran: Fix specification expression check in submodules [ (*) 7907ff2... modula2: Rebuild documentation sections for target independ (*) 0bad303... middle-end/114480 - IDF compute is slow (*) f6d7ff4... RISC-V: Add vxsat as a register (*) feafff0... Daily bump. (*) bd8a3ee... compiler: use correct size and comparison in index value ov (*) fdd5981... analyzer: fix ICE due to type mismatch when replaying call (*) f89c83a... btf: Fix up btf-datasec-1.c test on x86 (*) 9ff034f... gcc/testsuite/go.test: update issue16016 (*) 4b04433... c-family: Cast __atomic_load_*/__atomic_exchange_* result t (*) f85d336... compiler: initialize local variable in lower_method_express (*) 839bc42... combine: Don't combine if I2 does not change (*) db41057... docs: Use @var{S} etc. in Spec File invoke.texi documentati (*) a6c630c... libstdc++: Add masked ++/-- implementation for sizeof < 16 (*) 0ac2c0f... libstdc++: Fix call signature of builtins from masked ++/-- (*) 9ac3119... libstdc++: add ARM SVE support to std::experimental::simd (*) 0b02da5... tree-optimization/114057 - handle BB reduction remain defs (*) aac30f8... testsuite: Fix up ext-floating{3,12}.C on i686-linux (*) 258defb... aarch64: Align lrcpc3 FEAT_STRING with /proc/cpuinfo 'Featu (*) d9ea518... aarch64: Add +lse128 architectural extension command-line f (*) 291c46a... testsuite: Fix copy-headers-8.c (*) 4b8e7b5... Daily bump. (*) 41e767c... libgfortran: Fix file position after ENDFILE statement. (*) fb1d50e... libstdc++: fix generator iterator operator* return type (*) ac5d63a... libstdc++: fix _V badname in (*) 5be2313... aarch64: Use constexpr for out-of-line statics (*) fa60ac5... btf: Emit labels in DATASEC bts_offset entries. (*) f536ea9... testsuite: Fix up pr51.c testcase [PR114486] (*) b1af867... PR modula2/114478 isnormal builtin unavailable from m2 (*) c0e199e... c++: add fixed test [PR100557] (*) 2f47ca0... c++/modules testsuite: fix a couple of dg-module-do directi (*) cab53aa... aarch64: Fix SCHEDULER_IDENT for Cortex-A510 and Cortex-A52 (*) 217e778... libstdc++: Replace stacktrace effective target with feature (*) 4a3a1b6... libstdc++: Add dg-require-cpp-feature-test to test feature (*) 4549b0f... testsuite: Add -Wno-psabi to pr113126.c test (*) c4f2c84... fold-const: Punt on MULT_EXPR in extract_muldiv MIN/MAX_EXP (*) 471967a... tsan: Don't instrument non-generic AS accesses [PR111736] (*) f4e92d6... tree-optimization/114471 - ICE with mismatching vector type (*) 226a220... tree-optimization/114464 - verify types in recurrence vecto (*) 94b91b2... cfgloopmanip, i386: Fix comment typos (*) 10accfd... c-family, c++: Handle EXCESS_PRECISION_EXPR in pretty print (*) 4470611... tree-optimization/114027 - fix testcase (*) bb81906... MIPS: Predefine __mips_strict_alignment if STRICT_ALIGNMENT (*) 7e6cdec... Daily bump. (*) 8651991... c++: ICE with noexcept and local specialization, again [PR1 (*) de0886d... c++: broken direct-init with trailing array member [PR11443 (*) a89fb3a... Update gcc de.po (*) 18555b9... Update gcc sv.po (*) c2e68ff... libgcc: arm: fix build for FDPIC target (*) 78b56a1... amdgcn: Add gfx1036 target (*) 44863af... modula2: Rebuild documentation sections for target independ (*) cf3fc6f... libstdc++: Fix incorrect macro used in #undef in test (*) 5cab64a... RISC-V: Allow RVV intrinsic when function target("arch=+v") (*) ecd2c37... Daily bump. (*) bb04a11... Daily bump. (*) a684581... PR modula2/11 trunc float malformed error cause ICE (*) c8a343f... PR modula2/114443 missing quote cause ICE (*) 80a0cb3... analyzer: fix ICE and false positive with -Wanalyzer-deref- (*) 2e4b337... hppa: Fix LO_SUM DLTIND14R address support in PRINT_OPERAND (*) 5435850... libstdc++: Disable std::formatter specializations (LWG 3944 (*) 3763fb8... libstdc++: Add __is_in_place_index_v helper and use it in < (*) f4605c5... libstdc++: Use std::type_identity_t in as per (*) 4a46a48... bitint: Fix bitfield loads in handle_cast [PR114433] (*) f92cf8c... bitint: Handle complex types in build_bitint_stmt_ssa_confl (*) 8fc5593... predcom: Punt for steps which aren't multiples of access si (*) 7a01cc7... xtensa: Add supplementary split pattern for "*addsubx" (*) e898586... Daily bump. (*) c2e28df... libstdc++: Destroy allocators in re-inserted container node (*) 142cc4c... libstdc++: Constrain std::vector default constructor [PR113 (*)
[gcc r14-9704] testsuite: Add testcase for already fixed PR [PR109925]
https://gcc.gnu.org/g:7942558f27038461f948ca10140a156ae678cdf8 commit r14-9704-g7942558f27038461f948ca10140a156ae678cdf8 Author: Jakub Jelinek Date: Thu Mar 28 11:58:26 2024 +0100 testsuite: Add testcase for already fixed PR [PR109925] This testcase was made latent by r14-4089 and got fixed both on the trunk and 13 branch with PR113372 fix. Adding testcase to the testsuite and will close the PR as a dup. 2024-03-28 Jakub Jelinek PR tree-optimization/109925 * gcc.c-torture/execute/pr109925.c: New test. Diff: --- gcc/testsuite/gcc.c-torture/execute/pr109925.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/gcc/testsuite/gcc.c-torture/execute/pr109925.c b/gcc/testsuite/gcc.c-torture/execute/pr109925.c new file mode 100644 index 000..929673b6b63 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr109925.c @@ -0,0 +1,30 @@ +/* PR tree-optimization/109925 */ + +int a, c, f; + +int +main () +{ + int g[2]; + for (c = 0; c < 2; c++) +{ + { + char h[20], *b = h; + int d = 48, e = 0; + while (d && e < 5) + b[e++] = d /= 10; + f = e; + } + g[f - 2 + c] = 0; +} + for (;;) +{ + for (; a <= 4; a++) + if (g[0]) + break; + break; +} + if (a != 5) +__builtin_abort (); + return 0; +}
[gcc r14-9703] fortran: Fix specification expression check in submodules [PR114475]
https://gcc.gnu.org/g:7f233feafd657250340be3b3500d2697948ae3ed commit r14-9703-g7f233feafd657250340be3b3500d2697948ae3ed Author: Mikael Morin Date: Wed Mar 27 16:30:42 2024 +0100 fortran: Fix specification expression check in submodules [PR114475] The patch fixing PR111781 made the check of specification expressions more restrictive, disallowing local variables in specification expressions of dummy arguments. PR114475 showed an example where that change regressed, disallowing in submodules expressions that had been allowed in the parent module. In submodules indeed, the hierarchy of namespaces inherited from the parent module is not reproduced so the host-association of symbols can't be recognized by checking the nesting of namespaces. This change fixes the problem by allowing in specification expressions all the symbols in a submodule that are inherited from the parent module. PR fortran/111781 PR fortran/114475 gcc/fortran/ChangeLog: * expr.cc (check_restricted): In submodules, allow variables host- associated from the parent module. gcc/testsuite/ChangeLog: * gfortran.dg/spec_expr_10.f90: New test. Co-authored-by: Harald Anlauf Diff: --- gcc/fortran/expr.cc| 1 + gcc/testsuite/gfortran.dg/spec_expr_10.f90 | 46 ++ 2 files changed, 47 insertions(+) diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc index 9a042cd7040..09d1ebd95d2 100644 --- a/gcc/fortran/expr.cc +++ b/gcc/fortran/expr.cc @@ -3517,6 +3517,7 @@ check_restricted (gfc_expr *e) if (e->error || sym->attr.in_common || sym->attr.use_assoc + || sym->attr.used_in_submodule || sym->attr.dummy || sym->attr.implied_index || sym->attr.flavor == FL_PARAMETER diff --git a/gcc/testsuite/gfortran.dg/spec_expr_10.f90 b/gcc/testsuite/gfortran.dg/spec_expr_10.f90 new file mode 100644 index 000..287b5a8d6cc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/spec_expr_10.f90 @@ -0,0 +1,46 @@ +! { dg-do compile } +! +! PR fortran/114475 +! The array specification of PP in OL_EVAL used to be rejected in the submodule +! because the compiler was not able to see the host-association of N_EXTERNAL +! there. +! +! Contributed by Jürgen Reuter . + +module t1 + use, intrinsic :: iso_c_binding + implicit none + private + public :: t1_t + integer :: N_EXTERNAL = 0 + + type :: t1_t + contains +procedure :: set_n_external => t1_set_n_external + end type t1_t + + abstract interface + subroutine ol_eval (id, pp, emitter) bind(C) + import + real(kind = c_double), intent(in) :: pp(5 * N_EXTERNAL) + end subroutine ol_eval + end interface + interface +module subroutine t1_set_n_external (object, n) + class(t1_t), intent(inout) :: object + integer, intent(in) :: n +end subroutine t1_set_n_external + end interface + +end module t1 + +submodule (t1) t1_s + implicit none +contains + module subroutine t1_set_n_external (object, n) +class(t1_t), intent(inout) :: object +integer, intent(in) :: n +N_EXTERNAL = n + end subroutine t1_set_n_external + +end submodule t1_s
[gcc r14-9702] modula2: Rebuild documentation sections for target independent libs
https://gcc.gnu.org/g:7907ff2bcb50d1d88dc8d22e740de33ab151d00c commit r14-9702-g7907ff2bcb50d1d88dc8d22e740de33ab151d00c Author: Gaius Mulley Date: Thu Mar 28 08:31:06 2024 + modula2: Rebuild documentation sections for target independent libs This patch rebuilds the documentation for the target independent library sections. gcc/m2/ChangeLog: * target-independent/m2/Builtins.texi: Rebuilt. * target-independent/m2/gm2-libs.texi: Rebuilt. Signed-off-by: Gaius Mulley Diff: --- gcc/m2/target-independent/m2/Builtins.texi | 67 +- gcc/m2/target-independent/m2/gm2-libs.texi | 67 +- 2 files changed, 130 insertions(+), 4 deletions(-) diff --git a/gcc/m2/target-independent/m2/Builtins.texi b/gcc/m2/target-independent/m2/Builtins.texi index b6903215293..4ebad46b96a 100644 --- a/gcc/m2/target-independent/m2/Builtins.texi +++ b/gcc/m2/target-independent/m2/Builtins.texi @@ -4,7 +4,7 @@ DEFINITION MODULE Builtins ; FROM SYSTEM IMPORT ADDRESS ; -(* floating point intrinsic procedure functions *) +(* Floating point intrinsic procedure functions. *) @findex isnanf PROCEDURE __BUILTIN__ isnanf (x: SHORTREAL) : INTEGER ; @@ -140,7 +140,70 @@ PROCEDURE __BUILTIN__ scalbnf (x: SHORTREAL; n: INTEGER) : SHORTREAL ; @findex scalbnl PROCEDURE __BUILTIN__ scalbnl (x: LONGREAL; n: INTEGER) : LONGREAL ; -(* complex arithmetic intrincic procedure functions *) +@findex isgreater +PROCEDURE __BUILTIN__ isgreater (x, y: REAL) : INTEGER ; +@findex isgreaterf +PROCEDURE __BUILTIN__ isgreaterf (x, y: SHORTREAL) : INTEGER ; +@findex isgreaterl +PROCEDURE __BUILTIN__ isgreaterl (x, y: LONGREAL) : INTEGER ; + +@findex isgreaterequal +PROCEDURE __BUILTIN__ isgreaterequal (x, y: REAL) : INTEGER ; +@findex isgreaterequalf +PROCEDURE __BUILTIN__ isgreaterequalf (x, y: SHORTREAL) : INTEGER ; +@findex isgreaterequall +PROCEDURE __BUILTIN__ isgreaterequall (x, y: LONGREAL) : INTEGER ; + +@findex isless +PROCEDURE __BUILTIN__ isless (x, y: REAL) : INTEGER ; +@findex islessf +PROCEDURE __BUILTIN__ islessf (x, y: SHORTREAL) : INTEGER ; +@findex islessl +PROCEDURE __BUILTIN__ islessl (x, y: LONGREAL) : INTEGER ; + +@findex islessequal +PROCEDURE __BUILTIN__ islessequal (x, y: REAL) : INTEGER ; +@findex islessequalf +PROCEDURE __BUILTIN__ islessequalf (x, y: SHORTREAL) : INTEGER ; +@findex islessequall +PROCEDURE __BUILTIN__ islessequall (x, y: LONGREAL) : INTEGER ; + +@findex islessgreater +PROCEDURE __BUILTIN__ islessgreater (x, y: REAL) : INTEGER ; +@findex islessgreaterf +PROCEDURE __BUILTIN__ islessgreaterf (x, y: SHORTREAL) : INTEGER ; +@findex islessgreaterl +PROCEDURE __BUILTIN__ islessgreaterl (x, y: LONGREAL) : INTEGER ; + +@findex isunordered +PROCEDURE __BUILTIN__ isunordered (x, y: REAL) : INTEGER ; +@findex isunorderedf +PROCEDURE __BUILTIN__ isunorderedf (x, y: SHORTREAL) : INTEGER ; +@findex isunorderedl +PROCEDURE __BUILTIN__ isunorderedl (x, y: LONGREAL) : INTEGER ; + +@findex iseqsig +PROCEDURE __BUILTIN__ iseqsig (x, y: REAL) : INTEGER ; +@findex iseqsigf +PROCEDURE __BUILTIN__ iseqsigf (x, y: SHORTREAL) : INTEGER ; +@findex iseqsigl +PROCEDURE __BUILTIN__ iseqsigl (x, y: LONGREAL) : INTEGER ; + +@findex isnormal +PROCEDURE __BUILTIN__ isnormal (r: REAL) : INTEGER ; +@findex isnormalf +PROCEDURE __BUILTIN__ isnormalf (s: SHORTREAL) : INTEGER ; +@findex isnormall +PROCEDURE __BUILTIN__ isnormall (l: LONGREAL) : INTEGER ; + +@findex isinf_sign +PROCEDURE __BUILTIN__ isinf_sign (r: REAL) : INTEGER ; +@findex isinf_signf +PROCEDURE __BUILTIN__ isinf_signf (s: SHORTREAL) : INTEGER ; +@findex isinf_signl +PROCEDURE __BUILTIN__ isinf_signl (l: LONGREAL) : INTEGER ; + +(* Complex arithmetic intrincic procedure functions. *) @findex cabsf PROCEDURE __BUILTIN__ cabsf (z: SHORTCOMPLEX) : SHORTREAL ; diff --git a/gcc/m2/target-independent/m2/gm2-libs.texi b/gcc/m2/target-independent/m2/gm2-libs.texi index db8189f4059..10b466811c1 100644 --- a/gcc/m2/target-independent/m2/gm2-libs.texi +++ b/gcc/m2/target-independent/m2/gm2-libs.texi @@ -240,7 +240,7 @@ DEFINITION MODULE Builtins ; FROM SYSTEM IMPORT ADDRESS ; -(* floating point intrinsic procedure functions *) +(* Floating point intrinsic procedure functions. *) @findex isnanf PROCEDURE __BUILTIN__ isnanf (x: SHORTREAL) : INTEGER ; @@ -376,7 +376,70 @@ PROCEDURE __BUILTIN__ scalbnf (x: SHORTREAL; n: INTEGER) : SHORTREAL ; @findex scalbnl PROCEDURE __BUILTIN__ scalbnl (x: LONGREAL; n: INTEGER) : LONGREAL ; -(* complex arithmetic intrincic procedure functions *) +@findex isgreater +PROCEDURE __BUILTIN__ isgreater (x, y: REAL) : INTEGER ; +@findex isgreaterf +PROCEDURE __BUILTIN__ isgreaterf (x, y: SHORTREAL) : INTEGER ; +@findex isgreaterl +PROCEDURE __BUILTIN__ isgreaterl (x, y: LONGREAL) : INTEGER ; + +@findex isgreaterequal +PROCEDURE __BUILTIN__ isgreaterequal (x, y: REAL) : INTEGER ; +@findex isgreaterequalf +PROCEDURE __BUILTI
[gcc r14-9701] middle-end/114480 - IDF compute is slow
https://gcc.gnu.org/g:0bad303944a1d2311c07d59912b4dfa7bff988c8 commit r14-9701-g0bad303944a1d2311c07d59912b4dfa7bff988c8 Author: Richard Biener Date: Wed Mar 27 16:19:01 2024 +0100 middle-end/114480 - IDF compute is slow The testcase in this PR shows very slow IDF compute: tree SSA rewrite : 76.99 ( 31%) 24.78%243663 cc1plus cc1plus [.] compute_idf which can be mitigated to some extent by refactoring the bitmap operations to simpler variants. With the patch below this becomes tree SSA rewrite : 15.23 ( 8%) when not optimizing and in addition to that tree SSA incremental : 181.52 ( 30%) to tree SSA incremental : 24.09 ( 6%) when optimizing. PR middle-end/114480 * cfganal.cc (compute_idf): Use simpler bitmap iteration, touch work_set only when phi_insertion_points changed. Diff: --- gcc/cfganal.cc | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gcc/cfganal.cc b/gcc/cfganal.cc index 432775decf1..35c59f3f5d2 100644 --- a/gcc/cfganal.cc +++ b/gcc/cfganal.cc @@ -1701,8 +1701,7 @@ compute_idf (bitmap def_blocks, bitmap_head *dfs) on earlier blocks first is better. ??? Basic blocks are by no means guaranteed to be ordered in optimal order for this iteration. */ - bb_index = bitmap_first_set_bit (work_set); - bitmap_clear_bit (work_set, bb_index); + bb_index = bitmap_clear_first_set_bit (work_set); /* Since the registration of NEW -> OLD name mappings is done separately from the call to update_ssa, when updating the SSA @@ -1712,12 +1711,14 @@ compute_idf (bitmap def_blocks, bitmap_head *dfs) gcc_checking_assert (bb_index < (unsigned) last_basic_block_for_fn (cfun)); - EXECUTE_IF_AND_COMPL_IN_BITMAP (&dfs[bb_index], phi_insertion_points, - 0, i, bi) - { + /* The population counts of the dominance frontiers is low +compared to that of phi_insertion_points which approaches +the IDF and of work_set which is at most that of the IDF +as well. That makes iterating over the DFS bitmap preferential +to whole bitmap operations involving also phi_insertion_points. */ + EXECUTE_IF_SET_IN_BITMAP (&dfs[bb_index], 0, i, bi) + if (bitmap_set_bit (phi_insertion_points, i)) bitmap_set_bit (work_set, i); - bitmap_set_bit (phi_insertion_points, i); - } } return phi_insertion_points;