https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64972

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Kai Tietz from comment #13)
> Rainer: does following patch works for you?
> 
> Index: oacc-parallel.c
> ===================================================================
> --- oacc-parallel.c   (Revision 221640)
> +++ oacc-parallel.c   (Arbeitskopie)
> @@ -31,6 +31,9 @@
>  #include "libgomp_g.h"
>  #include "gomp-constants.h"
>  #include "oacc-int.h"
> +#ifdef HAVE_INTTYPES_H
> +# include <inttypes.h>  /* For PRIu64.  */
> +#endif
>  #include <string.h>
>  #include <stdarg.h>
>  #include <assert.h>
> @@ -99,9 +102,14 @@ GOACC_parallel (int device, void (*fn) (void *),
>      gomp_fatal ("num_workers (%d) different from one is not yet supported",
>               num_workers);
>  
> +#ifdef HAVE_INTTYPES_H
> +  gomp_debug (0, "%s: mapnum=%"PRIu64", hostaddrs=%p, size=%p, kinds=%p, "
> +              "async = %d\n",
> +           __FUNCTION__, (uint64_t) mapnum, hostaddrs, sizes, kinds, async);
> +#else
>    gomp_debug (0, "%s: mapnum=%zd, hostaddrs=%p, sizes=%p, kinds=%p,
> async=%d\n",
>             __FUNCTION__, mapnum, hostaddrs, sizes, kinds, async);
> -
> +#endif
>    select_acc_device (device);
>  
>    thr = goacc_thread ();
> @@ -178,8 +186,13 @@ GOACC_data_start (int device, size_t mapnum,
>    bool host_fallback = device == GOMP_DEVICE_HOST_FALLBACK;
>    struct target_mem_desc *tgt;
>  
> +#ifdef HAVE_INTTYPES_H
> +  gomp_debug (0, "%s: mapnum=%"PRIu64", hostaddrs=%p, size=%p, kinds=%p\n",
> +           __FUNCTION__, (uint64_t) mapnum, hostaddrs, sizes, kinds);
> +#else
>    gomp_debug (0, "%s: mapnum=%zd, hostaddrs=%p, sizes=%p, kinds=%p\n",
>             __FUNCTION__, mapnum, hostaddrs, sizes, kinds);
> +#endif
>  
>    select_acc_device (device);
>  
> Index: target.c
> ===================================================================
> --- target.c  (Revision 221640)
> +++ target.c  (Arbeitskopie)
> @@ -33,6 +33,9 @@
>  #include <limits.h>
>  #include <stdbool.h>
>  #include <stdlib.h>
> +#ifdef HAVE_INTTYPES_H
> +# include <inttypes.h>  /* For PRIu64.  */
> +#endif
>  #include <string.h>
>  #include <assert.h>
>  
> @@ -438,9 +441,16 @@ gomp_map_vars (struct gomp_device_descr *devicep,
>                     /* We already looked up the memory region above and it
>                        was missing.  */
>                     size_t size = k->host_end - k->host_start;
> +#ifdef HAVE_INTTYPES_H
>                     gomp_fatal ("present clause: !acc_is_present (%p, "
> +                               PRIu64" (0x"PRIx64"))",
> +                               (void *) k->host_start,
> +                               (uint64_t) size, (uint64_t) size);
> +#else
> +                   gomp_fatal ("present clause: !acc_is_present (%p, "
>                                 "%zd (0x%zx))", (void *) k->host_start,
>                                 size, size);
> +#endif
>                   }
>                   break;
>                 case GOMP_MAP_FORCE_DEVICEPTR:

The fallback case really should use %ld or %lx and casts to (unsigned long).
Targets that have inttypes.h will (with the exception of M$ targets) likely
also support %zd / %zx.

Reply via email to