[Bug translator/25845] New: buildrun: type-conversion warnings 32-bit with recent gcc

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug translator/25845] New: buildrun: type-conversion warnings 32-bit with recent gcc

Sourceware - systemtap mailing list
https://sourceware.org/bugzilla/show_bug.cgi?id=25845

            Bug ID: 25845
           Summary: buildrun: type-conversion warnings 32-bit with recent
                    gcc
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
          Assignee: systemtap at sourceware dot org
          Reporter: me at serhei dot io
  Target Milestone: ---

Recent GCC (seen on 9.3.1) complain when compiling stap modules for 32-bit
systems. The behaviour that's now being flagged is well-known, unobjectionable
and fairly difficult to get rid of -- it's based on the fact that stap scalar
values are always 64-bit words regardless of the type being store in them. Most
likely, we should suppress the warnings in question, but I'm filing a PR to
keep track of the decision in case there are any surprises.

Example:

as_root /notnfs/smakarov/stap-checkout/stap_install/bin/stap --rlimit-as=1
--rlimit-as=99999999999\
9 -wp4 /notnfs/smakarov/stap-checkout/testsuite/systemtap.base/rlimit.stp
OUT /tmp/stapwwHXqw/stap_2fcc2a5ab281c9226223b81a92db655d_2051647_src.c: In
function 'function___g\
lobal___get_kregs__overload_0':
/tmp/stapwwHXqw/stap_2fcc2a5ab281c9226223b81a92db655d_2051647_src.c:328917:33:
error: cast from po\
inter to integer of different size [-Werror=pointer-to-int-cast]
328917 |      /* guru */ STAP_RETVALUE = (int64_t)CONTEXT->kregs;
       |                                 ^
/tmp/stapwwHXqw/stap_2fcc2a5ab281c9226223b81a92db655d_2051647_src.c: In
function 'function___globa\
l___set_kregs__overload_0':
/tmp/stapwwHXqw/stap_2fcc2a5ab281c9226223b81a92db655d_2051647_src.c:328956:34:
error: cast to poin\
ter from integer of different size [-Werror=int-to-pointer-cast]
328956 |      /* guru */ CONTEXT->kregs = (struct pt_regs*)STAP_ARG_regs;
       |                                  ^
/tmp/stapwwHXqw/stap_2fcc2a5ab281c9226223b81a92db655d_2051647_src.c: In
function 'function___priva\
te__notnfs_smakarov_stap_checkout_testsuite_systemtap_base_rlimit_stp__dwarf_tvar_get_new_rev_269':
/tmp/stapwwHXqw/stap_2fcc2a5ab281c9226223b81a92db655d_2051647_src.c:369039:111:
error: conversion \
from 'long long unsigned int' to 'long unsigned int' changes value from
'18446744070503413664' to \
'1088829344' [-Werror=overflow]
369039 |   l->__retvalue = (((((int64_t) (({ unsigned long addr = 0; addr =
_stp_kmodule_relocate \
("kernel", "_stext", 0xffffffff40e637a0); addr; }))))) &
(((int64_t)4294967295LL)));
       |                                                                      
                  \
                     ^~~~~~~~~~~~~~~~~~
/tmp/stapwwHXqw/stap_2fcc2a5ab281c9226223b81a92db655d_2051647_src.c: In
function 'function___priva\
te__notnfs_smakarov_stap_checkout_testsuite_systemtap_base_rlimit_stp__dwarf_tvar_get_patch_268':
/tmp/stapwwHXqw/stap_2fcc2a5ab281c9226223b81a92db655d_2051647_src.c:376520:111:
error: conversion \
from 'long long unsigned int' to 'long unsigned int' changes value from
'18446744070503409568' to \
'1088825248' [-Werror=overflow]
376520 |   l->__retvalue = (((((int64_t) (({ unsigned long addr = 0; addr =
_stp_kmodule_relocate \
("kernel", "_stext", 0xffffffff40e627a0); addr; }))))) &
(((int64_t)4294967295LL)));
       |                                                                      
                  \
                     ^~~~~~~~~~~~~~~~~~

--
You are receiving this mail because:
You are the assignee for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug translator/25845] buildrun: type-conversion warnings 32-bit with recent gcc

Sourceware - systemtap mailing list
https://sourceware.org/bugzilla/show_bug.cgi?id=25845

--- Comment #1 from Serhei Makarov <me at serhei dot io> ---
The primary source of errors -Wpointer<->int-cast has been disabled in commit
4f9715d3b8

Remaining issues I can spot in the test output:
- -Werror=overflow in the rlimit.exp testcase (see previous post)
- -Wpointer-to-int-cast warnings when compiling java/HelperSDT.c

  CC       HelperSDT.o
/notnfs/smakarov/stap-checkout/java/HelperSDT.c: In function
‘determine_java_type’:
/notnfs/smakarov/stap-checkout/java/HelperSDT.c:50:12: warning: cast from
pointer to integer of di\
fferent size [-Wpointer-to-int-cast]
   50 |     return (int64_t) strdup("(null)"); /* need a real string to avoid
user_string_warn get\
ting upset */
      |            ^
/notnfs/smakarov/stap-checkout/java/HelperSDT.c:90:10: warning: cast from
pointer to integer of di\
fferent size [-Wpointer-to-int-cast]
   90 |   return (int64_t) get_java_tostring(env, _arg);
      |          ^
/notnfs/smakarov/stap-checkout/java/HelperSDT.c: In function ‘free_sargs’:
/notnfs/smakarov/stap-checkout/java/HelperSDT.c:109:12: warning: cast to
pointer from integer of d\
ifferent size [-Wint-to-pointer-cast]
  109 |       free((void *) sargs[i]);
      |            ^
  CCLD     libHelperSDT.so

--
You are receiving this mail because:
You are the assignee for the bug.