From 75a558d4cf5561d7db8c3be1280fb9e816f2a41c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krystian=20Bac=C5=82awski?= Date: Fri, 24 Jul 2020 21:23:49 +0200 Subject: [PATCH] Fix runtime errors on 64-bit architectures (tested under MacOS Catalina). * Ignoring implicit function declaration warnings resulted in pointers being clobbered to int type. --- gcc/config/m68k/amigaos.c | 4 +++- gcc/config/m68k/amigaos.h | 12 +++++++++++- gcc/config/m68k/m68k.h | 3 +++ gcc/flow.c | 2 ++ gcc/optabs.c | 2 ++ gcc/protoize.c | 1 + libiberty/vfork.c | 2 ++ texinfo/intl/bindtextdom.c | 1 + texinfo/intl/explodename.c | 3 +++ texinfo/intl/finddomain.c | 1 + texinfo/intl/l10nflist.c | 3 +++ texinfo/intl/loadmsgcat.c | 3 +++ texinfo/intl/localealias.c | 3 +++ texinfo/intl/textdomain.c | 2 ++ texinfo/lib/getopt.c | 2 ++ texinfo/lib/xmalloc.c | 2 +- texinfo/makeinfo/makeinfo.c | 8 ++++++++ texinfo/makeinfo/multi.c | 7 +++++++ 18 files changed, 58 insertions(+), 3 deletions(-) diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c index e4f8eb2..68645e3 100644 --- a/gcc/config/m68k/amigaos.c +++ b/gcc/config/m68k/amigaos.c @@ -27,6 +27,8 @@ Boston, MA 02111-1307, USA. */ #include "tree.h" #include "flags.h" #include "expr.h" + +extern void error (), error_with_decl (); /* Baserel support. */ @@ -367,7 +369,7 @@ amigaos_function_arg(CUMULATIVE_ARGS *cum, enum machine_mode mode, return gen_rtx(REG, mode, cum->last_arg_reg); } else - return (struct rtx_def *)m68k_function_arg(cum, mode, type); + return m68k_function_arg(cum, mode, type); } /* Return zero if the attributes on TYPE1 and TYPE2 are incompatible, diff --git a/gcc/config/m68k/amigaos.h b/gcc/config/m68k/amigaos.h index 644ad33..ebd807e 100644 --- a/gcc/config/m68k/amigaos.h +++ b/gcc/config/m68k/amigaos.h @@ -474,6 +474,7 @@ while (0) /* Given that symbolic_operand(X), return TRUE if no special base relative relocation is necessary */ +int read_only_operand (); #define LEGITIMATE_BASEREL_OPERAND_P(X) \ (flag_pic >= 3 && read_only_operand (X)) @@ -498,6 +499,7 @@ while (0) On the Amiga we use this to indicate if references to a symbol should be absolute or base relative. */ +int amigaos_put_in_text (); #define ENCODE_SECTION_INFO(DECL) \ do \ { \ @@ -608,6 +610,7 @@ while (0) /* Determine if the epilogue should be output as RTL. Don't do it if preserving a4. */ +int amigaos_restore_a4 (); #undef USE_RETURN_INSN #define USE_RETURN_INSN (use_return_insn () && ! amigaos_restore_a4 ()) @@ -617,6 +620,7 @@ while (0) ARGS is a valid machine specific attribute for DECL. The attributes in ATTRIBUTES have previously been assigned to DECL. */ +int valid_amigaos_decl_attribute (); #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \ (valid_amigaos_decl_attribute ((DECL), (IDENTIFIER))) @@ -624,6 +628,7 @@ while (0) ARGS is a valid machine specific attribute for TYPE. The attributes in ATTRIBUTES have previously been assigned to TYPE. */ +int valid_amigaos_type_attribute (); #undef VALID_MACHINE_TYPE_ATTRIBUTE #define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, IDENTIFIER, ARGS) \ (valid_amigaos_type_attribute ((TYPE), (ATTRIBUTES), (IDENTIFIER), (ARGS))) @@ -662,6 +667,7 @@ struct amigaos_args for a call to a function whose data type is FNTYPE. For a library call, FNTYPE is 0. */ +void amigaos_init_cumulative_args (); #undef INIT_CUMULATIVE_ARGS #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \ (amigaos_init_cumulative_args(&(CUM), (FNTYPE))) @@ -670,6 +676,7 @@ struct amigaos_args of mode MODE and data type TYPE. (TYPE is null for libcalls where that information may not be available.) */ +void amigaos_function_arg_advance (); #undef FUNCTION_ARG_ADVANCE #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ (amigaos_function_arg_advance (&(CUM))) @@ -677,14 +684,16 @@ struct amigaos_args /* A C expression that controls whether a function argument is passed in a register, and which register. */ +struct rtx_def *amigaos_function_arg (); #undef FUNCTION_ARG #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ - ((struct rtx_def *)amigaos_function_arg (&(CUM), (MODE), (TYPE))) + (amigaos_function_arg (&(CUM), (MODE), (TYPE))) /* A C expression whose value is zero if the attributes on TYPE1 and TYPE2 are incompatible, one if they are compatible, and two if they are nearly compatible (which causes a warning to be generated). */ +int comp_amigaos_type_attributes (); #undef COMP_TYPE_ATTRIBUTES #define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \ (comp_amigaos_type_attributes ((TYPE1), (TYPE2))) @@ -741,6 +750,7 @@ struct rtx_def* gen_stack_cleanup_call (); #undef TARGET_ALTERNATE_ALLOCATE_STACK #define TARGET_ALTERNATE_ALLOCATE_STACK 1 +void amigaos_alternate_allocate_stack (); #define ALTERNATE_ALLOCATE_STACK(OPERANDS) \ do \ { \ diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h index e53c47a..ebd53ad 100644 --- a/gcc/config/m68k/m68k.h +++ b/gcc/config/m68k/m68k.h @@ -2187,6 +2187,9 @@ extern void print_operand (); extern void notice_update_cc (); extern void finalize_pic (); extern void override_options (); +extern void m68k_init_cumulative_args (), m68k_function_arg_advance (); +extern struct rtx_def *m68k_function_arg (); +extern int comp_m68k_type_attributes (), valid_m68k_type_attribute (); /* diff --git a/gcc/flow.c b/gcc/flow.c index 6a44df7..6b751c7 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -273,6 +273,8 @@ static rtx label_value_list; #define SET_INSN_VOLATILE(INSN) bitmap_set_bit (uid_volatile, INSN_UID (INSN)) static bitmap uid_volatile; +int function_arg_regno_p (); + /* Forward declarations */ static int count_basic_blocks PROTO((rtx)); static rtx find_basic_blocks_1 PROTO((rtx, rtx*)); diff --git a/gcc/optabs.c b/gcc/optabs.c index b360262..ea106ea 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -36,6 +36,8 @@ Boston, MA 02111-1307, USA. */ #include "recog.h" #include "reload.h" +extern int significand_size (); + /* Each optab contains info on how this target machine can perform a particular operation for all sizes and kinds of operands. diff --git a/gcc/protoize.c b/gcc/protoize.c index 7e9205c..5bcbc49 100644 --- a/gcc/protoize.c +++ b/gcc/protoize.c @@ -69,6 +69,7 @@ Boston, MA 02111-1307, USA. */ #endif #endif #include +#include /* Some systems like Linux don't declare rindex if _POSIX_SOURCE is declared, but it normally does declare it. This means that configure thinks we don't diff --git a/libiberty/vfork.c b/libiberty/vfork.c index 86c4591..152d1a8 100644 --- a/libiberty/vfork.c +++ b/libiberty/vfork.c @@ -1,6 +1,8 @@ /* Emulate vfork using just plain fork, for systems without a real vfork. This function is in the public domain. */ +int fork (); + int vfork () { diff --git a/texinfo/intl/bindtextdom.c b/texinfo/intl/bindtextdom.c index 9fcb8d9..309a9d7 100644 --- a/texinfo/intl/bindtextdom.c +++ b/texinfo/intl/bindtextdom.c @@ -25,6 +25,7 @@ # ifdef HAVE_MALLOC_H # include # else +void *malloc(); void free (); # endif #endif diff --git a/texinfo/intl/explodename.c b/texinfo/intl/explodename.c index 5c4e09e..a16b01f 100644 --- a/texinfo/intl/explodename.c +++ b/texinfo/intl/explodename.c @@ -21,6 +21,9 @@ #if defined STDC_HEADERS || defined _LIBC # include +#else +void *malloc (); +void free (); #endif #include #include diff --git a/texinfo/intl/finddomain.c b/texinfo/intl/finddomain.c index ec85d4d..c84612d 100644 --- a/texinfo/intl/finddomain.c +++ b/texinfo/intl/finddomain.c @@ -31,6 +31,7 @@ # ifdef HAVE_MALLOC_H # include # else +void *malloc (); void free (); # endif #endif diff --git a/texinfo/intl/l10nflist.c b/texinfo/intl/l10nflist.c index 4e2bc13..670b47f 100644 --- a/texinfo/intl/l10nflist.c +++ b/texinfo/intl/l10nflist.c @@ -46,6 +46,9 @@ #if defined STDC_HEADERS || defined _LIBC # include +#else +void *malloc (); +void free (); #endif #include "loadinfo.h" diff --git a/texinfo/intl/loadmsgcat.c b/texinfo/intl/loadmsgcat.c index 73e90a9..8897b0f 100644 --- a/texinfo/intl/loadmsgcat.c +++ b/texinfo/intl/loadmsgcat.c @@ -25,6 +25,9 @@ #if defined STDC_HEADERS || defined _LIBC # include +#else +void *malloc (); +void free (); #endif #if defined HAVE_UNISTD_H || defined _LIBC diff --git a/texinfo/intl/localealias.c b/texinfo/intl/localealias.c index 00d9194..656fcb3 100644 --- a/texinfo/intl/localealias.c +++ b/texinfo/intl/localealias.c @@ -44,10 +44,13 @@ char *alloca (); #if defined STDC_HEADERS || defined _LIBC # include #else +void *bsearch (); char *getenv (); +void qsort (); # ifdef HAVE_MALLOC_H # include # else +void *malloc (); void free (); # endif #endif diff --git a/texinfo/intl/textdomain.c b/texinfo/intl/textdomain.c index 55d9340..d16e3d3 100644 --- a/texinfo/intl/textdomain.c +++ b/texinfo/intl/textdomain.c @@ -22,6 +22,8 @@ #if defined STDC_HEADERS || defined _LIBC # include +#else +void free (); #endif #if defined STDC_HEADERS || defined HAVE_STRING_H || defined _LIBC diff --git a/texinfo/lib/getopt.c b/texinfo/lib/getopt.c index fc87ce6..bdff79d 100644 --- a/texinfo/lib/getopt.c +++ b/texinfo/lib/getopt.c @@ -200,6 +200,8 @@ static char *posixly_correct; #include #define my_index strchr #else +size_t strlen (); +int strcmp (), strncmp (); /* Avoid depending on library functions or files whose names are inconsistent. */ diff --git a/texinfo/lib/xmalloc.c b/texinfo/lib/xmalloc.c index 156989e..ad73587 100644 --- a/texinfo/lib/xmalloc.c +++ b/texinfo/lib/xmalloc.c @@ -30,7 +30,7 @@ #include extern void *malloc (), *realloc (); -static void memory_error_and_abort (); +static void abort(), memory_error_and_abort (); /* **************************************************************** */ /* */ diff --git a/texinfo/makeinfo/makeinfo.c b/texinfo/makeinfo/makeinfo.c index 3094a65..14923ee 100644 --- a/texinfo/makeinfo/makeinfo.c +++ b/texinfo/makeinfo/makeinfo.c @@ -50,6 +50,10 @@ char *alloca (); # endif #endif +void *malloc (); +void free (), qsort (), abort (), exit (); +int atoi (); + /* We'd like to take advantage of _doprnt if it's around, a la error.c, but then we'd have no VA_SPRINTF. */ #if HAVE_VPRINTF @@ -434,6 +438,10 @@ void undefindex (), top_defindex (), gen_defindex (); void define_user_command (); void free_pending_notes (), output_pending_notes (); +int validate (), search_forward (), set_paragraph_indent (), self_delimiting (), + set_footnote_style (); +void end_multitable (), multitable_item (); + char **get_brace_args (); char *expansion (); int array_len (); diff --git a/texinfo/makeinfo/multi.c b/texinfo/makeinfo/multi.c index f5b1fe9..275e53f 100644 --- a/texinfo/makeinfo/multi.c +++ b/texinfo/makeinfo/multi.c @@ -22,6 +22,13 @@ #define MAXCOLS 100 /* remove this limit later @@ */ +void inhibit_output_flushing (), uninhibit_output_flushing (), insert (), + close_paragraph (), line_error (), init_paragraph (), error (), + cm_noindent (), exit (), warning (), flush_output (); + +int setup_output_environment (), select_output_environment (), + setup_multitable_parameters (); + /* * Output environments. This is a hack grafted onto existing