public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libgomp/107041] [13/14 Regression] C '-Wenum-int-mismatch' diagnostic for OpenACC 'acc_on_device' Date: Mon, 17 Apr 2023 17:36:29 +0000 [thread overview] Message-ID: <bug-107041-4-RNY345FKOQ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107041-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107041 --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think this is less important as it normally should trigger only with -Wall -Wsystem-headers. Anyway, one fix could be e.g. --- gcc/omp-builtins.def.jj 2023-04-17 19:11:55.065865863 +0200 +++ gcc/omp-builtins.def 2023-04-17 19:14:45.433406545 +0200 @@ -52,7 +52,7 @@ DEF_GOACC_BUILTIN (BUILT_IN_GOACC_DECLAR BT_FN_VOID_INT_SIZE_PTR_PTR_PTR, ATTR_NOTHROW_LIST) DEF_GOACC_BUILTIN_COMPILER (BUILT_IN_ACC_ON_DEVICE, "acc_on_device", - BT_FN_INT_INT, ATTR_CONST_NOTHROW_LEAF_LIST) + BT_FN_INT_VAR, ATTR_CONST_NOTHROW_LEAF_LIST) DEF_GOACC_BUILTIN_ONLY (BUILT_IN_GOACC_PARLEVEL_ID, "goacc_parlevel_id", BT_FN_INT_INT, ATTR_NOTHROW_LEAF_LIST) --- gcc/c-family/c-common.cc.jj 2023-03-28 17:47:46.769970692 +0200 +++ gcc/c-family/c-common.cc 2023-04-17 19:28:31.037488778 +0200 @@ -6493,6 +6493,25 @@ check_builtin_function_arguments (locati } return false; + case BUILT_IN_ACC_ON_DEVICE: + if (builtin_function_validate_nargs (loc, fndecl, nargs, 1)) + { + if (TREE_CODE (TREE_TYPE (args[0])) != INTEGER_TYPE + && (TREE_CODE (TREE_TYPE (args[0])) != ENUMERAL_TYPE + || (TREE_CODE (TREE_TYPE (TREE_TYPE (args[0]))) + != INTEGER_TYPE) + || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (args[0]))) + != integer_type_node))) + { + error_at (ARG_LOCATION (0), "argument %u in call to function " + "%qE does not have integer or enumerated type", + 1, fndecl); + return false; + } + return true; + } + return false; + default: return true; } --- gcc/fortran/types.def.jj 2023-04-17 19:11:55.065865863 +0200 +++ gcc/fortran/types.def 2023-04-17 19:14:45.433406545 +0200 @@ -264,6 +264,7 @@ DEF_FUNCTION_TYPE_11 (BT_FN_VOID_OMPFN_P BT_ULONGLONG, BT_ULONGLONG, BT_ULONGLONG) DEF_FUNCTION_TYPE_VAR_0 (BT_FN_VOID_VAR, BT_VOID) +DEF_FUNCTION_TYPE_VAR_0 (BT_FN_INT_VAR, BT_INT) DEF_FUNCTION_TYPE_VAR_1 (BT_FN_VOID_LONG_VAR, BT_VOID, BT_LONG) plus testsuite changes. But that would break #include <openacc.h> struct S { operator acc_device_t () { return acc_device_none; } }; int foo () { S s; return acc_on_device (s); } Another option would be just disable the warning for this particular builtin where the warning is reported.
next prev parent reply other threads:[~2023-04-17 17:36 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-26 13:42 [Bug libgomp/107041] New: [13 " tschwinge at gcc dot gnu.org 2022-09-27 8:50 ` [Bug libgomp/107041] " rguenth at gcc dot gnu.org 2022-12-22 14:35 ` rguenth at gcc dot gnu.org 2023-03-27 13:55 ` rguenth at gcc dot gnu.org 2023-04-17 15:23 ` [Bug libgomp/107041] [13/14 " jakub at gcc dot gnu.org 2023-04-17 17:36 ` jakub at gcc dot gnu.org [this message] 2023-04-18 8:39 ` jakub at gcc dot gnu.org 2023-04-20 17:30 ` cvs-commit at gcc dot gnu.org 2023-04-26 6:56 ` rguenth at gcc dot gnu.org 2023-04-26 8:37 ` cvs-commit at gcc dot gnu.org 2023-04-26 8:38 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-107041-4-RNY345FKOQ@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).