[LU-17504] build errors with gcc-13 Created: 05/Feb/24  Updated: 05/Feb/24

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.16.0
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Jian Yu Assignee: WC Triage
Resolution: Unresolved Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

gcc-13 added a new warning:

-Wenum-int-mismatch warns about mismatches between an enumerated type and an integer type

which caused the following Lustre build errors:

/root/lustre-release/lustre/ptlrpc/pack_generic.c:81:5: error: conflicting types for 'lustre_msg_check_version' due to enum/integer mismatch; have 'int(struct lustre_msg_v2 *, enum lustre_msg_version)' [-Werror=enum-int-mismatch]
   81 | int lustre_msg_check_version(struct lustre_msg *msg,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/lustre-release/lustre/ptlrpc/pack_generic.c:48:
/root/lustre-release/lustre/include/lustre_net.h:2287:5: note: previous declaration of 'lustre_msg_check_version' with type 'int(struct lustre_msg_v2 *, __u32)' {aka 'int(struct lustre_msg_v2 *, unsigned int)'}
 2287 | int lustre_msg_check_version(struct lustre_msg *msg, __u32 version);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
/root/lustre-release/lustre/ptlrpc/pack_generic.c:858:20: error: conflicting types for 'lustre_msghdr_get_flags' due to enum/integer mismatch; have 'enum lustre_msghdr(struct lustre_msg_v2 *)' [-Werror=enum-int-mismatch]
  858 | enum lustre_msghdr lustre_msghdr_get_flags(struct lustre_msg *msg)
      |                    ^~~~~~~~~~~~~~~~~~~~~~~
/root/lustre-release/lustre/include/lustre_net.h:2315:7: note: previous declaration of 'lustre_msghdr_get_flags' with type '__u32(struct lustre_msg_v2 *)' {aka 'unsigned int(struct lustre_msg_v2 *)'}
 2315 | __u32 lustre_msghdr_get_flags(struct lustre_msg *msg);
      |       ^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
liblustreapi_layout.c:2141:5: error: conflicting types for 'llapi_layout_comp_use' due to enum/integer mismatch; have 'int(struct llapi_layout *, enum llapi_layout_comp_use)' [-Werror=enum-int-mismatch]
 2141 | int llapi_layout_comp_use(struct llapi_layout *layout,
      |     ^~~~~~~~~~~~~~~~~~~~~
In file included from liblustreapi_layout.c:44:
/root/lustre-release/lustre/include/lustre/lustreapi.h:1233:5: note: previous declaration of 'llapi_layout_comp_use' with type 'int(struct llapi_layout *, uint32_t)' {aka 'int(struct llapi_layout *, unsigned int)'}
 1233 | int llapi_layout_comp_use(struct llapi_layout *layout, uint32_t pos);
      |     ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

 



 Comments   
Comment by Jian Yu [ 05/Feb/24 ]

More fallthrough warnings:

/root/lustre-release/libcfs/libcfs/fail.o: warning: objtool: __cfs_fail_check_set() falls through to next function __cfs_fail_timeout_set()
  CC [M]  /root/lustre-release/libcfs/libcfs/module.o
/root/lustre-release/libcfs/libcfs/module.o: warning: objtool: libcfs_force_lbug() falls through to next function proc_cpt_distance()
  CC [M]  /root/lustre-release/libcfs/libcfs/tracefile.o
  CC [M]  /root/lustre-release/libcfs/libcfs/libcfs_string.o
  CC [M]  /root/lustre-release/libcfs/libcfs/hash.o
/root/lustre-release/libcfs/libcfs/hash.o: warning: objtool: cfs_hash_bd_del_locked() falls through to next function cfs_hash_cond_del_locked()
/root/lustre-release/libcfs/libcfs/hash.o: warning: objtool: cfs_hash_bd_from_key() falls through to next function cfs_hash_buckets_free()
/root/lustre-release/libcfs/libcfs/hash.o: warning: objtool: cfs_hash_bd_get() falls through to next function cfs_hash_multi_bd_findadd_locked.constprop.0()
/root/lustre-release/libcfs/libcfs/hash.o: warning: objtool: cfs_hash_bd_move_locked() falls through to next function cfs_hash_dual_bd_get()
/root/lustre-release/libcfs/libcfs/hash.o: warning: objtool: cfs_hash_dual_bd_get() falls through to next function cfs_hash_rehash_key()
/root/lustre-release/libcfs/libcfs/hash.o: warning: objtool: cfs_hash_rehash_cancel() falls through to next function cfs_hash_putref()
/root/lustre-release/libcfs/libcfs/hash.o: warning: objtool: cfs_hash_for_each_enter() falls through to next function cfs_hash_rehash()
Comment by Jian Yu [ 05/Feb/24 ]

More -Werror=attribute-warning errors:

In function ‘fortify_memcpy_chk’,
    inlined from ‘class_handle_ioctl’ at /root/lustre-release/lustre/obdclass/class_obd.c:389:3:
include/linux/fortify-string.h:583:25: error: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
  583 |                         __write_overflow_field(p_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
In function ‘fortify_memcpy_chk’,
    inlined from ‘dt_index_page_build’ at /root/lustre-release/lustre/obdclass/dt_object.c:908:5:
include/linux/fortify-string.h:583:25: error: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
  583 |                         __write_overflow_field(p_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Comment by Jian Yu [ 05/Feb/24 ]

More -Werror=stringop-overread errors:

In function ‘strcpy’,
    inlined from ‘do_config_log_add.isra’ at /root/lustre-release/lustre/mgc/mgc_request.c:225:2:
include/linux/fortify-string.h:798:17: error: call to ‘__write_overflow’ declared with attribute error: detected write beyond size of object (1st parameter)
  798 |                 __write_overflow();
      |                 ^~~~~~~~~~~~~~~~~~
/root/lustre-release/lustre/mgc/mgc_request.c: In function ‘config_log_find’:
/root/lustre-release/lustre/mgc/mgc_request.c:190:21: error: ‘strcmp’ reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread]
  190 |                 if (strcmp(logname, cld->cld_logname) == 0) {
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/lustre-release/lustre/include/lustre_log.h:54,
                 from /root/lustre-release/lustre/mgc/mgc_request.c:45:
/root/lustre-release/lustre/include/obd_class.h:282:37: note: source object ‘cld_logname’ of size 0
  282 |         char                        cld_logname[0];
      |                                     ^~~~~~~~~~~
cc1: all warnings being treated as errors
/root/lustre-release/lustre/lmv/lmv_obd.c: In function ‘stripe_dirent_get’:
/root/lustre-release/lustre/lmv/lmv_obd.c:2767:22: error: ‘strncmp’ specified bound [1, 65535] exceeds source size 0 [-Werror=stringop-overread]
 2767 |                     (strncmp(ent->lde_name, ".",
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
 2768 |                              le16_to_cpu(ent->lde_namelen)) == 0 ||
      |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/lustre-release/lustre/include/lprocfs_status.h:50,
                 from /root/lustre-release/lustre/include/obd_support.h:42,
                 from /root/lustre-release/lustre/lmv/lmv_obd.c:46:
/root/lustre-release/lustre/include/uapi/linux/lustre/lustre_idl.h:460:23: note: source object allocated here
  460 |         char          lde_name[0];
      |                       ^~~~~~~~
/root/lustre-release/lustre/lmv/lmv_obd.c:2769:22: error: ‘strncmp’ specified bound [1, 65535] exceeds source size 0 [-Werror=stringop-overread]
 2769 |                      strncmp(ent->lde_name, "..",
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2770 |                              le16_to_cpu(ent->lde_namelen)) == 0))
      |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/lustre-release/lustre/include/uapi/linux/lustre/lustre_idl.h:460:23: note: source object allocated here
  460 |         char          lde_name[0];
      |                       ^~~~~~~~
cc1: all warnings being treated as errors
Generated at Sat Feb 10 03:35:58 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.