From 156cc1c66bc15e70e499bce32f93ef2e11697827 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 27 May 2025 00:26:29 +0000 Subject: Daily bump. --- gcc/DATESTAMP | 2 +- gcc/cp/ChangeLog | 9 +++++++++ gcc/testsuite/ChangeLog | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index dbf258b..ed9a6b1 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250526 +20250527 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 59bc179..7f31e05 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2025-05-26 Tobias Burnus + + Backported from master: + 2025-05-26 Tobias Burnus + + PR c++/120413 + * semantics.cc (finish_omp_target_clauses_r): Handle + BIND_EXPR with empty BIND_EXPR_BLOCK. + 2025-05-23 Nathaniel Shead Backported from master: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 750a1b9..e3c1c2d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,24 @@ +2025-05-26 Tobias Burnus + + Backported from master: + 2025-05-26 Tobias Burnus + + PR middle-end/118694 + * c-c++-common/gomp/attrs-metadirective-3.c: Change to never + expect 'omp metadirective' in the dump. If !offload_nvptx, check + that no 'teams' shows up in the dump; for offload_nvptx, expect + OMP_NEXT_VARIANT and an error about directive between 'target' + and 'teams'. + * c-c++-common/gomp/metadirective-3.c: Likewise. + +2025-05-26 Tobias Burnus + + Backported from master: + 2025-05-26 Tobias Burnus + + PR c++/120413 + * g++.dg/gomp/target-4.C: New test. + 2025-05-23 Nathaniel Shead Backported from master: -- cgit v1.1 From 9933a963a587349e22862668ea693bc1d4cc6693 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 27 May 2025 09:11:58 +0100 Subject: doc: Fix typo in description of nonstring attribute gcc/ChangeLog: * doc/extend.texi (Common Variable Attributes): Fix typo in description of nonstring. (cherry picked from commit 351e60095cfaa73b5ac69222d00e0cd4ae5725d4) --- gcc/doc/extend.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 0978c4c..72b8e37 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -7336,7 +7336,7 @@ truncate the copy without appending the terminating @code{NUL} character. Using the attribute makes it possible to suppress the warning. However, when the array is declared with the attribute the call to @code{strlen} is diagnosed because when the array doesn't contain a @code{NUL}-terminated -string the call is undefined. To copy, compare, of search non-string +string the call is undefined. To copy, compare, or search non-string character arrays use the @code{memcpy}, @code{memcmp}, @code{memchr}, and other functions that operate on arrays of bytes. In addition, calling @code{strnlen} and @code{strndup} with such arrays is safe -- cgit v1.1 From c2b90bf1343b491c58a51f6668da34383bf4c093 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 27 May 2025 19:42:17 +0200 Subject: Fix IPA-SRA issue with reverse SSO on specific pattern IPA-SRA generally works fine in the presence of reverse Scalar_Storage_Order by propagating the relevant flag onto the newly generated MEM_REFs. However we have been recently faced with a specific Ada pattern that it does not handle correctly: the 'Valid attribute applied to a floating-point component of an aggregate type with reverse Scalar_Storage_Order. The attribute is implemented by a call to a specific routine of the runtime that expects a pointer to the object so, in the case of a component with reverse SSO, the compiler first loads it from the aggregate to get back the native storage order, but it does the load using an array of bytes instead of the floating-point type to prevent the FPU from fiddling with the value, which yields in the .original dump file: *(character[1:4] *) &F2b = VIEW_CONVERT_EXPR(item.f); Of course that's a bit convoluted, but it does not seem that another method would be simpler or even work, and using VIEW_CONVERT_EXPR to toggle the SSO is supposed to be supported in any case (unlike aliasing or type punning). The attached patch makes it work. While the call to storage_order_barrier_p from IPA-SRA is quite natural (the regular SRA has it too), the tweak to the predicate itself is needed to handle the scalar->aggregate conversion, which is admittedly awkward but again without clear alternative. gcc/ * ipa-sra.cc (scan_expr_access): Also disqualify storage order barriers from splitting. * tree.h (storage_order_barrier_p): Also return false if the operand of the VIEW_CONVERT_EXPR has reverse storage order. gcc/testsuite/ * gnat.dg/sso19.adb: New test. * gnat.dg/sso19_pkg.ads, gnat.dg/sso19_pkg.adb: New helper. --- gcc/ipa-sra.cc | 6 ++++++ gcc/testsuite/gnat.dg/sso19.adb | 13 +++++++++++++ gcc/testsuite/gnat.dg/sso19_pkg.adb | 13 +++++++++++++ gcc/testsuite/gnat.dg/sso19_pkg.ads | 24 ++++++++++++++++++++++++ gcc/tree.h | 2 +- 5 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gnat.dg/sso19.adb create mode 100644 gcc/testsuite/gnat.dg/sso19_pkg.adb create mode 100644 gcc/testsuite/gnat.dg/sso19_pkg.ads (limited to 'gcc') diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc index 88bfae9..6e6cf89 100644 --- a/gcc/ipa-sra.cc +++ b/gcc/ipa-sra.cc @@ -1848,6 +1848,12 @@ scan_expr_access (tree expr, gimple *stmt, isra_scan_context ctx, if (!desc || !desc->split_candidate) return; + if (storage_order_barrier_p (expr)) + { + disqualify_split_candidate (desc, "Encountered a storage order barrier."); + return; + } + if (!poffset.is_constant (&offset) || !psize.is_constant (&size) || !pmax_size.is_constant (&max_size)) diff --git a/gcc/testsuite/gnat.dg/sso19.adb b/gcc/testsuite/gnat.dg/sso19.adb new file mode 100644 index 0000000..497d9874 --- /dev/null +++ b/gcc/testsuite/gnat.dg/sso19.adb @@ -0,0 +1,13 @@ +-- { dg-do run } +-- { dg-options "-O2" } + +with SSO19_Pkg; use SSO19_Pkg; + +procedure SSO19 is + R : constant Rec := (D => (I => 8, F => 4.6095713E-41)); + +begin + if not Is_Valid (R) then + raise Program_Error; + end if; +end; diff --git a/gcc/testsuite/gnat.dg/sso19_pkg.adb b/gcc/testsuite/gnat.dg/sso19_pkg.adb new file mode 100644 index 0000000..cbcb2f9 --- /dev/null +++ b/gcc/testsuite/gnat.dg/sso19_pkg.adb @@ -0,0 +1,13 @@ +package body SSO19_Pkg is + + function Is_Valid_Private (Item : Data) return Boolean is + begin + return Item.I'Valid and Item.F'Valid; + end Is_Valid_Private; + + function Is_Valid (Item : Rec) return Boolean is + begin + return Is_Valid_Private (Item.D); + end Is_Valid; + +end SSO19_Pkg; diff --git a/gcc/testsuite/gnat.dg/sso19_pkg.ads b/gcc/testsuite/gnat.dg/sso19_pkg.ads new file mode 100644 index 0000000..cad5368 --- /dev/null +++ b/gcc/testsuite/gnat.dg/sso19_pkg.ads @@ -0,0 +1,24 @@ +with System; + +package SSO19_Pkg is + + subtype Small_Int is Short_Integer range -1000 .. 1000; + + type Data is record + I : Small_Int; + F : Float; + end record; + for Data use record + I at 0 range 0 .. 15; + F at 4 range 0 .. 31; + end record; + for Data'Bit_Order use System.High_Order_First; + for Data'Scalar_Storage_Order use System.High_Order_First; + + type Rec is record + D : Data; + end record; + + function Is_Valid (Item : Rec) return Boolean; + +end SSO19_Pkg; diff --git a/gcc/tree.h b/gcc/tree.h index 99f2617..1e41316 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -5499,7 +5499,7 @@ storage_order_barrier_p (const_tree t) && TYPE_REVERSE_STORAGE_ORDER (TREE_TYPE (op))) return true; - return false; + return reverse_storage_order_for_component_p (op); } /* Given a DECL or TYPE, return the scope in which it was declared, or -- cgit v1.1 From 772dc2841cad6d7ba54afac1897be1668ce40d0d Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 28 May 2025 00:24:39 +0000 Subject: Daily bump. --- gcc/ChangeLog | 15 +++++++++++++++ gcc/DATESTAMP | 2 +- gcc/testsuite/ChangeLog | 5 +++++ 3 files changed, 21 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d7e8702..4287b97 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2025-05-27 Eric Botcazou + + * ipa-sra.cc (scan_expr_access): Also disqualify storage order + barriers from splitting. + * tree.h (storage_order_barrier_p): Also return false if the + operand of the VIEW_CONVERT_EXPR has reverse storage order. + +2025-05-27 Jonathan Wakely + + Backported from master: + 2025-05-27 Jonathan Wakely + + * doc/extend.texi (Common Variable Attributes): Fix typo in + description of nonstring. + 2025-05-25 Michael J. Eager PR target/86772 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ed9a6b1..4044138 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250527 +20250528 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e3c1c2d..761905b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2025-05-27 Eric Botcazou + + * gnat.dg/sso19.adb: New test. + * gnat.dg/sso19_pkg.ads, gnat.dg/sso19_pkg.adb: New helper. + 2025-05-26 Tobias Burnus Backported from master: -- cgit v1.1 From 4276b3884a3f418a17b10288bc10a3d73531018b Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 29 May 2025 00:23:48 +0000 Subject: Daily bump. --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4044138..9398513 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250528 +20250529 -- cgit v1.1 From d79b3dc85d26051665b3e7412d5e1bd35915b882 Mon Sep 17 00:00:00 2001 From: Yuta Mukai Date: Fri, 23 May 2025 04:51:11 +0000 Subject: aarch64: Enable newly implemented features for FUJITSU-MONAKA This patch enables newly implemented features in GCC (FAMINMAX, FP8FMA, FP8DOT2, FP8DOT4, LUT) for FUJITSU-MONAKA processor (-mcpu=fujitsu-monaka). 2025-05-23 Yuta Mukai gcc/ChangeLog: * config/aarch64/aarch64-cores.def (fujitsu-monaka): Update ISA features. (cherry picked from commit 33ee574a7444b238005d89fdfdf2f21f50b1fc6e) --- gcc/config/aarch64/aarch64-cores.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/config/aarch64/aarch64-cores.def b/gcc/config/aarch64/aarch64-cores.def index 1209630..24b7cd3 100644 --- a/gcc/config/aarch64/aarch64-cores.def +++ b/gcc/config/aarch64/aarch64-cores.def @@ -132,7 +132,7 @@ AARCH64_CORE("octeontx2f95mm", octeontx2f95mm, cortexa57, V8_2A, (CRYPTO, PROFI /* Fujitsu ('F') cores. */ AARCH64_CORE("a64fx", a64fx, a64fx, V8_2A, (F16, SVE), a64fx, 0x46, 0x001, -1) -AARCH64_CORE("fujitsu-monaka", fujitsu_monaka, cortexa57, V9_3A, (F16, FP8, LS64, RNG, CRYPTO, SVE2_AES, SVE2_BITPERM, SVE2_SHA3, SVE2_SM4), fujitsu_monaka, 0x46, 0x003, -1) +AARCH64_CORE("fujitsu-monaka", fujitsu_monaka, cortexa57, V9_3A, (F16, FAMINMAX, FP8FMA, FP8DOT2, FP8DOT4, LS64, LUT, RNG, CRYPTO, SVE2_AES, SVE2_BITPERM, SVE2_SHA3, SVE2_SM4), fujitsu_monaka, 0x46, 0x003, -1) /* HiSilicon ('H') cores. */ AARCH64_CORE("tsv110", tsv110, tsv110, V8_2A, (CRYPTO, F16), tsv110, 0x48, 0xd01, -1) -- cgit v1.1 From f54d6c1f90cdf25503ce752e65519573f4a6b797 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 30 May 2025 00:24:31 +0000 Subject: Daily bump. --- gcc/ChangeLog | 8 ++++++++ gcc/DATESTAMP | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4287b97..59f447c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2025-05-29 Yuta Mukai + + Backported from master: + 2025-05-28 Yuta Mukai + + * config/aarch64/aarch64-cores.def (fujitsu-monaka): Update ISA + features. + 2025-05-27 Eric Botcazou * ipa-sra.cc (scan_expr_access): Also disqualify storage order diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9398513..ac27433 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250529 +20250530 -- cgit v1.1 From 9fa1f93eb7e39ccabf39a45e89f1a35adcf1bf1f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 30 May 2025 14:35:12 +0200 Subject: testsuite: Add testcase for GCC 13 branch s390 bug [PR120480] This got broken with r13-9727 and fixed with either of r13-9729 or r13-9728. 2025-05-30 Jakub Jelinek PR target/120480 * gcc.dg/pr120480.c: New test. (cherry picked from commit c13d5b939fee565047394475952878dc5394fb74) --- gcc/testsuite/gcc.dg/pr120480.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr120480.c (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/pr120480.c b/gcc/testsuite/gcc.dg/pr120480.c new file mode 100644 index 0000000..cf7b47a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr120480.c @@ -0,0 +1,11 @@ +/* PR target/120480 */ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +struct S { int a, b, c; } s; + +void +foo (void) +{ + struct S t = s; +} -- cgit v1.1 From b368dd5de53fc981b5b20e2fd6d7de9116e82331 Mon Sep 17 00:00:00 2001 From: Sandra Loosemore Date: Sat, 24 May 2025 03:21:18 +0000 Subject: OpenMP: Fix ICE in metadirective recovery after error [PR120180] It's not clear whether a metadirective in a loop nest is supposed to be valid, but GCC certainly shouldn't be ICE'ing after diagnosing it as an error. gcc/c/ChangeLog PR c/120180 * c-parser.cc (c_parser_omp_metadirective): Only consume the token if it is the expected close paren. gcc/cp/ChangeLog PR c/120180 * parser.cc (cp_parser_omp_metadirective): Only consume the token if it is the expected close paren. gcc/testsuite/ChangeLog PR c/120180 * c-c++-common/gomp/pr120180.c: New. (cherry picked from commit 65e0ed2310a1b0d1a3255583bbfb8a8d86c5aea5) --- gcc/c/c-parser.cc | 7 ++++--- gcc/cp/parser.cc | 7 ++++--- gcc/testsuite/c-c++-common/gomp/pr120180.c | 22 ++++++++++++++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/gomp/pr120180.c (limited to 'gcc') diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 22ec0f8..d825e05 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -29247,7 +29247,10 @@ c_parser_omp_metadirective (c_parser *parser, bool *if_p) goto add; case CPP_CLOSE_PAREN: if (nesting_depth-- == 0) - break; + { + c_parser_consume_token (parser); + break; + } goto add; default: add: @@ -29259,8 +29262,6 @@ c_parser_omp_metadirective (c_parser *parser, bool *if_p) break; } - c_parser_consume_token (parser); - if (!skip) { c_token eol_token; diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 3628cfe..93ec030 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -51568,7 +51568,10 @@ cp_parser_omp_metadirective (cp_parser *parser, cp_token *pragma_tok, goto add; case CPP_CLOSE_PAREN: if (nesting_depth-- == 0) - break; + { + cp_lexer_consume_token (parser->lexer); + break; + } goto add; default: add: @@ -51580,8 +51583,6 @@ cp_parser_omp_metadirective (cp_parser *parser, cp_token *pragma_tok, break; } - cp_lexer_consume_token (parser->lexer); - if (!skip) { cp_token eol_token = {}; diff --git a/gcc/testsuite/c-c++-common/gomp/pr120180.c b/gcc/testsuite/c-c++-common/gomp/pr120180.c new file mode 100644 index 0000000..cb5a0d5 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr120180.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ + +/* This test used to ICE after erroring on the metadirective in the + loop nest. */ + +int main() +{ + int blksize = 15000; + double *qq; + int i, k, nq; + + #pragma omp metadirective when(user={condition(0)}: target teams distribute parallel for collapse(2) map(qq[:0]) private(i)) \ + when(user={condition(0)}: target teams distribute parallel for map(qq[:0]) private(i)) \ + when(user={condition(1)}: target teams loop collapse(2) map(qq[:0]) private(i)) + for(k=0; k Date: Mon, 26 May 2025 19:21:48 +0000 Subject: OpenMP: Fix ICE and other issues in C/C++ metadirective error recovery. The new testcase included in this patch used to ICE in gcc after diagnosing the first error, and in g++ it only diagnosed the error in the first metadirective, ignoring the second one. The solution is to make error recovery in the C front end more like that in the C++ front end, and remove the code in both front ends that previously tried to skip all the way over the following statement (instead of just to the end of the metadirective pragma) after an error. gcc/c/ChangeLog * c-parser.cc (c_parser_skip_to_closing_brace): New, copied from the equivalent function in the C++ front end. (c_parser_skip_to_end_of_block_or_statement): Pass false to the error flag. (c_parser_omp_context_selector): Immediately return error_mark_node after giving an error that the integer trait property is invalid, similarly to C++ front end. (c_parser_omp_context_selector_specification): Likewise handle error return from c_parser_omp_context_selector similarly to C++. (c_parser_omp_metadirective): Do not call c_parser_skip_to_end_of_block_or_statement after an error. gcc/cp/ChangeLog * parser.cc (cp_parser_omp_metadirective): Do not call cp_parser_skip_to_end_of_block_or_statement after an error. gcc/testsuite/ChangeLog * c-c++-common/gomp/declare-variant-2.c: Adjust patterns now that C and C++ now behave similarly. * c-c++-common/gomp/metadirective-error-recovery.c: New. (cherry picked from commit 33b65e4d1c83808b54cd6b3fc97ebacc522b125d) --- gcc/c/c-parser.cc | 82 ++++++++++++++++------ gcc/cp/parser.cc | 9 +-- .../c-c++-common/gomp/declare-variant-2.c | 13 ++-- .../gomp/metadirective-error-recovery.c | 20 ++++++ 4 files changed, 89 insertions(+), 35 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/gomp/metadirective-error-recovery.c (limited to 'gcc') diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index d825e05..93cc7b0 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -1418,6 +1418,51 @@ c_parser_skip_to_end_of_parameter (c_parser *parser) parser->error = false; } +/* Skip tokens until a non-nested closing curly brace is the next + token, or there are no more tokens. Return true in the first case, + false otherwise. */ + +static bool +c_parser_skip_to_closing_brace (c_parser *parser) +{ + unsigned nesting_depth = 0; + + while (true) + { + c_token *token = c_parser_peek_token (parser); + + switch (token->type) + { + case CPP_PRAGMA_EOL: + if (!parser->in_pragma) + break; + /* FALLTHRU */ + case CPP_EOF: + /* If we've run out of tokens, stop. */ + return false; + + case CPP_CLOSE_BRACE: + /* If the next token is a non-nested `}', then we have reached + the end of the current block. */ + if (nesting_depth-- == 0) + return true; + break; + + case CPP_OPEN_BRACE: + /* If it the next token is a `{', then we are entering a new + block. Consume the entire block. */ + ++nesting_depth; + break; + + default: + break; + } + + /* Consume the token. */ + c_parser_consume_token (parser); + } +} + /* Expect to be at the end of the pragma directive and consume an end of line marker. */ @@ -1533,7 +1578,7 @@ c_parser_skip_to_end_of_block_or_statement (c_parser *parser, here for secondary error recovery, after parser->error has been cleared. */ c_parser_consume_pragma (parser); - c_parser_skip_to_pragma_eol (parser); + c_parser_skip_to_pragma_eol (parser, false); parser->error = save_error; continue; @@ -26772,19 +26817,17 @@ c_parser_omp_context_selector (c_parser *parser, enum omp_tss_code set, case OMP_TRAIT_PROPERTY_DEV_NUM_EXPR: case OMP_TRAIT_PROPERTY_BOOL_EXPR: t = c_parser_expr_no_commas (parser, NULL).value; - if (t != error_mark_node) + if (t == error_mark_node) + return error_mark_node; + mark_exp_read (t); + t = c_fully_fold (t, false, NULL); + if (!INTEGRAL_TYPE_P (TREE_TYPE (t))) { - mark_exp_read (t); - t = c_fully_fold (t, false, NULL); - if (!INTEGRAL_TYPE_P (TREE_TYPE (t))) - error_at (token->location, - "property must be integer expression"); - else - properties = make_trait_property (NULL_TREE, t, - properties); + error_at (token->location, + "property must be integer expression"); + return error_mark_node; } - else - return error_mark_node; + properties = make_trait_property (NULL_TREE, t, properties); break; case OMP_TRAIT_PROPERTY_CLAUSE_LIST: if (sel == OMP_TRAIT_CONSTRUCT_SIMD) @@ -26886,11 +26929,14 @@ c_parser_omp_context_selector_specification (c_parser *parser, tree parms) tree selectors = c_parser_omp_context_selector (parser, set, parms); if (selectors == error_mark_node) - ret = error_mark_node; + { + c_parser_skip_to_closing_brace (parser); + ret = error_mark_node; + } else if (ret != error_mark_node) ret = make_trait_set_selector (set, selectors, ret); - braces.skip_until_found_close (parser); + braces.require_close (parser); if (c_parser_next_token_is (parser, CPP_COMMA)) c_parser_consume_token (parser); @@ -29095,7 +29141,6 @@ c_parser_omp_metadirective (c_parser *parser, bool *if_p) { error_at (match_loc, "too many % or % " "clauses in %"); - c_parser_skip_to_end_of_block_or_statement (parser, true); goto error; } default_seen = true; @@ -29104,14 +29149,12 @@ c_parser_omp_metadirective (c_parser *parser, bool *if_p) { error_at (match_loc, "% or % clause " "must appear last in %"); - c_parser_skip_to_end_of_block_or_statement (parser, true); goto error; } if (!default_p && strcmp (p, "when") != 0) { error_at (match_loc, "%qs is not valid for %qs", p, "metadirective"); - c_parser_skip_to_end_of_block_or_statement (parser, true); goto error; } @@ -29179,7 +29222,6 @@ c_parser_omp_metadirective (c_parser *parser, bool *if_p) if (i == 0) { error_at (loc, "expected directive name"); - c_parser_skip_to_end_of_block_or_statement (parser, true); goto error; } @@ -29388,9 +29430,9 @@ c_parser_omp_metadirective (c_parser *parser, bool *if_p) return; error: + /* Skip the metadirective pragma. Do not skip the metadirective body. */ if (parser->in_pragma) - c_parser_skip_to_pragma_eol (parser); - c_parser_skip_to_end_of_block_or_statement (parser, true); + c_parser_skip_to_pragma_eol (parser, false); } /* Main entry point to parsing most OpenMP pragmas. */ diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 93ec030..fe1eee9 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -51409,7 +51409,6 @@ cp_parser_omp_metadirective (cp_parser *parser, cp_token *pragma_tok, { error_at (match_loc, "too many % or % " "clauses in %"); - cp_parser_skip_to_end_of_block_or_statement (parser, true); goto fail; } else @@ -51419,14 +51418,12 @@ cp_parser_omp_metadirective (cp_parser *parser, cp_token *pragma_tok, { error_at (match_loc, "% or % clause " "must appear last in %"); - cp_parser_skip_to_end_of_block_or_statement (parser, true); goto fail; } if (!default_p && strcmp (p, "when") != 0) { error_at (match_loc, "%qs is not valid for %qs", p, "metadirective"); - cp_parser_skip_to_end_of_block_or_statement (parser, true); goto fail; } @@ -51495,7 +51492,6 @@ cp_parser_omp_metadirective (cp_parser *parser, cp_token *pragma_tok, if (i == 0) { error_at (loc, "expected directive name"); - cp_parser_skip_to_end_of_block_or_statement (parser, true); goto fail; } @@ -51714,11 +51710,8 @@ cp_parser_omp_metadirective (cp_parser *parser, cp_token *pragma_tok, return; fail: - /* Skip the metadirective pragma. */ + /* Skip the metadirective pragma. Do not skip the metadirective body. */ cp_parser_skip_to_pragma_eol (parser, pragma_tok); - - /* Skip the metadirective body. */ - cp_parser_skip_to_end_of_block_or_statement (parser, true); } diff --git a/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c b/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c index 7711dbc..f8f5143 100644 --- a/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c +++ b/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c @@ -47,10 +47,9 @@ void f23 (void); #pragma omp declare variant (f1) match(construct={teams,parallel,master,for}) /* { dg-warning "unknown selector 'master' for context selector set 'construct'" } */ void f24 (void); #pragma omp declare variant (f1) match(construct={parallel(1 /* { dg-error "selector 'parallel' does not accept any properties" } */ -void f25 (void); /* { dg-error "expected '\\\}' before end of line" "" { target c++ } .-1 } */ - /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-2 } */ +void f25 (void); /* { dg-error "expected '\\\}' before end of line" "" { target *-*-* } .-1 } */ #pragma omp declare variant (f1) match(construct={parallel(1)}) /* { dg-error "selector 'parallel' does not accept any properties" } */ -void f26 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */ +void f26 (void); #pragma omp declare variant (f0) match(construct={simd(12)}) /* { dg-error "expected \[^\n\r]* clause before" } */ void f27 (void); /* { dg-error "'\\)' before numeric constant" "" { target c++ } .-1 } */ #pragma omp declare variant (f1) match(construct={parallel},construct={for}) /* { dg-error "selector set 'construct' specified more than once" } */ @@ -96,13 +95,13 @@ void f46 (void); #pragma omp declare variant (f1) match(implementation={vendor("foobar")}) /* { dg-warning "unknown property '.foobar.' of 'vendor' selector" } */ void f47 (void); #pragma omp declare variant (f1) match(implementation={unified_address(yes)}) /* { dg-error "selector 'unified_address' does not accept any properties" } */ -void f48 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */ +void f48 (void); #pragma omp declare variant (f1) match(implementation={unified_shared_memory(no)}) /* { dg-error "selector 'unified_shared_memory' does not accept any properties" } */ -void f49 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */ +void f49 (void); #pragma omp declare variant (f1) match(implementation={dynamic_allocators(42)}) /* { dg-error "selector 'dynamic_allocators' does not accept any properties" } */ -void f50 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */ +void f50 (void); #pragma omp declare variant (f1) match(implementation={reverse_offload()}) /* { dg-error "selector 'reverse_offload' does not accept any properties" } */ -void f51 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */ +void f51 (void); #pragma omp declare variant (f1) match(implementation={atomic_default_mem_order}) /* { dg-error "expected '\\(' before '\\\}' token" } */ void f52 (void); #pragma omp declare variant (f1) match(implementation={atomic_default_mem_order(acquire)}) diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-error-recovery.c b/gcc/testsuite/c-c++-common/gomp/metadirective-error-recovery.c new file mode 100644 index 0000000..3242281 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/metadirective-error-recovery.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +/* This test used to ICE in C and only diagnose the first error in C++. */ + +struct s { + int a, b; +}; + +void f (int aa, int bb) +{ + struct s s1, s2; + s1.a = aa; + s1.b = bb; + s2.a = aa + 1; + s2.b = bb + 1; + + /* A struct is not a valid argument for the condition selector. */ + #pragma omp metadirective when(user={condition(s1)} : nothing) otherwise(nothing) /* { dg-error "property must be integer expression" } */ + #pragma omp metadirective when(user={condition(s2)} : nothing) otherwise(nothing) /* { dg-error "property must be integer expression" } */ +} -- cgit v1.1 From 1d3b863c20831dc56f3671ee053d00440c322248 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 31 May 2025 00:24:57 +0000 Subject: Daily bump. --- gcc/DATESTAMP | 2 +- gcc/c/ChangeLog | 26 ++++++++++++++++++++++++++ gcc/cp/ChangeLog | 17 +++++++++++++++++ gcc/testsuite/ChangeLog | 25 +++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ac27433..e844ed6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250530 +20250531 diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index d842028..061f1c6 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,29 @@ +2025-05-30 Sandra Loosemore + + Backported from master: + 2025-05-29 Sandra Loosemore + + * c-parser.cc (c_parser_skip_to_closing_brace): New, copied from + the equivalent function in the C++ front end. + (c_parser_skip_to_end_of_block_or_statement): Pass false to + the error flag. + (c_parser_omp_context_selector): Immediately return error_mark_node + after giving an error that the integer trait property is invalid, + similarly to C++ front end. + (c_parser_omp_context_selector_specification): Likewise handle + error return from c_parser_omp_context_selector similarly to C++. + (c_parser_omp_metadirective): Do not call + c_parser_skip_to_end_of_block_or_statement after an error. + +2025-05-30 Sandra Loosemore + + Backported from master: + 2025-05-29 Sandra Loosemore + + PR c/120180 + * c-parser.cc (c_parser_omp_metadirective): Only consume the + token if it is the expected close paren. + 2025-05-02 Jakub Jelinek Backported from master: diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7f31e05..8983abf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,20 @@ +2025-05-30 Sandra Loosemore + + Backported from master: + 2025-05-29 Sandra Loosemore + + * parser.cc (cp_parser_omp_metadirective): Do not call + cp_parser_skip_to_end_of_block_or_statement after an error. + +2025-05-30 Sandra Loosemore + + Backported from master: + 2025-05-29 Sandra Loosemore + + PR c/120180 + * parser.cc (cp_parser_omp_metadirective): Only consume the + token if it is the expected close paren. + 2025-05-26 Tobias Burnus Backported from master: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 761905b..e5c5830 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,28 @@ +2025-05-30 Sandra Loosemore + + Backported from master: + 2025-05-29 Sandra Loosemore + + * c-c++-common/gomp/declare-variant-2.c: Adjust patterns now that + C and C++ now behave similarly. + * c-c++-common/gomp/metadirective-error-recovery.c: New. + +2025-05-30 Sandra Loosemore + + Backported from master: + 2025-05-29 Sandra Loosemore + + PR c/120180 + * c-c++-common/gomp/pr120180.c: New. + +2025-05-30 Jakub Jelinek + + Backported from master: + 2025-05-30 Jakub Jelinek + + PR target/120480 + * gcc.dg/pr120480.c: New test. + 2025-05-27 Eric Botcazou * gnat.dg/sso19.adb: New test. -- cgit v1.1 From d8e7a2dbe736a57e4cec0293387a1c558b5a155e Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Fri, 30 May 2025 13:31:58 +0200 Subject: Type mismatch for passed external function This obvious and simple patch fixes a 15/16 regression where the typespec of a global function was in the RESULT clause and not in the symbol itself. gcc/fortran/ChangeLog: PR fortran/120355 * interface.cc (compare_parameter): If the global function has a result clause, take typespec from there for the comparison against the dummy argument. gcc/testsuite/ChangeLog: PR fortran/120355 * gfortran.dg/interface_62.f90: New test. (cherry picked from commit 0e77309047a7b479c89f03dcaf2994e050d0f33e) --- gcc/fortran/interface.cc | 9 ++++++- gcc/testsuite/gfortran.dg/interface_62.f90 | 39 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/interface_62.f90 (limited to 'gcc') diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc index 753f589..b854292 100644 --- a/gcc/fortran/interface.cc +++ b/gcc/fortran/interface.cc @@ -2547,7 +2547,14 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, } else if (formal->attr.function) { - if (!gfc_compare_types (&global_asym->ts, + gfc_typespec ts; + + if (global_asym->result) + ts = global_asym->result->ts; + else + ts = global_asym->ts; + + if (!gfc_compare_types (&ts, &formal->ts)) { gfc_error ("Type mismatch at %L passing global " diff --git a/gcc/testsuite/gfortran.dg/interface_62.f90 b/gcc/testsuite/gfortran.dg/interface_62.f90 new file mode 100644 index 0000000..19d4325 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/interface_62.f90 @@ -0,0 +1,39 @@ +! { dg-do compile } +! PR fortran/120355 - this was rejected because the typespec from +! the RESULT clause was not picked up. +! Test case jsberg@bnl.gov. + +program p + implicit none + integer :: i,j + interface + function s(x) result(y) + implicit none + integer, intent(in) :: x + integer :: y + end function s + end interface + i = 0 + call t(s,i,j) +contains + subroutine t(f,x,y) + implicit none + integer, intent(in) :: x + integer, intent(out) :: y + interface + function f(x) result(y) + implicit none + integer, intent(in) :: x + integer :: y + end function f + end interface + y = f(x) + end subroutine t +end program p + +function s(x) result(y) + implicit none + integer, intent(in) :: x + integer :: y + y = 1 - x +end function s -- cgit v1.1 From 41dee7da08873721a719849d19ef07c027e76dfb Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Mon, 19 May 2025 19:41:16 -0700 Subject: Fortran: Fix c_associated argument checks. PR fortran/120049 gcc/fortran/ChangeLog: * check.cc (gfc_check_c_associated): Use new helper functions. Only call check_c_ptr_1 if optional c_ptr_2 tests succeed. (check_c_ptr_1): Handle only c_ptr_1 checks. (check_c_ptr_2): Expand checks for c_ptr_2 and handle cases where there is no derived pointer in the gfc_expr and check the inmod_sym_id only if it exists. Rephrase error message. * misc.cc (gfc_typename): Handle the case for BT_VOID rather than throw an internal error. gcc/testsuite/ChangeLog: * gfortran.dg/pr120049_a.f90: Update test directives. * gfortran.dg/pr120049_b.f90: Update test directives * gfortran.dg/pr120049_2.f90: New test. * gfortran.dg/c_f_pointer_tests_6.f90: Adjust dg-error directive. Co-Authored-By: Steve Kargl (cherry picked from commit 42983ffde6612b7f8a4e7ab3e76fa8b0d136e854) --- gcc/fortran/check.cc | 125 ++++++++++++++++------ gcc/fortran/misc.cc | 3 + gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90 | 2 +- gcc/testsuite/gfortran.dg/pr120049_2.f90 | 62 +++++++++++ gcc/testsuite/gfortran.dg/pr120049_a.f90 | 7 +- gcc/testsuite/gfortran.dg/pr120049_b.f90 | 2 - 6 files changed, 164 insertions(+), 37 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr120049_2.f90 (limited to 'gcc') diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc index 0073cd0..ce9da31 100644 --- a/gcc/fortran/check.cc +++ b/gcc/fortran/check.cc @@ -5916,49 +5916,110 @@ gfc_check_c_sizeof (gfc_expr *arg) } -bool -gfc_check_c_associated (gfc_expr *c_ptr_1, gfc_expr *c_ptr_2) +/* Helper functions check_c_ptr_1 and check_c_ptr_2 + used in gfc_check_c_associated. */ + +static inline +bool check_c_ptr_1 (gfc_expr *c_ptr_1) { - if (c_ptr_1) - { - if (c_ptr_1->expr_type == EXPR_FUNCTION && c_ptr_1->ts.type == BT_VOID) - return true; + if ((c_ptr_1->ts.type == BT_VOID) + && (c_ptr_1->expr_type == EXPR_FUNCTION)) + return true; - if (c_ptr_1->ts.type != BT_DERIVED - || c_ptr_1->ts.u.derived->from_intmod != INTMOD_ISO_C_BINDING - || (c_ptr_1->ts.u.derived->intmod_sym_id != ISOCBINDING_PTR - && c_ptr_1->ts.u.derived->intmod_sym_id != ISOCBINDING_FUNPTR)) - { - gfc_error ("Argument C_PTR_1 at %L to C_ASSOCIATED shall have the " - "type TYPE(C_PTR) or TYPE(C_FUNPTR)", &c_ptr_1->where); - return false; - } - } + if (c_ptr_1->ts.type != BT_DERIVED + || c_ptr_1->ts.u.derived->from_intmod != INTMOD_ISO_C_BINDING + || (c_ptr_1->ts.u.derived->intmod_sym_id != ISOCBINDING_PTR + && c_ptr_1->ts.u.derived->intmod_sym_id != ISOCBINDING_FUNPTR)) + goto check_1_error; - if (!scalar_check (c_ptr_1, 0)) + if ((c_ptr_1->ts.type == BT_DERIVED) + && (c_ptr_1->expr_type == EXPR_STRUCTURE) + && (c_ptr_1->ts.u.derived->intmod_sym_id + == ISOCBINDING_NULL_FUNPTR)) + goto check_1_error; + + if (scalar_check (c_ptr_1, 0)) + return true; + else + /* Return since the check_1_error message may not apply here. */ return false; - if (c_ptr_2) - { - if (c_ptr_2->expr_type == EXPR_FUNCTION && c_ptr_2->ts.type == BT_VOID) - return true; +check_1_error: - if (c_ptr_2->ts.type != BT_DERIVED - || c_ptr_2->ts.u.derived->from_intmod != INTMOD_ISO_C_BINDING - || (c_ptr_1->ts.u.derived->intmod_sym_id - != c_ptr_2->ts.u.derived->intmod_sym_id)) + gfc_error ("Argument C_PTR_1 at %L to C_ASSOCIATED shall have the " + "type TYPE(C_PTR) or TYPE(C_FUNPTR)", &c_ptr_1->where); + return false; +} + +static inline +bool check_c_ptr_2 (gfc_expr *c_ptr_1, gfc_expr *c_ptr_2) +{ + switch (c_ptr_2->ts.type) + { + case BT_VOID: + if (c_ptr_2->expr_type == EXPR_FUNCTION) { - gfc_error ("Argument C_PTR_2 at %L to C_ASSOCIATED shall have the " - "same type as C_PTR_1: %s instead of %s", &c_ptr_1->where, - gfc_typename (&c_ptr_1->ts), gfc_typename (&c_ptr_2->ts)); - return false; + if ((c_ptr_1->ts.type == BT_DERIVED) + && c_ptr_1->expr_type == EXPR_STRUCTURE + && (c_ptr_1->ts.u.derived->intmod_sym_id + == ISOCBINDING_FUNPTR)) + goto check_2_error; } - } + break; + + case BT_DERIVED: + if ((c_ptr_2->expr_type == EXPR_STRUCTURE) + && (c_ptr_2->ts.u.derived->intmod_sym_id == ISOCBINDING_PTR) + && (c_ptr_1->ts.type == BT_VOID) + && (c_ptr_1->expr_type == EXPR_FUNCTION)) + return scalar_check (c_ptr_2, 1); + + if ((c_ptr_2->expr_type == EXPR_STRUCTURE) + && (c_ptr_1->ts.type == BT_VOID) + && (c_ptr_1->expr_type == EXPR_FUNCTION)) + goto check_2_error; - if (c_ptr_2 && !scalar_check (c_ptr_2, 1)) + if (c_ptr_2->ts.u.derived->from_intmod != INTMOD_ISO_C_BINDING) + goto check_2_error; + + if (c_ptr_1->ts.type == BT_DERIVED + && (c_ptr_1->ts.u.derived->intmod_sym_id + != c_ptr_2->ts.u.derived->intmod_sym_id)) + goto check_2_error; + break; + + default: + goto check_2_error; + } + + if (scalar_check (c_ptr_2, 1)) + return true; + else + /* Return since the check_2_error message may not apply here. */ return false; - return true; +check_2_error: + + gfc_error ("Argument C_PTR_2 at %L to C_ASSOCIATED shall have the " + "same type as C_PTR_1, found %s instead of %s", &c_ptr_2->where, + gfc_typename (&c_ptr_2->ts), gfc_typename (&c_ptr_1->ts)); + + return false; + } + + +bool +gfc_check_c_associated (gfc_expr *c_ptr_1, gfc_expr *c_ptr_2) +{ + if (c_ptr_2) + { + if (check_c_ptr_2 (c_ptr_1, c_ptr_2)) + return check_c_ptr_1 (c_ptr_1); + else + return false; + } + else + return check_c_ptr_1 (c_ptr_1); } diff --git a/gcc/fortran/misc.cc b/gcc/fortran/misc.cc index 893c40f..b8bdf75 100644 --- a/gcc/fortran/misc.cc +++ b/gcc/fortran/misc.cc @@ -214,6 +214,9 @@ gfc_typename (gfc_typespec *ts, bool for_hash) case BT_UNKNOWN: strcpy (buffer, "UNKNOWN"); break; + case BT_VOID: + strcpy (buffer, "VOID"); + break; default: gfc_internal_error ("gfc_typename(): Undefined type"); } diff --git a/gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90 b/gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90 index 23ca88b..bc2206d 100644 --- a/gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90 +++ b/gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90 @@ -38,6 +38,6 @@ contains type(my_c_ptr_0) :: my_ptr2 type(c_funptr) :: myfun print *,c_associated(my_ptr,my_ptr2) - print *,c_associated(my_ptr,myfun) ! { dg-error "Argument C_PTR_2 at .1. to C_ASSOCIATED shall have the same type as C_PTR_1: TYPE.c_ptr. instead of TYPE.c_funptr." } + print *,c_associated(my_ptr,myfun) ! { dg-error "Argument C_PTR_2 at .1. to C_ASSOCIATED shall have the same type as C_PTR_1, found TYPE.c_funptr. instead of TYPE.c_ptr." } end subroutine end diff --git a/gcc/testsuite/gfortran.dg/pr120049_2.f90 b/gcc/testsuite/gfortran.dg/pr120049_2.f90 new file mode 100644 index 0000000..1f91e06 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr120049_2.f90 @@ -0,0 +1,62 @@ +! Compiled with pr120049_b.f90 +! { dg-options -O0 } +! { dg-do compile } +! { dg-compile-aux-modules "pr120049_b.f90" } +! +! Test the fix for PR120049 +program tests_gtk_sup + use gtk_sup + implicit none + + type mytype + integer :: myint + end type mytype + type(mytype) :: ijkl = mytype(42) + logical :: truth + real :: var1 + type(c_ptr), target :: val + type(c_funptr), target :: fptr + character(15) :: stringy + complex :: certainly + truth = .true. + var1 = 86. + stringy = "what the hay!" + certainly = (3.14,-4.13) + if (c_associated(val, c_loc(val))) then + stop 1 + endif + if (c_associated(c_loc(val), val)) then + stop 2 + endif + print *, c_associated(fptr, C_NULL_FUNPTR) + print *, c_associated(c_loc(val), C_NULL_PTR) + print *, c_associated(C_NULL_PTR, c_loc(val)) + print *, c_associated(c_loc(val), 42) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(c_loc(val), .42) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(c_loc(val), truth) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(c_loc(val), .false.) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(c_loc(val), var1) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(c_loc(val), stringy) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(c_loc(val), certainly) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(42) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(.42) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(truth) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(.false.) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(var1) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(stringy) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(certainly) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(.42) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(val, testit(val)) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(testit(val), val) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(testit(val)) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(c_loc(val), C_NULL_FUNPTR) ! { dg-error "C_ASSOCIATED shall have the" } + print *, c_associated(C_NULL_FUNPTR, c_loc(val)) ! { dg-error "C_ASSOCIATED shall have the" } +contains + + function testit (avalue) result(res) + type(c_ptr) :: avalue + type(mytype) :: res + res%myint = 42 + end function + +end program tests_gtk_sup diff --git a/gcc/testsuite/gfortran.dg/pr120049_a.f90 b/gcc/testsuite/gfortran.dg/pr120049_a.f90 index c404a4d..7095314 100644 --- a/gcc/testsuite/gfortran.dg/pr120049_a.f90 +++ b/gcc/testsuite/gfortran.dg/pr120049_a.f90 @@ -1,5 +1,8 @@ -! { dg-do preprocess } -! { dg-additional-options "-cpp" } +! Compiled with pr120049_b.f90 +! { dg-options -O0 } +! { dg-do run } +! { dg-compile-aux-modules "pr120049_b.f90" } +! { dg-additional-sources pr120049_b.f90 } ! ! Test the fix for PR86248 program tests_gtk_sup diff --git a/gcc/testsuite/gfortran.dg/pr120049_b.f90 b/gcc/testsuite/gfortran.dg/pr120049_b.f90 index 127db98..28a2783 100644 --- a/gcc/testsuite/gfortran.dg/pr120049_b.f90 +++ b/gcc/testsuite/gfortran.dg/pr120049_b.f90 @@ -1,5 +1,3 @@ -! { dg-do run } -! { dg-additional-sources pr120049_a.f90 } ! ! Module for pr120049.f90 ! -- cgit v1.1 From 512a41fae40cec705ca45a47150524154af8ead2 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 1 Jun 2025 00:24:48 +0000 Subject: Daily bump. --- gcc/DATESTAMP | 2 +- gcc/fortran/ChangeLog | 25 +++++++++++++++++++++++++ gcc/testsuite/ChangeLog | 21 +++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e844ed6..42f5016 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250531 +20250601 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b95f7ee..2f9f5c9 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,28 @@ +2025-05-31 Jerry DeLisle + + Backported from master: + 2025-05-27 Jerry DeLisle + + PR fortran/120049 + * check.cc (gfc_check_c_associated): Use new helper functions. + Only call check_c_ptr_1 if optional c_ptr_2 tests succeed. + (check_c_ptr_1): Handle only c_ptr_1 checks. + (check_c_ptr_2): Expand checks for c_ptr_2 and handle cases + where there is no derived pointer in the gfc_expr and check + the inmod_sym_id only if it exists. Rephrase error message. + * misc.cc (gfc_typename): Handle the case for BT_VOID rather + than throw an internal error. + +2025-05-31 Thomas Koenig + + Backported from master: + 2025-05-30 Thomas Koenig + + PR fortran/120355 + * interface.cc (compare_parameter): If the global function has a + result clause, take typespec from there for the comparison against + the dummy argument. + 2025-05-22 Harald Anlauf Backported from master: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e5c5830..5b94c72 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,24 @@ +2025-05-31 Jerry DeLisle + + Backported from master: + 2025-05-27 Jerry DeLisle + + PR fortran/120049 + * gfortran.dg/pr120049_a.f90: Update test directives. + * gfortran.dg/pr120049_b.f90: Update test directives + * gfortran.dg/pr120049_2.f90: New test. + * gfortran.dg/c_f_pointer_tests_6.f90: Adjust dg-error + directive. + Co-Authored-By: Steve Kargl + +2025-05-31 Thomas Koenig + + Backported from master: + 2025-05-30 Thomas Koenig + + PR fortran/120355 + * gfortran.dg/interface_62.f90: New test. + 2025-05-30 Sandra Loosemore Backported from master: -- cgit v1.1 From 9e734259dc4b15982727697d88d59170e71de53d Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 2 Jun 2025 00:22:54 +0000 Subject: Daily bump. --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 42f5016..5646e6e 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250601 +20250602 -- cgit v1.1 From 4856affe9e08a3562792d6cde217cd06c1ef93da Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Wed, 28 May 2025 07:56:12 -0700 Subject: Fortran: Adjust handling of optional comma in FORMAT. This change adjusts the error messages for optional commas in format strings to give a warning at compile time unless -std=legacy is used. This is more consistant with the runtime library. A missing comma separator should not be encouraged as it is non-standard fortran. PR fortran/119856 gcc/fortran/ChangeLog: * io.cc: Set missing comma error checks to STD_STD_LEGACY. gcc/testsuite/ChangeLog: * gfortran.dg/comma_format_extension_1.f: Update dg-options to "-std=legacy". * gfortran.dg/comma_format_extension_3.f: Likewise. * gfortran.dg/continuation_13.f90: Likewise. (cherry picked from commit e2bf0b3910de7e65363435f0a7fa606e2448a677) --- gcc/fortran/io.cc | 6 ++++-- gcc/testsuite/gfortran.dg/comma_format_extension_1.f | 2 +- gcc/testsuite/gfortran.dg/comma_format_extension_3.f | 2 +- gcc/testsuite/gfortran.dg/continuation_13.f90 | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) (limited to 'gcc') diff --git a/gcc/fortran/io.cc b/gcc/fortran/io.cc index b5c9d33..7466d8f 100644 --- a/gcc/fortran/io.cc +++ b/gcc/fortran/io.cc @@ -1228,7 +1228,8 @@ between_desc: default: if (mode != MODE_FORMAT) format_locus.nextc += format_string_pos - 1; - if (!gfc_notify_std (GFC_STD_GNU, "Missing comma at %L", &format_locus)) + if (!gfc_notify_std (GFC_STD_LEGACY, + "Missing comma in FORMAT string at %L", &format_locus)) return false; /* If we do not actually return a failure, we need to unwind this before the next round. */ @@ -1290,7 +1291,8 @@ extension_optional_comma: default: if (mode != MODE_FORMAT) format_locus.nextc += format_string_pos; - if (!gfc_notify_std (GFC_STD_GNU, "Missing comma at %L", &format_locus)) + if (!gfc_notify_std (GFC_STD_LEGACY, + "Missing comma in FORMAT string at %L", &format_locus)) return false; /* If we do not actually return a failure, we need to unwind this before the next round. */ diff --git a/gcc/testsuite/gfortran.dg/comma_format_extension_1.f b/gcc/testsuite/gfortran.dg/comma_format_extension_1.f index a3a5a98..c4b43f0 100644 --- a/gcc/testsuite/gfortran.dg/comma_format_extension_1.f +++ b/gcc/testsuite/gfortran.dg/comma_format_extension_1.f @@ -1,5 +1,5 @@ ! { dg-do compile } -! { dg-options "" } +! { dg-options "-std=legacy" } ! test that the extension for a missing comma is accepted subroutine mysub diff --git a/gcc/testsuite/gfortran.dg/comma_format_extension_3.f b/gcc/testsuite/gfortran.dg/comma_format_extension_3.f index 0b00224..9d974d6 100644 --- a/gcc/testsuite/gfortran.dg/comma_format_extension_3.f +++ b/gcc/testsuite/gfortran.dg/comma_format_extension_3.f @@ -3,7 +3,7 @@ ! did do the correct thing at runtime. ! Note the missing , before i1 in the format. ! { dg-do run } -! { dg-options "" } +! { dg-options "-std=legacy" } character*12 c write (c,100) 0, 1 diff --git a/gcc/testsuite/gfortran.dg/continuation_13.f90 b/gcc/testsuite/gfortran.dg/continuation_13.f90 index 9799b59e..475c896 100644 --- a/gcc/testsuite/gfortran.dg/continuation_13.f90 +++ b/gcc/testsuite/gfortran.dg/continuation_13.f90 @@ -1,5 +1,5 @@ ! { dg-do run } -! { dg-options "-std=gnu" } +! { dg-options "-std=legacy" } ! PR64506 character(25) :: astring -- cgit v1.1 From 21e0a742e7b70dcb9d8bed87a7d1b1b77b48b364 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Sat, 31 May 2025 08:57:22 -0700 Subject: Fortran: Fix handling of parsed format strings. Previously parsed strings with errors were being cached such that subsequent use of the format string were not being checked for errors. PR libfortran/119856 libgfortran/ChangeLog: * io/format.c (parse_format_list): Set the fmt->error message for missing comma. (parse_format): Do not cache the parsed format string if a previous error ocurred. gcc/testsuite/ChangeLog: * gfortran.dg/pr119856.f90: New test. (cherry picked from commit 5ff48aabf76c8913c013f233d3f42bb217a16e7b) --- gcc/testsuite/gfortran.dg/pr119856.f90 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr119856.f90 (limited to 'gcc') diff --git a/gcc/testsuite/gfortran.dg/pr119856.f90 b/gcc/testsuite/gfortran.dg/pr119856.f90 new file mode 100644 index 0000000..60ada0a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr119856.f90 @@ -0,0 +1,15 @@ +! { dg-do run } +! PR119856, the error should occur in both write statements. +program badfmt + implicit none + + character(10):: fmt = "(AI5)" ! Not a PARAMETER so not examined + ! at compile time + integer :: ioerr + ioerr = 0 + write (*, fmt, iostat=ioerr) 'value =', 42 + if (ioerr /= 5006) stop 10 +! + write (*, fmt, iostat=ioerr) 'value =', 43 + if (ioerr /= 5006) stop 13 +end program badfmt -- cgit v1.1