Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!MIPS.COM!rohit From: rohit@MIPS.COM (Rohit Chandra) Newsgroups: gnu.gcc.bug Subject: bug report Message-ID: <9001172338.AA11787@batman.mips.com> Date: 17 Jan 90 23:38:01 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 159 (sorry if you get this twice - mailer problems.) I am trying to compile g++ using gcc on a MIPS M-2000 running RISC/OS 4.0, (with one change in va-mips.h) when the compiler crashes with the message: Program cc1 got fatal signal 4, while trying to compile the file expr.c Details follow: Version: gcc version 1.36 Input file: expr.c from gcc version 1.36.1- (based on GCC 1.36) with the include files in that version of g++. (with one change in va-mips.h, described below). Options: -c -DGATHER_STATISTICS -Wunused -DUSE_COLLECT -DEXTENDED_COFF -DFASCIST_ASSEMBLER -I. -I./config tm.h = tm-mips-bsd.h md = mips.md [I have made some changes in the machine description files. I *believe* these should not affect the bug, and hope you can still reproduce it.] Machine = mips m2000-8, Running RISC/OS 4.0 Error: The compiler dies with the following message- > gcc: Program cc1 got fatal signal 4. > *** Error code 1 > > Stop. To Reproduce the bug: --------------------- I am CHANGING the definitions in va-mips.h, included through gvarargs.h in the input file expr.c. Specifically, I am changing (a) typedef struct { int pnt; char *stack; double *fpregs; } va_list ; to: (b) typdef char *va_list; Compilation goes through fine for definition (a) - the original one - and the bug appears for definition (b) of va_list. [I also make the corresponding changes in the related macros va_alist, va_dcl, va_start, va_arg, va_end, but they do not affect the bug since the bug remains even if I remove all uses of these macros from the input file expr.c ] Therefore, to reproduce the bug, all you should need to do is: change the typedef of va_list in va-mips.h to typedef char* va_list; and perhaps comment out the *statements* (not the declarations) within emit_library_call in expr.c since they use the macros va_start, va_arg, va_end and therefore depend on the typedef of va_list. Description of the bug: ----------------------- The error occurs while parsing the declaration CUMULATIVE_ARGS args_so_far; in the function expand_call in the file expr.c. CUMULATIVE_ARGS args_so_far is defined to be #define CUMULATIVE_ARGS struct { \ enum arg_state arg_rec_state;\ int restype,arg_num;\ } The stack at that point (while debugging cc1) is: (dbx) run expr.cpp init_comparisons init_expr enqueue_insn protect_from_queue queued_subexp_p emit_queue init_queue convert_move convert_to_mode integer_mode_p move_by_pieces move_by_pieces_ninsns move_by_pieces_1 emit_block_move move_block_to_reg move_block_from_reg use_regs clear_storage emit_move_insn push_block gen_push_operand emit_push_insn emit_library_call expand_assignment store_expr store_constructor store_field force_operand save_noncopied_parts init_noncopied_parts validate_subtarget expand_expr expr.c: In function expand_expr: expr.c:3014: warning:assignment of pointer from integer lacks a cast expr.c:3024: warning:assignment of pointer from integer lacks a cast expand_builtin expand_increment preexpand_calls prepare_call_address emit_call_1 init_pending_stack_adjust clear_pending_stack_adjust do_pending_stack_adjust expand_cleanups_to expand_call Illegal instruction [abort.abort:22 ,0x4ac920] Source not available (dbx) where > 0 abort.abort(0x100243c8, 0x10024458, 0x7fff9c98, 0x7fff999c, 0x42e550) ["ab ort.s":22, 0x4ac920] 1 .block44 ["expr.c":3122, 0x4308bc] 2 expand_expr(exp = 0x10024900, target = 0x10024ec8, tmode = VOIDmode, modif ier = EXPAND_NORMAL) ["expr.c":3122, 0x4308bc] 3 store_expr(exp = 0x10024900, target = 0x10024ec8, suggest_reg = 0) ["expr. c":1823, 0x42d07c] 4 .block26 ["expr.c":2268, 0x42e24c] 5 expand_expr(exp = 0x10024ea8, target = (nil), tmode = VOIDmode, modifier = EXPAND_NORMAL) ["expr.c":2268, 0x42e24c] 6 variable_size(0x7fff9c9a, 0x0, 0x40b064, 0x1001e510, 0xffffff8c) ["stor-la yout.c":161, 0x42031c] 7 layout_type(0x40bad4, 0x0, 0x10024ea8, 0x0, 0x74) ["stor-layout.c":929, 0x 4222bc] 8 finish_struct(0x10024d50, 0x10123a88, 0x10020828, 0x0, 0x0) ["c-decl.c":32 05, 0x40c17c] 9 yyparse(0x10008f74, 0x2000, 0xa, 0x0, 0x2) ["c-parse.tab.c":773, 0x401864] 10 compile_file(0x0, 0x0, 0x0, 0x0, 0x0) ["toplev.c":1113, 0x41708c] 11 main(0x7fff9f74, 0x7fff9f80, 0x0, 0x0, 0x0) ["toplev.c":1981, 0x418dcc] (dbx) It is somehow related to the declarations register va_list p; ... CUMULATIVE_ARGS args_so_far; in the function emit_library_call, the only function to use varargs in the entire file. (emit_library_call occurs before the function expand_call in expr.c). If I move the declaration of CUMULATIVE_ARGS within emit_library_call from: register va_list p; ... CUMULATIVE_ARGS args_so_far; to: CUMULATIVE_ARGS args_so_far; register va_list p; ... (same declarations in the original order) then the error goes away. Although this message is long, I wonder if I have described the bug well. I will be happy to answer any more questions that you have. You can reach me at: rohit@mips.com, or rohit@cs.stanford.edu 408-991-6545 (work)