Skip to contentSkip to conversation

Tools build failure with gcc-9.2.1

Xen-devel Dario Faggioli 2 participants 4 messages Mar 25, 2020 – Mar 30, 2020

lore
Share & tools
lore
#0 lore raw

Hello,

Are the following errors (and more similar ones):

CC xenctrl_stubs.o
In file included from /usr/lib64/ocaml/caml/alloc.h:24,
from xenctrl_stubs.c:22:
xenctrl_stubs.c: In function 'stub_xc_vcpu_context_get':
/usr/lib64/ocaml/caml/mlvalues.h:265:24: error: passing argument 1 of 'memcpy' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
265 | #define String_val(x) ((const char *) Bp_val(x))

      |                       ~^~~~~~~~~~~~~~~~~~~~~~~~~
xenctrl_stubs.c:502:9: note: in expansion of macro 'String_val'
  502 |  memcpy(String_val(context), (char *) &ctxt.c, sizeof(ctxt.c));
      |         ^~~~~~~~~~
In file included from xenctrl_stubs.c:30:
/usr/include/string.h:43:14: note: expected 'void * restrict' but argument is of type 'const char *'
   43 | extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
      |              ^~~~~~

When building with:

gcc version 9.2.1 20200306 [revision c5edde44f5b17b4891f17a63517f355bbf89e7d3] (SUSE Linux)

Already known and being dealt with?

Regards

Signature · 6 lines
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)
#1 lore raw
Quoted 1 line · Dario Faggioli

Hello,

Hi Dario,

Quoted 18 lines

Are the following errors (and more similar ones):

CC xenctrl_stubs.o
In file included from /usr/lib64/ocaml/caml/alloc.h:24,
from xenctrl_stubs.c:22:
xenctrl_stubs.c: In function 'stub_xc_vcpu_context_get':
/usr/lib64/ocaml/caml/mlvalues.h:265:24: error: passing argument 1 of 'memcpy' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
265 | #define String_val(x) ((const char *) Bp_val(x))

       |                       ~^~~~~~~~~~~~~~~~~~~~~~~~~
xenctrl_stubs.c:502:9: note: in expansion of macro 'String_val'
   502 |  memcpy(String_val(context), (char *) &ctxt.c, sizeof(ctxt.c));
       |         ^~~~~~~~~~

In file included from xenctrl_stubs.c:30:
/usr/include/string.h:43:14: note: expected 'void * restrict' but argument is of type 'const char *'
43 | extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
| ^~~~~~

Quoted 5 lines

When building with:

gcc version 9.2.1 20200306 [revision c5edde44f5b17b4891f17a63517f355bbf89e7d3] (SUSE Linux)

Already known and being dealt with?

I suspect you have a new version of Ocaml built with -safe-string as per [1], String_Val() will return (const char *) rather than (char *).

I am looking at writing a patch for it and send it to xen-devel.

Cheers,

[1] https://github.com/ocaml/ocaml/pull/1274

Quoted 3 lines

Regards

Signature · 1 line
Julien Grall
#2 lore raw
Quoted 9 lines · Julien Grall
Quoted 8 lines · Dario Faggioli

/usr/include/string.h:43:14: note: expected 'void * restrict' but argument is of type 'const char *'
43 | extern void *memcpy (void *__restrict __dest, const void
*__restrict __src,

       |              ^~~~~~

When building with:

Quoted 9 lines
Quoted 4 lines

gcc version 9.2.1 20200306 [revision c5edde44f5b17b4891f17a63517f355bbf89e7d3] (SUSE Linux)

Already known and being dealt with?

I suspect you have a new version of Ocaml built with -safe-string as per
[1], String_Val() will return (const char *) rather than (char *).

Yep, I checked in the ocaml headers installed on the system, and that's exactly the case.

Quoted 2 lines

I am looking at writing a patch for it and send it to xen-devel.

Cool, thanks! I'll be happy to test it. :-)

Regards

Signature · 6 lines
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)
#3 lore raw

Hi Dario,

Quoted 19 lines · Dario Faggioli
Quoted 9 lines · Julien Grall
Quoted 8 lines · Dario Faggioli

/usr/include/string.h:43:14: note: expected 'void * restrict' but argument is of type 'const char *'
43 | extern void *memcpy (void *__restrict __dest, const void
*__restrict __src,

        |              ^~~~~~

When building with:

Quoted 9 lines
Quoted 4 lines

gcc version 9.2.1 20200306 [revision c5edde44f5b17b4891f17a63517f355bbf89e7d3] (SUSE Linux)

Already known and being dealt with?

I suspect you have a new version of Ocaml built with -safe-string as per
[1], String_Val() will return (const char *) rather than (char *).

Quoted 6 lines

Yep, I checked in the ocaml headers installed on the system, and that's exactly the case.

Quoted 2 lines

I am looking at writing a patch for it and send it to xen-devel.

Cool, thanks! I'll be happy to test it. :-)

I have just posted the patches [1]. This was compiled with OCaml 4.10.x and -safe-string. Let me know if it fixes everything on your side.

Cheers,

[1] <[email protected]>

Signature · 1 line
Julien Grall