This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
getrlimit compatibility issues
- From: Richard Biener <rguenther at suse dot de>
- To: gcc at gcc dot gnu dot org
- Cc: Jan Hubicka <hubicka at ucw dot cz>
- Date: Mon, 31 Aug 2015 09:40:58 +0200 (CEST)
- Subject: getrlimit compatibility issues
- Authentication-results: sourceware.org; auth=none
Hi,
with LTO early debug and LTO bootstrap I now get
/usr/include/sys/resource.h:51:12: error: type of ʽgetrlimitʼ does not
match original declaration [-Werror=lto-type-mismatch]
extern int getrlimit (__rlimit_resource_t __resource,
^
/usr/include/sys/resource.h:51:12: note: type mismatch in parameter 1
extern int getrlimit (__rlimit_resource_t __resource,
^
/usr/include/sys/resource.h:43:13: note: type ʽ__rlimit_resource_tʼ should
match type ʽ__rlimit_resource_tʼ
typedef int __rlimit_resource_t;
^
/usr/include/sys/resource.h:39:32: note: the incompatible type is defined
here
typedef enum __rlimit_resource __rlimit_resource_t;
^
/usr/include/sys/resource.h:51:12: note: ʽgetrlimitʼ was previously
declared here
extern int getrlimit (__rlimit_resource_t __resource,
^
the issue is wrt C / C++ context where glibc headers have
#if defined __USE_GNU && !defined __cplusplus
typedef enum __rlimit_resource __rlimit_resource_t;
typedef enum __rusage_who __rusage_who_t;
typedef enum __priority_which __priority_which_t;
#else
typedef int __rlimit_resource_t;
typedef int __rusage_who_t;
typedef int __priority_which_t;
#endif
and the enum is unsigned:
(gdb) p debug_tree (0x7fffe7aa2690)
<enumeral_type 0x7fffe7aa2690 __rlimit_resource_t unsigned SI
size <integer_cst 0x7ffff6281df8 type <integer_type 0x7ffff62852a0
bitsizetype> constant 32>
unit size <integer_cst 0x7ffff6281e10 type <integer_type
0x7ffff62851f8 sizetype> constant 4>
which currently isn't compatible with signed int.
I'm now double-checking unpatched LTO bootstrap but I guess I somehow
just keep streaming some more decls or get different partitioning.
I know in the end you'd like to make int and unsigned int compatible
for this check(?) but I wonder whether glibc really desired to make
the enum unsigned... it's just
/* Kinds of resource limit. */
enum __rlimit_resource
{
/* Per-process CPU limit, in seconds. */
RLIMIT_CPU = 0,
...
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
};
one reason I get here might be also that somehow the locations of
the decls are not in-system-header. This would be an artifact of
LTO location streaming I guess.
Oh, seems unpatched LTO bootstrap is broken (possibly by me).
Richard.