[gcc r15-6422] testsuite: Don't test pr118149.c on AArch64
https://gcc.gnu.org/g:b43bb6591f7f934f9807a2cae3b53fdbe8d27169 commit r15-6422-gb43bb6591f7f934f9807a2cae3b53fdbe8d27169 Author: Christoph Müllner Date: Sun Dec 22 23:02:03 2024 +0100 testsuite: Don't test pr118149.c on AArch64 Recently two test cases for PR118149 have been added. While pr118149-2.c works well for AArch64, pr118149.c fails because the expected optimization in forwprop4 cannot be applied as SLP vectorization does not happen. This patch fixes this issue by disabling the check on AArch64. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr118149.c: Disable for AArch64. Signed-off-by: Christoph Müllner Diff: --- gcc/testsuite/gcc.dg/tree-ssa/pr118149.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr118149.c b/gcc/testsuite/gcc.dg/tree-ssa/pr118149.c index f471877f6611..c9a427c4a07f 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr118149.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr118149.c @@ -15,6 +15,6 @@ void fastconv_parse () fastconv_parse_dst[6] = fastconv_parse_dst[7] = i1k + r3k; } -/* { dg-final { scan-tree-dump "Vec perm simplify sequences have been blended" "forwprop4" { target { aarch64*-*-* i?86-*-* x86_64-*-* } } } } */ -/* { dg-final { scan-tree-dump "VEC_PERM_EXPR.*{ 0, 0, 6, 6 }" "forwprop4" { target { aarch64*-*-* i?86-*-* x86_64-*-* } } } } */ -/* { dg-final { scan-tree-dump "VEC_PERM_EXPR.*{ 1, 1, 7, 7 }" "forwprop4" { target { aarch64*-*-* i?86-*-* x86_64-*-* } } } } */ +/* { dg-final { scan-tree-dump "Vec perm simplify sequences have been blended" "forwprop4" { target { i?86-*-* x86_64-*-* } } } } */ +/* { dg-final { scan-tree-dump "VEC_PERM_EXPR.*{ 0, 0, 6, 6 }" "forwprop4" { target { i?86-*-* x86_64-*-* } } } } */ +/* { dg-final { scan-tree-dump "VEC_PERM_EXPR.*{ 1, 1, 7, 7 }" "forwprop4" { target { i?86-*-* x86_64-*-* } } } } */
[gcc r15-6420] doc: Remove references to HP-UX 8 and HP-UX 9
https://gcc.gnu.org/g:6b09d5e76c6f117dd8030907f76435d4bd2c746a commit r15-6420-g6b09d5e76c6f117dd8030907f76435d4bd2c746a Author: Gerald Pfeifer Date: Mon Dec 23 11:24:08 2024 +0900 doc: Remove references to HP-UX 8 and HP-UX 9 gcc: * doc/invoke.texi (HPPA Options): Remove references to HP-UX 8 and HP-UX 9. Diff: --- gcc/doc/invoke.texi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 6e4e9f3fb597..400d192795b0 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -26840,8 +26840,7 @@ HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. @opindex mlinker-opt @item -mlinker-opt Enable the optimization pass in the HP-UX linker. Note this makes symbolic -debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 -linkers in which they give bogus error messages when linking some programs. +debugging impossible. @opindex mno-long-calls @opindex mlong-calls
[gcc r15-6419] gm2: fix bad programming practice warning
https://gcc.gnu.org/g:36ce325643c9bc0e67452f0c27b6a2fc8162e04d commit r15-6419-g36ce325643c9bc0e67452f0c27b6a2fc8162e04d Author: Wilken Gottwalt Date: Sun Dec 8 19:46:16 2024 + gm2: fix bad programming practice warning Fix identifier names to be too similar to Modula-2 keywords and causing warnings coming from Modula-2's own libraries. m2/m2log/InOut.mod:51:18: note: In implementation module ‘InOut’: either the identifier has the same name as a keyword or alternatively a keyword has the wrong case (‘IN’ and ‘in’) 51 |in, out: File ; m2/m2log/InOut.mod:51:18: note: the symbol name ‘in’ is legal as an identifier, however as such it might cause confusion and is considered bad programming practice gcc/gm2: * gm2-libs-log/InOut.mod: Fix bad identifier warning. Signed-off-by: Wilken Gottwalt Diff: --- gcc/m2/gm2-libs-log/InOut.mod | 53 +-- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/gcc/m2/gm2-libs-log/InOut.mod b/gcc/m2/gm2-libs-log/InOut.mod index 6e21fdcb6c10..defd6d206ea7 100644 --- a/gcc/m2/gm2-libs-log/InOut.mod +++ b/gcc/m2/gm2-libs-log/InOut.mod @@ -48,9 +48,8 @@ TYPE CharSet = SET OF CHAR ; VAR - in, out: File ; - inUsed, - outUsed: BOOLEAN ; + inFile, outFile: File ; + inUsed, outUsed: BOOLEAN ; (* @@ -71,8 +70,8 @@ BEGIN END ; IF SFIO.Exists(s) THEN - in := SFIO.OpenToRead(s) ; - Done := FIO.IsNoError(in) ; + inFile := SFIO.OpenToRead(s) ; + Done := FIO.IsNoError(inFile) ; inUsed := TRUE ELSE Done := FALSE ; @@ -91,8 +90,8 @@ PROCEDURE CloseInput ; BEGIN IF inUsed THEN - FIO.Close(in) ; - in := StdIn ; + FIO.Close(inFile) ; + inFile := StdIn ; inUsed := FALSE END END CloseInput ; @@ -116,8 +115,8 @@ BEGIN END ; IF SFIO.Exists(s) THEN - out := SFIO.OpenToWrite(s) ; - Done := FIO.IsNoError(out) ; + outFile := SFIO.OpenToWrite(s) ; + Done := FIO.IsNoError(outFile) ; outUsed := TRUE ELSE Done := FALSE ; @@ -136,8 +135,8 @@ PROCEDURE CloseOutput ; BEGIN IF outUsed THEN - FIO.Close(out) ; - out := StdOut ; + FIO.Close(outFile) ; + outFile := StdOut ; outUsed := FALSE END END CloseOutput ; @@ -149,8 +148,8 @@ END CloseOutput ; PROCEDURE LocalRead (VAR ch: CHAR) ; BEGIN - ch := FIO.ReadChar(in) ; - Done := FIO.IsNoError(in) AND (NOT FIO.EOF(in)) + ch := FIO.ReadChar(inFile) ; + Done := FIO.IsNoError(inFile) AND (NOT FIO.EOF(inFile)) END LocalRead ; @@ -246,8 +245,8 @@ END ReadString ; PROCEDURE WriteString (s: ARRAY OF CHAR) ; BEGIN - FIO.WriteString(out, s) ; - Done := FIO.IsNoError(out) + FIO.WriteString(outFile, s) ; + Done := FIO.IsNoError(outFile) END WriteString ; @@ -257,13 +256,13 @@ END WriteString ; PROCEDURE LocalWrite (ch: CHAR) ; BEGIN - FIO.WriteChar(out, ch) ; - Done := FIO.IsNoError(out) + FIO.WriteChar(outFile, ch) ; + Done := FIO.IsNoError(outFile) (* IF outUsed THEN - FIO.WriteChar(out, ch) ; - Done := FIO.IsNoError(out) + FIO.WriteChar(outFile, ch) ; + Done := FIO.IsNoError(outFile) ELSE Done := (write(stdout, ADR(ch), 1) = 1) END @@ -308,8 +307,8 @@ PROCEDURE WriteLn ; BEGIN IF outUsed THEN - FIO.WriteLine(out) ; - Done := FIO.IsNoError(out) + FIO.WriteLine(outFile) ; + Done := FIO.IsNoError(outFile) ELSE Terminal.WriteLn END @@ -366,7 +365,7 @@ END ReadCard ; PROCEDURE WriteCard (x, n: CARDINAL) ; BEGIN - IF KillString(SFIO.WriteS(out, ctos(x, n, ' ')))=NIL + IF KillString(SFIO.WriteS(outFile, ctos(x, n, ' ')))=NIL THEN END END WriteCard ; @@ -380,7 +379,7 @@ END WriteCard ; PROCEDURE WriteInt (x: INTEGER; n: CARDINAL) ; BEGIN - IF KillString(SFIO.WriteS(out, itos(x, n, ' ', FALSE)))=NIL + IF KillString(SFIO.WriteS(outFile, itos(x, n, ' ', FALSE)))=NIL THEN END END WriteInt ; @@ -394,7 +393,7 @@ END WriteInt ; PROCEDURE WriteOct (x, n: CARDINAL) ; BEGIN - IF KillString(SFIO.WriteS(out, CardinalToString(x, n, ' ', 8, FALSE)))=NIL + IF KillString(SFIO.WriteS(outFile, CardinalToString(x, n, ' ', 8, FALSE)))=NIL THEN END END WriteOct ; @@ -408,7 +407,7 @@ END WriteOct ; PROCEDURE WriteHex (x, n: CARDINAL) ; BEGIN - IF KillString(SFIO.WriteS(out, CardinalToString(x, n, ' ', 16, TRUE)))=NIL + IF KillString(SFIO.WriteS(outFile, CardinalToString(x, n, ' ', 16, TRUE)))=NIL THEN END END WriteHex ; @@ -420,8 +419,8 @@ END WriteHex ; PROCEDURE Init ; BEGIN - in := FIO.StdIn ; - out := FIO.StdOut ; + inFile := FIO.StdIn ; + outFile := FIO.StdOut ; inUsed := FALSE ; outUsed := FALSE ; AssignRead(LocalRead, LocalStatus, Done) ;
[gcc r15-6421] MAINTAINERS: add myself to write after approval
https://gcc.gnu.org/g:eaa59db1576405bcf135d1ebcee47bb38c62d29d commit r15-6421-geaa59db1576405bcf135d1ebcee47bb38c62d29d Author: Mark Harmstone Date: Mon Dec 23 04:11:15 2024 + MAINTAINERS: add myself to write after approval ChangeLog: * MAINTAINERS: Add myself to write after approval. Diff: --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 44153a7a51ea..0c571bde8bce 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -510,6 +510,7 @@ Olivier Hainque hainque Jivan Hakobyan - Andrew Haleyaph Demin Han deminhan +Mark Harmstone maharmstone Frederik Harwathfrederik Stuart Hastings stuart Michael Haubenwallner haubi
[gcc r15-6414] Fortran: Remove adding and removing of caf_get. [PR107635]
https://gcc.gnu.org/g:91d52f87c5bc48eacaf305d515e7cce192c2cf9c commit r15-6414-g91d52f87c5bc48eacaf305d515e7cce192c2cf9c Author: Andre Vehreschild Date: Thu Oct 31 15:35:47 2024 +0100 Fortran: Remove adding and removing of caf_get. [PR107635] Preparatory work for PR107635. During resolve prevent adding caf_get calls for expressions on the left-hand-side of an assignment and removing them later on again. Furthermore has the caf_token in a component become a pointer to the component and not the backend_decl of the caf-component. In some cases the caf_token was added as last component in a derived type and not as the next one following the component that it was needed to be associated to. gcc/fortran/ChangeLog: PR fortran/107635 * gfortran.h (gfc_comp_caf_token): Convenient macro for accessing caf_token's tree. * resolve.cc (gfc_resolve_ref): Backup caf_lhs when resolving expr in array_ref. (remove_caf_get_intrinsic): Removed. (resolve_variable): Set flag caf_lhs when resolving lhs of assignment to prevent insertion of caf_get. (resolve_lock_unlock_event): Same, but the lhs is the parameter. (resolve_ordinary_assign): Move conversion to caf_send to resolve_codes. (resolve_codes): Adress caf_get and caf_send here. (resolve_fl_derived0): Set component's caf_token when token is necessary. * trans-array.cc (gfc_conv_array_parameter): Get a coarray for expression that have a corank. (structure_alloc_comps): Use macro to get caf_token's tree. (gfc_alloc_allocatable_for_assignment): Same. * trans-expr.cc (gfc_get_ultimate_alloc_ptr_comps_caf_token): Same. (gfc_trans_structure_assign): Same. * trans-intrinsic.cc (conv_expr_ref_to_caf_ref): Same. (has_ref_after_cafref): New function to figure that after a reference of a coarray another reference is present. (conv_caf_send): Get rhs from correct place, when caf_get is not removed. * trans-types.cc (gfc_get_derived_type): Get caf_token from component and no longer guessing. Diff: --- gcc/fortran/gfortran.h | 3 +- gcc/fortran/resolve.cc | 165 + gcc/fortran/trans-array.cc | 30 gcc/fortran/trans-expr.cc | 15 ++-- gcc/fortran/trans-intrinsic.cc | 32 ++-- gcc/fortran/trans-types.cc | 44 +-- 6 files changed, 158 insertions(+), 131 deletions(-) diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index d08439019a38..d66c13b26615 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -1214,11 +1214,12 @@ typedef struct gfc_component /* Needed for procedure pointer components. */ struct gfc_typebound_proc *tb; /* When allocatable/pointer and in a coarray the associated token. */ - tree caf_token; + struct gfc_component *caf_token; } gfc_component; #define gfc_get_component() XCNEW (gfc_component) +#define gfc_comp_caf_token(cm) (cm)->caf_token->backend_decl /* Formal argument lists are lists of symbols. */ typedef struct gfc_formal_arglist diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index f892d809d209..06d870d80de3 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -85,6 +85,8 @@ static bitmap_obstack labels_obstack; /* True when simplifying a EXPR_VARIABLE argument to an inquiry function. */ static bool inquiry_argument = false; +/* True when we are on left hand side in an assignment of a coarray. */ +static bool caf_lhs = false; /* Is the symbol host associated? */ static bool @@ -5578,7 +5580,7 @@ gfc_resolve_ref (gfc_expr *expr) { int current_part_dimension, n_components, seen_part_dimension, dim; gfc_ref *ref, **prev, *array_ref; - bool equal_length; + bool equal_length, old_caf_lhs; for (ref = expr->ref; ref; ref = ref->next) if (ref->type == REF_ARRAY && ref->u.ar.as == NULL) @@ -5588,13 +5590,18 @@ gfc_resolve_ref (gfc_expr *expr) break; } + old_caf_lhs = caf_lhs; + caf_lhs = false; for (prev = &expr->ref; *prev != NULL; prev = *prev == NULL ? prev : &(*prev)->next) switch ((*prev)->type) { case REF_ARRAY: if (!resolve_array_ref (&(*prev)->u.ar)) - return false; + { + caf_lhs = old_caf_lhs; + return false; + } break; case REF_COMPONENT: @@ -5604,7 +5611,10 @@ gfc_resolve_ref (gfc_expr *expr) case REF_SUBSTRING: equal_length = false; if (!gfc_resolve_substring (*prev, &equal_length)) - return false; + { + caf_lhs = old_caf_lhs; + return false; + } if (expr->expr_type !
[gcc r15-6415] Fortran: Replace getting of coarray data with accessor-based version. [PR107635]
https://gcc.gnu.org/g:586477d67bf2e320e8ec41f82b194259c1dcc43a commit r15-6415-g586477d67bf2e320e8ec41f82b194259c1dcc43a Author: Andre Vehreschild Date: Fri Dec 6 08:57:34 2024 +0100 Fortran: Replace getting of coarray data with accessor-based version. [PR107635] Getting coarray data from remote images was slow, inefficient and did not work for object files that where not compiled with coarray support for derived types with allocatable/pointer components. The old approach emulated accessing data through a whole structure ref, which was error prone for corner cases. Furthermore was did it have a runtime complexity of O(N), where N is the number of allocatable/pointer components and descriptors involved. Each of those needed communication twice. The new approach creates a routine for each access into a coarray object putting all required operations there. Looking a tree-dump one will see those small routines. But this time it is just compiled fortran with all the knowledge of the compiler of bounds and so on. New paradigms will be available out of the box. Furthermore is the complexity of the communication reduced to be O(1). E.g. the mpi implementation sends one message for the parameters of the access and one message back with the results without caring about the number of allocatable/pointer/descriptor components in the access. Identification of access routines is done be adding them to a hash map, where the hash is the same on all images. Translating the hash to an index, which is the same on all images again, allows for fast calls of the access routines. Resolving the hash to an index is cached at runtime, preventing additional hash map lookups. A hashmap was use because not all processor OS combinations may use the same address for the access routine. gcc/fortran/ChangeLog: PR fortran/107635 * gfortran.h (gfc_add_caf_accessor): New function. * gfortran.texi: Document new API routines. * resolve.cc (get_arrayspec_from_expr): Synthesize the arrayspec resulting from an expression, i.e. not only the rank, but also the bounds. (remove_coarray_from_derived_type): Remove coarray ref from a derived type to access it in access routine. (convert_coarray_class_to_derived_type): Same but for classes. The result is a derived type. (split_expr_at_caf_ref): Split an expression at the coarray reference to move the reference after the coarray ref into the access routine. (check_add_new_component): Helper to add variables as components to derived type transfered to the access routine. (create_get_parameter_type): Create the derived type to transfer addressing data to the access routine. (create_get_callback): Create the access routine. (add_caf_get_intrinsic): Use access routine instead of old caf_get. * trans-decl.cc (gfc_build_builtin_function_decls): Register new API routines. (gfc_create_module_variable): Use renamed flag. (gfc_emit_parameter_debug_info): (struct caf_accessor): Linked list of hash-access routine pairs. (gfc_add_caf_accessor): Add a hash-access routine pair to above linked list. (create_caf_accessor_register): Add all registered hash-access routine pairs to the current caf_init. (generate_coarray_init): Use routine above. (gfc_generate_module_vars): Use renamed flag. (generate_local_decl): Same. (gfc_generate_function_code): Same. (gfc_process_block_locals): Same. * trans-intrinsic.cc (conv_shape_to_cst): Build the product of a shape. (gfc_conv_intrinsic_caf_get): Create call to access routine. (conv_caf_send): Adapt to caf_get using less arguments. (gfc_conv_intrinsic_function): Same. * trans.cc (gfc_trans_force_lval): Helper to ensure that an expression can be used as an lvalue-ref. * trans.h (gfc_trans_force_lval): See above. libgfortran/ChangeLog: * caf/libcaf.h (_gfortran_caf_register_accessor): New function to register access routines at runtime. (_gfortran_caf_register_accessors_finish): New function to finish registration of access routine and sort hash map. (_gfortran_caf_get_remote_function_index): New function to convert an hash to an index. (_gfortran_caf_get_by_ct): New function to get data from a remote image using the access routine given by an index. * caf/single.c (struct accessor_hash_t): Hashmap type. (_gfortran_caf
[gcc r15-6416] testsuite: arm: Check for short circuit instructions [PR103298]
https://gcc.gnu.org/g:9e1063ca1c854b13950597fd4a14aff4f15ed822 commit r15-6416-g9e1063ca1c854b13950597fd4a14aff4f15ed822 Author: Torbjörn SVENSSON Date: Sun Nov 10 10:46:39 2024 +0100 testsuite: arm: Check for short circuit instructions [PR103298] Instead of checking that a certain transformation is not used by counting the number of return instructions and the number of BEQ instructions, check that none of CMP, MOV, ORR and AND instructions are suffixed with EQ or NE. Also removed size check as it's very unstable (depends on optimization in use). gcc/testsuite/ChangeLog: PR testsuite/103298 * gcc.target/arm/pr43920-2.c: Change to assembler pattern "(cmp|mov|orr|and)(eq|ne)" for the check. Remove size check. Signed-off-by: Torbjörn SVENSSON Diff: --- gcc/testsuite/gcc.target/arm/pr43920-2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gcc/testsuite/gcc.target/arm/pr43920-2.c b/gcc/testsuite/gcc.target/arm/pr43920-2.c index c367d6bc15dc..7bde9daea046 100644 --- a/gcc/testsuite/gcc.target/arm/pr43920-2.c +++ b/gcc/testsuite/gcc.target/arm/pr43920-2.c @@ -27,6 +27,4 @@ int getFileStartAndLength (int fd, int *start_, size_t *length_) return 0; } -/* { dg-final { scan-assembler-times "pop" 2 } } */ -/* { dg-final { scan-assembler-times "beq" 3 } } */ -/* { dg-final { object-size text <= 54 { target { ! arm*-*-uclinuxfdpiceabi } } } } */ +/* { dg-final { scan-assembler-not "\t(cmp|mov|orr|and)(eq|ne)\t" } } */
[gcc r14-11110] testsuite: arm: Check for short circuit instructions [PR103298]
https://gcc.gnu.org/g:e79105ad8c07e7622dd0c9203f31f0718c7c7bcf commit r14-0-ge79105ad8c07e7622dd0c9203f31f0718c7c7bcf Author: Torbjörn SVENSSON Date: Sun Nov 10 10:46:39 2024 +0100 testsuite: arm: Check for short circuit instructions [PR103298] Instead of checking that a certain transformation is not used by counting the number of return instructions and the number of BEQ instructions, check that none of CMP, MOV, ORR and AND instructions are suffixed with EQ or NE. Also removed size check as it's very unstable (depends on optimization in use). gcc/testsuite/ChangeLog: PR testsuite/103298 * gcc.target/arm/pr43920-2.c: Change to assembler pattern "(cmp|mov|orr|and)(eq|ne)" for the check. Remove size check. Signed-off-by: Torbjörn SVENSSON (cherry picked from commit 9e1063ca1c854b13950597fd4a14aff4f15ed822) Diff: --- gcc/testsuite/gcc.target/arm/pr43920-2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gcc/testsuite/gcc.target/arm/pr43920-2.c b/gcc/testsuite/gcc.target/arm/pr43920-2.c index c367d6bc15dc..7bde9daea046 100644 --- a/gcc/testsuite/gcc.target/arm/pr43920-2.c +++ b/gcc/testsuite/gcc.target/arm/pr43920-2.c @@ -27,6 +27,4 @@ int getFileStartAndLength (int fd, int *start_, size_t *length_) return 0; } -/* { dg-final { scan-assembler-times "pop" 2 } } */ -/* { dg-final { scan-assembler-times "beq" 3 } } */ -/* { dg-final { object-size text <= 54 { target { ! arm*-*-uclinuxfdpiceabi } } } } */ +/* { dg-final { scan-assembler-not "\t(cmp|mov|orr|and)(eq|ne)\t" } } */
[gcc r15-6417] Fortran: fix front-end GMP memleaks
https://gcc.gnu.org/g:2a474c28e573b8604b5fa2584f276d7b7b584cde commit r15-6417-g2a474c28e573b8604b5fa2584f276d7b7b584cde Author: Harald Anlauf Date: Sun Dec 22 21:34:19 2024 +0100 Fortran: fix front-end GMP memleaks gcc/fortran/ChangeLog: * check.cc (gfc_check_random_seed): Clear gmp variables returned by gfc_array_size. * expr.cc (gfc_check_pointer_assign): Likewise. Diff: --- gcc/fortran/check.cc | 32 gcc/fortran/expr.cc | 14 +++--- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc index f10e665088df..f4fde83e8ab5 100644 --- a/gcc/fortran/check.cc +++ b/gcc/fortran/check.cc @@ -7155,12 +7155,16 @@ gfc_check_random_seed (gfc_expr *size, gfc_expr *put, gfc_expr *get) if (!kind_value_check (put, 1, gfc_default_integer_kind)) return false; - if (gfc_array_size (put, &put_size) - && mpz_get_ui (put_size) < seed_size) - gfc_error ("Size of %qs argument of %qs intrinsic at %L " - "too small (%i/%i)", - gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic, - &put->where, (int) mpz_get_ui (put_size), seed_size); + if (gfc_array_size (put, &put_size)) + { + if (mpz_get_ui (put_size) < seed_size) + gfc_error ("Size of %qs argument of %qs intrinsic at %L " + "too small (%i/%i)", + gfc_current_intrinsic_arg[1]->name, + gfc_current_intrinsic, + &put->where, (int) mpz_get_ui (put_size), seed_size); + mpz_clear (put_size); + } } if (get != NULL) @@ -7187,12 +7191,16 @@ gfc_check_random_seed (gfc_expr *size, gfc_expr *put, gfc_expr *get) if (!kind_value_check (get, 2, gfc_default_integer_kind)) return false; - if (gfc_array_size (get, &get_size) - && mpz_get_ui (get_size) < seed_size) - gfc_error ("Size of %qs argument of %qs intrinsic at %L " - "too small (%i/%i)", - gfc_current_intrinsic_arg[2]->name, gfc_current_intrinsic, - &get->where, (int) mpz_get_ui (get_size), seed_size); + if (gfc_array_size (get, &get_size)) +{ + if (mpz_get_ui (get_size) < seed_size) +gfc_error ("Size of %qs argument of %qs intrinsic at %L " + "too small (%i/%i)", + gfc_current_intrinsic_arg[2]->name, + gfc_current_intrinsic, + &get->where, (int) mpz_get_ui (get_size), seed_size); + mpz_clear (get_size); +} } /* RANDOM_SEED may not have more than one non-optional argument. */ diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc index a349d989d6c4..dad383a1aa2b 100644 --- a/gcc/fortran/expr.cc +++ b/gcc/fortran/expr.cc @@ -4364,16 +4364,24 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue, /* If this can be determined, check that the target must be at least as large as the pointer assigned to it is. */ - if (gfc_array_size (lvalue, &lsize) - && gfc_array_size (rvalue, &rsize) - && mpz_cmp (rsize, lsize) < 0) + bool got_lsize = gfc_array_size (lvalue, &lsize); + bool got_rsize = got_lsize && gfc_array_size (rvalue, &rsize); + bool too_small = got_rsize && mpz_cmp (rsize, lsize) < 0; + + if (too_small) { gfc_error ("Rank remapping target is smaller than size of the" " pointer (%ld < %ld) at %L", mpz_get_si (rsize), mpz_get_si (lsize), &lvalue->where); + mpz_clear (lsize); + mpz_clear (rsize); return false; } + if (got_lsize) + mpz_clear (lsize); + if (got_rsize) + mpz_clear (rsize); /* An assumed rank target is an experimental F202y feature. */ if (rvalue->rank == -1 && !(gfc_option.allow_std & GFC_STD_F202Y))
[gcc(refs/users/aoliva/heads/testme)] testsuite: generalized field-merge tests for <32-bit int [PR118025]
https://gcc.gnu.org/g:2bdc6d31e9b714e13303c28fac90cd7d93404c14 commit 2bdc6d31e9b714e13303c28fac90cd7d93404c14 Author: Alexandre Oliva Date: Sun Dec 22 20:31:00 2024 -0300 testsuite: generalized field-merge tests for <32-bit int [PR118025] Explicitly convert constants to the desired types, so as to not elicit warnings about implicit truncations, nor execution errors, on targets whose ints are narrower than 32 bits. for gcc/testsuite/ChangeLog * gcc.dg/field-merge-1.c: Convert constants to desired types. * gcc.dg/field-merge-3.c: Likewise. * gcc.dg/field-merge-4.c: Likewise. * gcc.dg/field-merge-5.c: Likewise. * gcc.dg/field-merge-11.c: Likewise. * gcc.dg/field-merge-17.c: Don't mess with padding bits. Diff: --- gcc/testsuite/gcc.dg/field-merge-1.c | 4 ++-- gcc/testsuite/gcc.dg/field-merge-11.c | 10 +++--- gcc/testsuite/gcc.dg/field-merge-17.c | 4 +++- gcc/testsuite/gcc.dg/field-merge-3.c | 4 ++-- gcc/testsuite/gcc.dg/field-merge-4.c | 6 +++--- gcc/testsuite/gcc.dg/field-merge-5.c | 6 +++--- 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/gcc/testsuite/gcc.dg/field-merge-1.c b/gcc/testsuite/gcc.dg/field-merge-1.c index 4405d40ee79d..4e7f6ae9332a 100644 --- a/gcc/testsuite/gcc.dg/field-merge-1.c +++ b/gcc/testsuite/gcc.dg/field-merge-1.c @@ -25,8 +25,8 @@ struct TB { unsigned char s; } __attribute__ ((packed, aligned (4), scalar_storage_order ("big-endian"))); -#define vc 0xaa -#define vi 0x12345678 +#define vc (unsigned char)0xaa +#define vi (unsigned int)0x12345678 struct TL vL = { vc, vi, vc, vi, vc, vi, vc }; struct TB vB = { vc, vi, vc, vi, vc, vi, vc }; diff --git a/gcc/testsuite/gcc.dg/field-merge-11.c b/gcc/testsuite/gcc.dg/field-merge-11.c index fe627cddd7fd..9e606e3bef16 100644 --- a/gcc/testsuite/gcc.dg/field-merge-11.c +++ b/gcc/testsuite/gcc.dg/field-merge-11.c @@ -10,7 +10,11 @@ struct s { int c; } __attribute__ ((aligned (4))); -struct s p = { 42, (short)(0xef1 - 0x1000), 0x12345678 }; +struct s p = { + (short)(unsigned short)42, + (short)(unsigned short)(0xef1 - 0x1000), + (int)(unsigned int)0x12345678 +}; void f (void) { if (0 @@ -19,9 +23,9 @@ void f (void) { || (int)(signed char)p.b != (int)(signed char)(0xef1 - 0x1000) || (unsigned)(unsigned char)p.b != (unsigned)(unsigned char)(0xef1 - 0x1000) || (unsigned)p.b != (unsigned short)(0xef1 - 0x1000) - || (int)(short)p.b != (int)(0xef1 - 0x1000) + || (int)(short)p.b != (int)(short)(unsigned short)(0xef1 - 0x1000) || (long)(unsigned char)(p.c >> 8) != (long)(unsigned char)0x123456 - || p.c != 0x12345678 + || p.c != (int)(unsigned int)0x12345678 ) __builtin_abort (); } diff --git a/gcc/testsuite/gcc.dg/field-merge-17.c b/gcc/testsuite/gcc.dg/field-merge-17.c index a42658ac5c51..35ead9540606 100644 --- a/gcc/testsuite/gcc.dg/field-merge-17.c +++ b/gcc/testsuite/gcc.dg/field-merge-17.c @@ -3,6 +3,8 @@ /* Check that we can optimize misaligned double-words. */ +#include + struct s { short a; long long b; @@ -33,7 +35,7 @@ int main () { if (fp () > 0) __builtin_abort (); unsigned char *pc = (unsigned char *)&p; - for (int i = 0; i < sizeof (p); i++) + for (int i = 0; i < offsetof (struct s, e) + sizeof (p.e); i++) { pc[i] = 1; if (fp () < 0) diff --git a/gcc/testsuite/gcc.dg/field-merge-3.c b/gcc/testsuite/gcc.dg/field-merge-3.c index a9fe404fa426..e9af4915ad8c 100644 --- a/gcc/testsuite/gcc.dg/field-merge-3.c +++ b/gcc/testsuite/gcc.dg/field-merge-3.c @@ -15,8 +15,8 @@ struct T2 { unsigned int z; } __attribute__((__aligned__(8))); -#define vc 0xaa -#define vi 0x12345678 +#define vc (unsigned char)0xaa +#define vi (unsigned int)0x12345678 struct T1 v1 = { { vc + !BIG_ENDIAN_P, vc + BIG_ENDIAN_P }, vc, vi }; struct T2 v2 = { (vc << 8) | (vc - 1), vc, vi }; diff --git a/gcc/testsuite/gcc.dg/field-merge-4.c b/gcc/testsuite/gcc.dg/field-merge-4.c index c629069e52b2..7c63123a282d 100644 --- a/gcc/testsuite/gcc.dg/field-merge-4.c +++ b/gcc/testsuite/gcc.dg/field-merge-4.c @@ -18,9 +18,9 @@ struct T2 { unsigned int z; } __attribute__((__packed__, __aligned__(4))); -#define vc 0xaa -#define vs 0xccdd -#define vi 0x12345678 +#define vc (unsigned char)0xaa +#define vs (unsigned short)0xccdd +#define vi (unsigned int)0x12345678 struct T1 v1 = { -1, vc, 1, vs, vi }; struct T2 v2 = { -1, 0, vc, 1, vs, vi }; diff --git a/gcc/testsuite/gcc.dg/field-merge-5.c b/gcc/testsuite/gcc.dg/field-merge-5.c index 1580b14bcc93..1b5d1a8cb16e 100644 --- a/gcc/testsuite/gcc.dg/field-merge-5.c +++ b/gcc/testsuite/gcc.dg/field-merge-5.c @@ -18,9 +18,9 @@ struct T2 { unsigned int z; } __attribute__((__packed__, __aligned__(8))); -#define vc 0xaa -#define vs 0xccdd -#define vi 0x12345678 +#define vc (unsigned char)0xaa +#define vs (unsigned short)0xccdd +#define vi (u
[gcc/aoliva/heads/testme] testsuite: generalized field-merge tests for <32-bit int [P
The branch 'aoliva/heads/testme' was updated to point to: 2bdc6d31e9b7... testsuite: generalized field-merge tests for <32-bit int [P It previously pointed to: b35a663c550f... testsuite: generalized field-merge tests for <32-bit int [P Diff: !!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST): --- b35a663... testsuite: generalized field-merge tests for <32-bit int [P Summary of changes (added commits): --- 2bdc6d3... testsuite: generalized field-merge tests for <32-bit int [P
[gcc/aoliva/heads/testme] (2 commits) testsuite: generalized field-merge tests for <32-bit int [P
The branch 'aoliva/heads/testme' was updated to point to: b35a663c550f... testsuite: generalized field-merge tests for <32-bit int [P It previously pointed to: 68981680a46c... testsuite: generalize ifcombine field-merge tests [PR118025 Diff: !!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST): --- 6898168... testsuite: generalize ifcombine field-merge tests [PR118025 Summary of changes (added commits): --- b35a663... testsuite: generalized field-merge tests for <32-bit int [P d70ab98... testsuite: generalize ifcombine field-merge tests [PR118025
[gcc(refs/users/aoliva/heads/testme)] testsuite: generalize ifcombine field-merge tests [PR118025]
https://gcc.gnu.org/g:d70ab982503f257b13cd9269360fdfcd0ee70ac7 commit d70ab982503f257b13cd9269360fdfcd0ee70ac7 Author: Alexandre Oliva Date: Fri Dec 20 18:58:01 2024 -0300 testsuite: generalize ifcombine field-merge tests [PR118025] A number of tests that check for specific ifcombine transformations fail on AVR and PRU targets, whose type sizes and alignments aren't conducive of the expected transformations. Adjust the expectations. Most execution tests should run successfully regardless of the transformations, but a few that could conceivably fail if short and char have the same bit width now check for that and bypass the tests that would fail. Conversely, one test that had such a runtime test, but that would work regardless, no longer has that runtime test, and its types are narrowed so that the transformations on 32-bit targets are more likely to be the same as those that used to take place on 64-bit targets. This latter change is somewhat obviated by a separate patch, but I've left it in place anyway. for gcc/testsuite/ChangeLog PR testsuite/118025 * field-merge-1.c: Skip BIT_FIELD_REF counting on AVR and PRU. * field-merge-3.c: Bypass the test if short doesn't have the expected size. * field-merge-8.c: Likewise. * field-merge-9.c: Likewise. Skip optimization counting on AVR and PRU. * field-merge-14.c: Skip optimization counting on AVR and PRU. * field-merge-15.c: Likewise. * field-merge-17.c: Likewise. * field-merge-16.c: Likewise. Drop runtime bypass. Use smaller types. Diff: --- gcc/testsuite/gcc.dg/field-merge-1.c | 2 +- gcc/testsuite/gcc.dg/field-merge-13.c | 2 +- gcc/testsuite/gcc.dg/field-merge-14.c | 3 ++- gcc/testsuite/gcc.dg/field-merge-15.c | 2 +- gcc/testsuite/gcc.dg/field-merge-16.c | 17 +++-- gcc/testsuite/gcc.dg/field-merge-17.c | 2 +- gcc/testsuite/gcc.dg/field-merge-3.c | 2 ++ gcc/testsuite/gcc.dg/field-merge-8.c | 2 ++ gcc/testsuite/gcc.dg/field-merge-9.c | 4 +++- 9 files changed, 20 insertions(+), 16 deletions(-) diff --git a/gcc/testsuite/gcc.dg/field-merge-1.c b/gcc/testsuite/gcc.dg/field-merge-1.c index 1818e104437e..4405d40ee79d 100644 --- a/gcc/testsuite/gcc.dg/field-merge-1.c +++ b/gcc/testsuite/gcc.dg/field-merge-1.c @@ -58,7 +58,7 @@ int main () { return 0; } -/* { dg-final { scan-tree-dump-times "BIT_FIELD_REF" 8 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "BIT_FIELD_REF" 8 "optimized" { target { ! { avr-*-* pru-*-* } } } } } */ /* { dg-final { scan-assembler-not "cmpb" { target { i*86-*-* || x86_64-*-* } } } } */ /* { dg-final { scan-assembler-times "cmpl" 8 { target { i*86-*-* || x86_64-*-* } } } } */ /* { dg-final { scan-assembler-times "cmpw" 8 { target { powerpc*-*-* || rs6000-*-* } } } } */ diff --git a/gcc/testsuite/gcc.dg/field-merge-13.c b/gcc/testsuite/gcc.dg/field-merge-13.c index 7e4f4c499347..eeef73338f8e 100644 --- a/gcc/testsuite/gcc.dg/field-merge-13.c +++ b/gcc/testsuite/gcc.dg/field-merge-13.c @@ -90,4 +90,4 @@ int main () { return 0; } -/* { dg-final { scan-tree-dump-times "optimizing" 9 "ifcombine" } } */ +/* { dg-final { scan-tree-dump-times "optimizing" 9 "ifcombine" { target { ! { avr-*-* pru-*-* } } } } } */ diff --git a/gcc/testsuite/gcc.dg/field-merge-14.c b/gcc/testsuite/gcc.dg/field-merge-14.c index 91d84cfebf19..73259e0936e4 100644 --- a/gcc/testsuite/gcc.dg/field-merge-14.c +++ b/gcc/testsuite/gcc.dg/field-merge-14.c @@ -1,7 +1,8 @@ /* { dg-do run } */ /* { dg-options "-O -fdump-tree-ifcombine-details" } */ -/* Check that we don't get confused by multiple conversions. */ +/* Check that we don't get confused by multiple conversions. Conceivably, we + could combine both tests using b, but the current logic won't do that. */ __attribute__((noipa)) int f(int *a,int *d) diff --git a/gcc/testsuite/gcc.dg/field-merge-15.c b/gcc/testsuite/gcc.dg/field-merge-15.c index 34641e893c92..fc3846452716 100644 --- a/gcc/testsuite/gcc.dg/field-merge-15.c +++ b/gcc/testsuite/gcc.dg/field-merge-15.c @@ -33,4 +33,4 @@ int main () { return 0; } -/* { dg-final { scan-tree-dump-times "optimizing" 6 "ifcombine" } } */ +/* { dg-final { scan-tree-dump-times "optimizing" 6 "ifcombine" { target { ! { avr-*-* pru-*-* } } } } } */ diff --git a/gcc/testsuite/gcc.dg/field-merge-16.c b/gcc/testsuite/gcc.dg/field-merge-16.c index 2ca23ea663a4..afdaf45b6a94 100644 --- a/gcc/testsuite/gcc.dg/field-merge-16.c +++ b/gcc/testsuite/gcc.dg/field-merge-16.c @@ -4,17 +4,17 @@ /* Check that tests for sign-extension bits are handled correctly. */ struct s { - short a; - short b; - unsigned short c; - unsigned short d; -} __attribute__ ((aligned (8))); + signed char a; + signed char b; + unsigned char c; + unsigned char d; +} __attribute__ ((alig
[gcc(refs/users/aoliva/heads/testme)] testsuite: generalized field-merge tests for <32-bit int [PR118025]
https://gcc.gnu.org/g:b35a663c550f85dc8e438b3bf874b240c21a176e commit b35a663c550f85dc8e438b3bf874b240c21a176e Author: Alexandre Oliva Date: Sun Dec 22 20:31:00 2024 -0300 testsuite: generalized field-merge tests for <32-bit int [PR118025] Explicitly convert constants to the desired types, so as to not elicit warnings about implicit truncations, nor execution errors, on targets whose ints are narrower than 32 bits. for gcc/testsuite/ChangeLog * gcc.dg/field-merge-1.c: Convert constants to desired types. * gcc.dg/field-merge-3.c: Likewise. * gcc.dg/field-merge-4.c: Likewise. * gcc.dg/field-merge-5.c: Likewise. * gcc.dg/field-merge-11.c: Likewise. * gcc.dg/field-merge-17.c: Don't mess with padding bits. Diff: --- gcc/testsuite/gcc.dg/field-merge-1.c | 4 ++-- gcc/testsuite/gcc.dg/field-merge-11.c | 10 +++--- gcc/testsuite/gcc.dg/field-merge-17.c | 2 +- gcc/testsuite/gcc.dg/field-merge-3.c | 4 ++-- gcc/testsuite/gcc.dg/field-merge-4.c | 6 +++--- gcc/testsuite/gcc.dg/field-merge-5.c | 6 +++--- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/gcc/testsuite/gcc.dg/field-merge-1.c b/gcc/testsuite/gcc.dg/field-merge-1.c index 4405d40ee79d..4e7f6ae9332a 100644 --- a/gcc/testsuite/gcc.dg/field-merge-1.c +++ b/gcc/testsuite/gcc.dg/field-merge-1.c @@ -25,8 +25,8 @@ struct TB { unsigned char s; } __attribute__ ((packed, aligned (4), scalar_storage_order ("big-endian"))); -#define vc 0xaa -#define vi 0x12345678 +#define vc (unsigned char)0xaa +#define vi (unsigned int)0x12345678 struct TL vL = { vc, vi, vc, vi, vc, vi, vc }; struct TB vB = { vc, vi, vc, vi, vc, vi, vc }; diff --git a/gcc/testsuite/gcc.dg/field-merge-11.c b/gcc/testsuite/gcc.dg/field-merge-11.c index fe627cddd7fd..9e606e3bef16 100644 --- a/gcc/testsuite/gcc.dg/field-merge-11.c +++ b/gcc/testsuite/gcc.dg/field-merge-11.c @@ -10,7 +10,11 @@ struct s { int c; } __attribute__ ((aligned (4))); -struct s p = { 42, (short)(0xef1 - 0x1000), 0x12345678 }; +struct s p = { + (short)(unsigned short)42, + (short)(unsigned short)(0xef1 - 0x1000), + (int)(unsigned int)0x12345678 +}; void f (void) { if (0 @@ -19,9 +23,9 @@ void f (void) { || (int)(signed char)p.b != (int)(signed char)(0xef1 - 0x1000) || (unsigned)(unsigned char)p.b != (unsigned)(unsigned char)(0xef1 - 0x1000) || (unsigned)p.b != (unsigned short)(0xef1 - 0x1000) - || (int)(short)p.b != (int)(0xef1 - 0x1000) + || (int)(short)p.b != (int)(short)(unsigned short)(0xef1 - 0x1000) || (long)(unsigned char)(p.c >> 8) != (long)(unsigned char)0x123456 - || p.c != 0x12345678 + || p.c != (int)(unsigned int)0x12345678 ) __builtin_abort (); } diff --git a/gcc/testsuite/gcc.dg/field-merge-17.c b/gcc/testsuite/gcc.dg/field-merge-17.c index a42658ac5c51..2669053b99cf 100644 --- a/gcc/testsuite/gcc.dg/field-merge-17.c +++ b/gcc/testsuite/gcc.dg/field-merge-17.c @@ -33,7 +33,7 @@ int main () { if (fp () > 0) __builtin_abort (); unsigned char *pc = (unsigned char *)&p; - for (int i = 0; i < sizeof (p); i++) + for (int i = 0; i < offsetof (struct s, e) + sizeof (p.e); i++) { pc[i] = 1; if (fp () < 0) diff --git a/gcc/testsuite/gcc.dg/field-merge-3.c b/gcc/testsuite/gcc.dg/field-merge-3.c index a9fe404fa426..e9af4915ad8c 100644 --- a/gcc/testsuite/gcc.dg/field-merge-3.c +++ b/gcc/testsuite/gcc.dg/field-merge-3.c @@ -15,8 +15,8 @@ struct T2 { unsigned int z; } __attribute__((__aligned__(8))); -#define vc 0xaa -#define vi 0x12345678 +#define vc (unsigned char)0xaa +#define vi (unsigned int)0x12345678 struct T1 v1 = { { vc + !BIG_ENDIAN_P, vc + BIG_ENDIAN_P }, vc, vi }; struct T2 v2 = { (vc << 8) | (vc - 1), vc, vi }; diff --git a/gcc/testsuite/gcc.dg/field-merge-4.c b/gcc/testsuite/gcc.dg/field-merge-4.c index c629069e52b2..7c63123a282d 100644 --- a/gcc/testsuite/gcc.dg/field-merge-4.c +++ b/gcc/testsuite/gcc.dg/field-merge-4.c @@ -18,9 +18,9 @@ struct T2 { unsigned int z; } __attribute__((__packed__, __aligned__(4))); -#define vc 0xaa -#define vs 0xccdd -#define vi 0x12345678 +#define vc (unsigned char)0xaa +#define vs (unsigned short)0xccdd +#define vi (unsigned int)0x12345678 struct T1 v1 = { -1, vc, 1, vs, vi }; struct T2 v2 = { -1, 0, vc, 1, vs, vi }; diff --git a/gcc/testsuite/gcc.dg/field-merge-5.c b/gcc/testsuite/gcc.dg/field-merge-5.c index 1580b14bcc93..1b5d1a8cb16e 100644 --- a/gcc/testsuite/gcc.dg/field-merge-5.c +++ b/gcc/testsuite/gcc.dg/field-merge-5.c @@ -18,9 +18,9 @@ struct T2 { unsigned int z; } __attribute__((__packed__, __aligned__(8))); -#define vc 0xaa -#define vs 0xccdd -#define vi 0x12345678 +#define vc (unsigned char)0xaa +#define vs (unsigned short)0xccdd +#define vi (unsigned int)0x12345678 struct T1 v1 = { -1, vc, 1, vs, vi }; struct T2 v2 = { -1, 0, vc, 1, vs, vi };
[gcc r14-11109] Fortran: Fix testsuite regressions after r15-5083 [PR117797]
https://gcc.gnu.org/g:d1710c420a0fcea40c983eff2427fe72072099da commit r14-11109-gd1710c420a0fcea40c983eff2427fe72072099da Author: Paul Thomas Date: Thu Dec 12 17:50:56 2024 + Fortran: Fix testsuite regressions after r15-5083 [PR117797] 2024-12-12 Paul Thomas gcc/fortran PR fortran/117797 * trans-array.cc (class_array_element_size): New function. (gfc_get_array_span): Refactor, using class_array_element_size to return the span for descriptors that are the _data component of a class expression and then class dummy references. Revert the conditions to those before r15-5083 tidying up using 'sym'. gcc/testsuite/ PR fortran/117797 * gfortran.dg/pr117797.f90: New test. (cherry picked from commit d4330ff9bc9a2995e79d88b09a2ee76673167661) Diff: --- gcc/fortran/trans-array.cc | 61 +++--- gcc/testsuite/gfortran.dg/pr117797.f90 | 55 ++ 2 files changed, 81 insertions(+), 35 deletions(-) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index fe69b694e0da..d9aaa9bceae4 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -955,6 +955,26 @@ get_CFI_desc (gfc_symbol *sym, gfc_expr *expr, } +/* A helper function for gfc_get_array_span that returns the array element size + of a class entity. */ +static tree +class_array_element_size (tree decl, bool unlimited) +{ + /* Class dummys usually require extraction from the saved descriptor, + which gfc_class_vptr_get does for us if necessary. This, of course, + will be a component of the class object. */ + tree vptr = gfc_class_vptr_get (decl); + /* If this is an unlimited polymorphic entity with a character payload, + the element size will be corrected for the string length. */ + if (unlimited) +return gfc_resize_class_size_with_len (NULL, + TREE_OPERAND (vptr, 0), + gfc_vptr_size_get (vptr)); + else +return gfc_vptr_size_get (vptr); +} + + /* Return the span of an array. */ tree @@ -984,49 +1004,20 @@ gfc_get_array_span (tree desc, gfc_expr *expr) desc = build_fold_indirect_ref_loc (input_location, desc); tmp = gfc_conv_descriptor_span_get (desc); } - else if (UNLIMITED_POLY (expr) - || (sym && UNLIMITED_POLY (sym))) -{ - /* Treat unlimited polymorphic expressions separately because -the element size need not be the same as the span. Obtain -the class container, which is simplified here by there being -no component references. */ - if (sym && sym->attr.dummy) - { - tmp = gfc_get_symbol_decl (sym); - tmp = GFC_DECL_SAVED_DESCRIPTOR (tmp); - if (INDIRECT_REF_P (tmp)) - tmp = TREE_OPERAND (tmp, 0); - } - else - { - gcc_assert (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (desc))); - tmp = TREE_OPERAND (desc, 0); - } - tmp = gfc_class_data_get (tmp); - tmp = gfc_conv_descriptor_span_get (tmp); -} else if (TREE_CODE (desc) == COMPONENT_REF && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (desc)) && GFC_CLASS_TYPE_P (TREE_TYPE (TREE_OPERAND (desc, 0 -{ - /* The descriptor is a class _data field. Use the vtable size -since it is guaranteed to have been set and is always OK for -class array descriptors that are not unlimited. */ - tmp = gfc_get_vptr_from_expr (desc); - tmp = gfc_vptr_size_get (tmp); -} +/* The descriptor is the _data field of a class object. */ +tmp = class_array_element_size (TREE_OPERAND (desc, 0), + UNLIMITED_POLY (expr)); else if (sym && sym->ts.type == BT_CLASS && expr->ref->type == REF_COMPONENT && expr->ref->next->type == REF_ARRAY && expr->ref->next->next == NULL && CLASS_DATA (sym)->attr.dimension) -{ - /* Class dummys usually require extraction from the saved -descriptor, which gfc_class_vptr_get does for us. */ - tmp = gfc_class_vptr_get (sym->backend_decl); - tmp = gfc_vptr_size_get (tmp); -} +/* Having escaped the above, this can only be a class array dummy. */ +tmp = class_array_element_size (sym->backend_decl, + UNLIMITED_POLY (sym)); else { /* If none of the fancy stuff works, the span is the element diff --git a/gcc/testsuite/gfortran.dg/pr117797.f90 b/gcc/testsuite/gfortran.dg/pr117797.f90 new file mode 100644 index ..25c0c04e6c3d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr117797.f90 @@ -0,0 +1,55 @@ +! { dg-do run } +! +! Test the fix for the regression caused by r15-5083. +! +! Contributed by Neil Carlson +! +module foo + + type, public :: any_matrix +private +clas
[gcc r13-9264] Fortran: Fix testsuite regressions after r15-5083 [PR117797]
https://gcc.gnu.org/g:61bc5767dbb223506883093fb6ba6be1048e4657 commit r13-9264-g61bc5767dbb223506883093fb6ba6be1048e4657 Author: Paul Thomas Date: Thu Dec 12 17:50:56 2024 + Fortran: Fix testsuite regressions after r15-5083 [PR117797] 2024-12-12 Paul Thomas gcc/fortran PR fortran/117797 * trans-array.cc (class_array_element_size): New function. (gfc_get_array_span): Refactor, using class_array_element_size to return the span for descriptors that are the _data component of a class expression and then class dummy references. Revert the conditions to those before r15-5083 tidying up using 'sym'. gcc/testsuite/ PR fortran/117797 * gfortran.dg/pr117797.f90: New test. (cherry picked from commit d4330ff9bc9a2995e79d88b09a2ee76673167661) Diff: --- gcc/fortran/trans-array.cc | 61 +++--- gcc/testsuite/gfortran.dg/pr117797.f90 | 55 ++ 2 files changed, 81 insertions(+), 35 deletions(-) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 76e397b2a0ed..77faf3070ab1 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -937,6 +937,26 @@ get_CFI_desc (gfc_symbol *sym, gfc_expr *expr, } +/* A helper function for gfc_get_array_span that returns the array element size + of a class entity. */ +static tree +class_array_element_size (tree decl, bool unlimited) +{ + /* Class dummys usually require extraction from the saved descriptor, + which gfc_class_vptr_get does for us if necessary. This, of course, + will be a component of the class object. */ + tree vptr = gfc_class_vptr_get (decl); + /* If this is an unlimited polymorphic entity with a character payload, + the element size will be corrected for the string length. */ + if (unlimited) +return gfc_resize_class_size_with_len (NULL, + TREE_OPERAND (vptr, 0), + gfc_vptr_size_get (vptr)); + else +return gfc_vptr_size_get (vptr); +} + + /* Return the span of an array. */ tree @@ -966,49 +986,20 @@ gfc_get_array_span (tree desc, gfc_expr *expr) desc = build_fold_indirect_ref_loc (input_location, desc); tmp = gfc_conv_descriptor_span_get (desc); } - else if (UNLIMITED_POLY (expr) - || (sym && UNLIMITED_POLY (sym))) -{ - /* Treat unlimited polymorphic expressions separately because -the element size need not be the same as the span. Obtain -the class container, which is simplified here by there being -no component references. */ - if (sym && sym->attr.dummy) - { - tmp = gfc_get_symbol_decl (sym); - tmp = GFC_DECL_SAVED_DESCRIPTOR (tmp); - if (INDIRECT_REF_P (tmp)) - tmp = TREE_OPERAND (tmp, 0); - } - else - { - gcc_assert (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (desc))); - tmp = TREE_OPERAND (desc, 0); - } - tmp = gfc_class_data_get (tmp); - tmp = gfc_conv_descriptor_span_get (tmp); -} else if (TREE_CODE (desc) == COMPONENT_REF && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (desc)) && GFC_CLASS_TYPE_P (TREE_TYPE (TREE_OPERAND (desc, 0 -{ - /* The descriptor is a class _data field. Use the vtable size -since it is guaranteed to have been set and is always OK for -class array descriptors that are not unlimited. */ - tmp = gfc_get_vptr_from_expr (desc); - tmp = gfc_vptr_size_get (tmp); -} +/* The descriptor is the _data field of a class object. */ +tmp = class_array_element_size (TREE_OPERAND (desc, 0), + UNLIMITED_POLY (expr)); else if (sym && sym->ts.type == BT_CLASS && expr->ref->type == REF_COMPONENT && expr->ref->next->type == REF_ARRAY && expr->ref->next->next == NULL && CLASS_DATA (sym)->attr.dimension) -{ - /* Class dummys usually require extraction from the saved -descriptor, which gfc_class_vptr_get does for us. */ - tmp = gfc_class_vptr_get (sym->backend_decl); - tmp = gfc_vptr_size_get (tmp); -} +/* Having escaped the above, this can only be a class array dummy. */ +tmp = class_array_element_size (sym->backend_decl, + UNLIMITED_POLY (sym)); else { /* If none of the fancy stuff works, the span is the element diff --git a/gcc/testsuite/gfortran.dg/pr117797.f90 b/gcc/testsuite/gfortran.dg/pr117797.f90 new file mode 100644 index ..25c0c04e6c3d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr117797.f90 @@ -0,0 +1,55 @@ +! { dg-do run } +! +! Test the fix for the regression caused by r15-5083. +! +! Contributed by Neil Carlson +! +module foo + + type, public :: any_matrix +private +class(
[gcc r15-6412] Ada: Add GNU/Hurd glibc api bits
https://gcc.gnu.org/g:e7e653d3836909182ee0cf46bc2fcc04f3c055f8 commit r15-6412-ge7e653d3836909182ee0cf46bc2fcc04f3c055f8 Author: Samuel Thibault Date: Sun Dec 22 01:13:03 2024 +0100 Ada: Add GNU/Hurd glibc api bits They are mostly shared with Linux gcc/ada/ChangeLog: * s-oscons-tmplt.c [__GNU__] (_XOPEN_SOURCE, _BSD_SOURCE): Define. [__GNU__]: Include and [__GNU__]: Set MSG_Forced_Flags to "MSG_NOSIGNAL". [__GNU__]: Define SIZEOF_sigset. [__GNU__]: Define PTHREAD_*SIZE Signed-off-by: Samuel Thibault Diff: --- gcc/ada/s-oscons-tmplt.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c index 96eb99dfdac4..4e1f6fbdd2b0 100644 --- a/gcc/ada/s-oscons-tmplt.c +++ b/gcc/ada/s-oscons-tmplt.c @@ -86,7 +86,7 @@ pragma Style_Checks ("N"); ** a number of non-POSIX but useful/required features. **/ -#if defined (__linux__) || defined (__ANDROID__) +#if defined (__linux__) || defined (__ANDROID__) || defined (__GNU__) /* Define _XOPEN_SOURCE to get IOV_MAX */ # if !defined (_XOPEN_SOURCE) @@ -96,7 +96,7 @@ pragma Style_Checks ("N"); /* Define _BSD_SOURCE to get CRTSCTS */ # define _BSD_SOURCE -#endif /* defined (__linux__) || defined (__ANDROID__) */ +#endif /* defined (__linux__) || defined (__ANDROID__) || defined (__GNU__) */ /* Include gsocket.h before any system header so it can redefine FD_SETSIZE */ @@ -160,7 +160,7 @@ pragma Style_Checks ("N"); #endif #if defined (__linux__) || defined (__ANDROID__) || defined (__QNX__) \ - || defined (__rtems__) + || defined (__rtems__) || defined (__GNU__) # include # include #endif @@ -1469,7 +1469,7 @@ CND(MSG_WAITALL, "Wait for full reception") #endif CND(MSG_NOSIGNAL, "No SIGPIPE on send") -#if defined (__linux__) || defined (__ANDROID__) || defined (__QNX__) +#if defined (__linux__) || defined (__ANDROID__) || defined (__QNX__) || defined (__GNU__) # define MSG_Forced_Flags "MSG_NOSIGNAL" #else # define MSG_Forced_Flags "0" @@ -1938,7 +1938,7 @@ CST(Poll_Linkname, "") #endif /* HAVE_SOCKETS */ -#if defined (__linux__) || defined (__ANDROID__) || defined (__QNX__) +#if defined (__linux__) || defined (__ANDROID__) || defined (__QNX__) || defined (__GNU__) #define SIZEOF_sigset (sizeof (sigset_t)) CND(SIZEOF_sigset, "sigset") #endif @@ -1999,7 +1999,7 @@ CNS(CLOCK_RT_Ada, "") #if defined (__APPLE__) || defined (__ANDROID__) || defined (DUMMY) \ || defined (__FreeBSD__) || defined (__linux__) \ - || defined (__QNX__) || defined (__rtems__) + || defined (__QNX__) || defined (__rtems__) || defined (__GNU__) /* @@ -2044,7 +2044,7 @@ CND(PTHREAD_RWLOCK_SIZE, "pthread_rwlock_t") CND(PTHREAD_ONCE_SIZE, "pthread_once_t") #endif /* __APPLE__ || __ANDROID__ || __FreeBSD ||__linux__ - || __QNX__|| __rtems__ */ + || __QNX__|| __rtems__ || __GNU__ */ /*
[gcc r15-6413] Ada: Fix GNU/Hurd maximum priority
https://gcc.gnu.org/g:d9d92b1c1b418dc5f8298cd75f8bdd5b0bfa9837 commit r15-6413-gd9d92b1c1b418dc5f8298cd75f8bdd5b0bfa9837 Author: Samuel Thibault Date: Sun Dec 22 01:13:04 2024 +0100 Ada: Fix GNU/Hurd maximum priority gcc/ada/ChangeLog: * libgnat/system-gnu.ads: Set Max_Priority to 60. Signed-off-by: Samuel Thibault Diff: --- gcc/ada/libgnat/system-gnu.ads | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/libgnat/system-gnu.ads b/gcc/ada/libgnat/system-gnu.ads index f46b32359f2a..5049ab88856e 100644 --- a/gcc/ada/libgnat/system-gnu.ads +++ b/gcc/ada/libgnat/system-gnu.ads @@ -95,7 +95,7 @@ package System is -- Priority-related Declarations (RM D.1) - Max_Priority : constant Positive := 0; + Max_Priority : constant Positive := 60; Max_Interrupt_Priority : constant Positive := 63; subtype Any_Priority is Integer range 0 .. 63;