From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E7FB43858C83; Mon, 26 Sep 2022 13:42:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E7FB43858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664199748; bh=JmC/Ti5EnasGoCSKIBbCdg/dKRD4t8QjogRoMJ31EYo=; h=From:To:Subject:Date:From; b=DQoaY6bLtdzaMLifV216ljafXrAsUuCTZsSYn5pN3Ucf+aifJgfO3P4+4EBSNKNWe dSvKF2E4HSlVnhD94C5zz55iNzHSMuYMGc6snSWJQCI3kd0mlGHipLcTybHL+iBkC2 LZjUpdbsaVB7eo9ZYcAOQ4l+hcyzZ3NIZYjm3eZE= From: "tschwinge at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgomp/107041] New: [13 Regression] C '-Wenum-int-mismatch' diagnostic for OpenACC 'acc_on_device' Date: Mon, 26 Sep 2022 13:42:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libgomp X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: openacc X-Bugzilla-Severity: normal X-Bugzilla-Who: tschwinge at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107041 Bug ID: 107041 Summary: [13 Regression] C '-Wenum-int-mismatch' diagnostic for OpenACC 'acc_on_device' Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: openacc Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: tschwinge at gcc dot gnu.org CC: burnus at gcc dot gnu.org, jakub at gcc dot gnu.org, mpolacek at gcc dot gnu.org, vries at gcc dot gnu.org Target Milestone: --- Clean for C++: $ printf '#include \nint foo(){ return acc_on_device(acc_device_host); }\n' | build-gcc/gcc/xgcc -Bbuild-gcc/gcc -Isource-gcc/libgomp -x c++ - -fopenacc -S -Wall ..., but not anymore for C: $ printf '#include \nint foo(){ return acc_on_device(acc_device_host); }\n' | build-gcc/gcc/xgcc -Bbuild-gcc/gcc -Isource-gcc/libgomp -x c - -fopenacc -S -Wall In file included from :1: source-gcc/libgomp/openacc.h:103:5: warning: conflicting types for =E2=80=98acc_on_device=E2=80=99 due to enum/integer mismatch; have =E2=80= =98int(acc_device_t)=E2=80=99 [-Wenum-int-mismatch] 103 | int acc_on_device (acc_device_t __arg) __GOACC_NOTHROW; | ^~~~~~~~~~~~~ That's commit r13-627-g7da9a089608b0ca09683332ce014fb6184842724 "c: Impleme= nt new -Wenum-int-mismatch warning [PR105131]". This causes excess errors (only!) for 'libgomp.oacc-c/../libgomp.oacc-c-c++-common/host_data-1.c' (when its prerequisites are met); that's one of the few libgomp test cases where '-Wa= ll' is in effect. (I'd "complained" about lack of '-Wall' testing before.) OpenACC 'acc_on_device' is implemented as follows: libgomp/openacc.h-#ifdef __cplusplus libgomp/openacc.h:int acc_on_device (int __arg) __GOACC_NOTHROW; libgomp/openacc.h-#else libgomp/openacc.h:int acc_on_device (acc_device_t __arg) __GOACC_NOTHRO= W; libgomp/openacc.h-#endif libgomp/openacc.h-#ifdef __cplusplus libgomp/openacc.h-[...] libgomp/openacc.h- libgomp/openacc.h-/* Forwarding function with correctly typed arg. */ libgomp/openacc.h- libgomp/openacc.h-#pragma acc routine seq libgomp/openacc.h:inline int acc_on_device (acc_device_t __arg) __GOACC_NOTHROW libgomp/openacc.h-{ libgomp/openacc.h: return acc_on_device ((int) __arg); libgomp/openacc.h-} libgomp/openacc.h-#endif gcc/omp-builtins.def:DEF_GOACC_BUILTIN_COMPILER (BUILT_IN_ACC_ON_DEVICE, "acc_on_device", gcc/omp-builtins.def- BT_FN_INT_INT, ATTR_CONST_NOTHROW_LEAF_LIST) libgomp/oacc-init.c:/* For -O and higher, the compiler always attempts = to expand acc_on_device, but libgomp/oacc-init.c- if the user disables the builtin, or calls it vi= a a pointer, we'll need this libgomp/oacc-init.c- version. libgomp/oacc-init.c- libgomp/oacc-init.c- Compile this with optimization, so that the comp= iler expands libgomp/oacc-init.c- this, rather than generating infinitely recursive code. libgomp/oacc-init.c- libgomp/oacc-init.c: The function just forwards its argument to __builtin_acc_on_device. It does libgomp/oacc-init.c- not verify that the argument is a valid acc_devi= ce_t enumeration value. */ libgomp/oacc-init.c- libgomp/oacc-init.c-int __attribute__ ((__optimize__ ("O2"))) libgomp/oacc-init.c:acc_on_device (acc_device_t dev) libgomp/oacc-init.c-{ libgomp/oacc-init.c: return __builtin_acc_on_device (dev); libgomp/oacc-init.c-} libgomp/oacc-init.c- libgomp/oacc-init.c:ialias (acc_on_device) If I remember correctly, the reason for the "strange" prototyping/forwardin= g is that GCC builtins don't allow for 'enum' arguments? (I may be misrememberi= ng.) --- Maybe a fix for this would fall out of Tom's patch for PR82391 "[openacc] acc_on_device not folded at -O0"? (I've paged out all state of that one, unfortunately.)=