Article View: gnu.g++.bug
Article #1144Bug report, fatal signal
From: Bengt Martensson
Date: Thu, 12 Nov 1992 17:23
Date: Thu, 12 Nov 1992 17:23
724 lines
24068 bytes
24068 bytes
Hi.
I have encountered a gcc error in compiling the enclosed file. Gcc
version 2.3.1. Gcc version 2.2.2 does not have this problem! Script:
<112>% gcc -fPIC -c -I/local/X11R5/include terminate.cc
gcc: Internal compiler error: program cc1plus got fatal signal 6
<113>% gcc -c -I/local/X11R5/include terminate.cc
<114>% gcc-2.2.2 -fPIC -c -I/local/X11R5/include terminate.cc
The problem does not happen if not using the -fPIC switch. Hardware:
Sun 4, operating system Sun OS 4.1.1 and 4.1.2 (I tried both). No
modifications to gcc sources, configured with
configure --target=sparc-sun-sunos4.1
Bengt Martensson +49 421 218-2952 (office)
Institute for Dynamical Systems +49 421 17 17 13 (home)
University of Bremen +49 421 218-4235 (fax)
P.O. Box 330 440, D-2800 Bremen 33, Germany bengt@mathematik.uni-Bremen.de
/*
Copyright (C) 1992 Bengt Martensson and Institute for Dynamical Systems.
This file is part of Gnans.
Gnans is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Gnans is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with Gnans; see the file COPYING. If not, write to the
Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $Id: terminate.cc,v 1.3 1992/08/27 16:58:14 bengt Exp $ */
/*
Copyright (C) 1992 Bengt Martensson and Institute for Dynamical Systems.
This file is part of Gnans.
Gnans is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Gnans is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with Gnans; see the file COPYING. If not, write to the
Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $Id: externals.h,v 1.15 1992/09/01 20:57:57 bengt Exp bengt $ */
/*
* This file should contain ALL externally visible variables and function,
* with the exception of some functions declared in cmdparse.h,
* and algorithms, declared in algorithms.cc.
*/
/* Documentation is found by definition, not in this file. */
/*#include "sysdep.h" /* System dependencies */
/*
Copyright (C) 1992 Bengt Martensson and Institute for Dynamical Systems.
This file is part of Gnans.
Gnans is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Gnans is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with Gnans; see the file COPYING. If not, write to the
Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $Id: gnans.h,v 1.10 1992/09/01 20:58:33 bengt Exp bengt $ */
/* This file defines types and compilation constants */
/* Define a symbol stating that we are a part of Gnans. */
#define GNANS
#ifdef IS_GNANS_SYSTEM
typedef void * Widget;
#else
/*
* This is just to get as much type checking as possible during program
* development
*/
#ifdef PedanticFunctionPrototypes
#ifdef NeedFunctionPrototypes
#undef NeedFunctionPrototypes
#endif
#define NeedFunctionPrototypes YES
#ifdef NeedVarargsPrototypes
#undef NeedVarargsPrototypes
#endif
#define NeedVarargsPrototypes YES
//#include <X11/Xfuncproto.h> /* Missing under Open Windows 3.0 */
#endif /* PedanticFunctionPrototypes */
/****************************************************************/
/* Include some files just to make the rest of this file understandable */
#include <stdio.h> /* Defines FILE */
/*
* To get at the typedefs like XtPointer, necessary for typedefs herein
* to make sense
*/
#include <X11/Intrinsic.h>
#endif /* ! IS_GNANS_SYSTEM */
/**************** Compilation constants ****************/
/*
* There should normally not be any reason to change these.
*/
#define MAXSTRINGSIZE 255
#define MAXFILES 10
#define MAXSTATES 100
#define MAXSTORES 100
#define CHILDCOMMANDS 4
/*
* An integration algorithm can generate at most this many
* different error messages
*/
#define MAX_ERRORMESSAGES 10
/*
* More memory is allocated for trajectories using this a the least unit
* Should NOT be a number like `10000'
*/
#define MALLOCUNIT 65536
/* Microsecond between alarms for workprocs. 1E5--1E6 makes sense */
#define TIMESLICE 1000000
/****************************************************************/
/* Site preferences, like favorite child program */
/*#include "site.h"*/
/* How many internal parameters? */
#define number_of_internals 8
/****************************************************************/
/***************** Type definitions *****************/
typedef enum {
false = 0,
true = 1
} boolean;
typedef enum {
init_all = 0,
init_none = 1,
init_states = 2 /* States but not rng's */
} continuation_t;
/**************** Error severities ****************/
typedef enum {
impossible, /* This cannot happen, dump core */
fatal, /* Quit program */
non_fatal, /* Stop simulation or script */
just_say_no, /* Refuse to run */
parse, /* Error during parsing */
recoverable, /* Possibility to continue run */
debug, /* Debugging message */
warning, /* Warnings */
message, /* Just some information */
signal_handler_message, /* A message from a signal handler */
coredump /* Dump core */
} severity;
/**************** Types of systems ****************/
typedef enum {
continuous,
discrete,
hybrid,
das,
riccati
} system_types;
#ifndef IS_GNANS_SYSTEM
/**************** Data stucture for a store format ****************/
class store_format_type {
public:
/* Scratch pointer to a Widget */
// Widget widget;
/* Name of format as it appears in menus etc */
char *name;
/* File name extension to be used */
char *extension;
/*
* Pointer to a function returning true iff the format can be used with
* present parameters. If the argument is true, should present an
* error message
*/
boolean (*check)(boolean complain);
/* Pointer to a function doing the actual writing */
boolean (*write)(void);
/* A documentation string */
char *documentation;
};
#endif /* ! IS_GNANS_SYSTEM */
class rng;
/* Data structure for user visable parameters */
class user_parameter {
char scratch[MAXSTRINGSIZE];
double value; /* value */
public:
// Widget widget; /* Scratch pointer to a Widget */
char *name; /* The name of the parameter */
char *documentation; /* Documentation string */
boolean store_me; /* Should the variable be stored? */
rng *rng_ptr; /* Another pointer, presently used for rng's */
void init(char *nam, char *doc, boolean store, double val)
{
value = val;
name = nam;
documentation = doc;
store_me = store;
}
void init(char *nam, char *doc, boolean store)
{
extern double gnans_NaN();
init(nam, doc, store, gnans_NaN());
}
user_parameter(char *nam, char *doc, boolean store, double val)
{ init(nam, doc, store, val); }
user_parameter(char *nam, char *doc, boolean store)
{ init(nam, doc, store); }
user_parameter()
{
extern double gnans_NaN();
value = gnans_NaN();
name = NULL;
documentation = NULL;
store_me = false;
}
operator double() { return value; }
operator double*() { return &value; }
operator char*() { (void) sprintf(scratch, "%g", value);
return scratch; }
double operator-() { return -value; }
operator=(double val) { value = val; return *this; }
operator-=(double val) { value -= val; return *this; }
double operator+(double x) { return value + x; }
double operator-(double x) { return value - x; }
double operator*(double x) { return value * x; }
double operator/(double x) { return value / x; }
double operator++() { value++; return value; }
double operator+(user_parameter up) { return value + up.value; }
double operator-(user_parameter up) { return value - up.value; }
double operator*(user_parameter up) { return value * up.value; }
double operator/(user_parameter up) { return value / up.value; }
int operator<(user_parameter up) { return value < up.value; }
int operator>(user_parameter up) { return value > up.value; }
int operator==(user_parameter up) { return value == up.value; }
int operator!=(user_parameter up) { return value != up.value; }
int operator==(double x) { return value == x; }
int operator!=(double x) { return value != x; }
friend double operator+(double a, user_parameter up);
friend double operator-(double a, user_parameter up);
friend double operator*(double a, user_parameter up);
friend double operator/(double a, user_parameter up);
};
static inline double
operator+(double a, user_parameter up) { return a + up.value; }
static inline double
operator-(double a, user_parameter up) { return a - up.value; }
static inline double
operator*(double a, user_parameter up) { return a * up.value; }
static inline double
operator/(double a, user_parameter up) { return a / up.value; }
/*#include "vect.h"*/
#ifndef IS_GNANS_SYSTEM
/* Data structure for user switches */
class gnans_switch {
public:
Widget widget; /* Scratch pointer */
boolean *ptr; /* Pointer to its value */
char *name; /* Name */
/*
* Function to be called whenever the switch is ``changed''
* (also true -> true, etc)
*/
void (*fcn)(void);
char *documentation; /* Documentation string (presently not used) */
};
/* Data structure for integration error messages */
class integration_error_message {
public:
/* integer, as returned from an integration algorithm */
signed int errorno;
/* Human understandable (hopefully!) error message */
char *error_message;
};
/* Data structure for integration algorithms */
class user_algorithm {
public:
/* Scratch, for Widget pointer */
Widget widget;
/* Function carrying out the integration */
boolean (*loop)(boolean virgin);
char *name; /* My name */
boolean stochastic; /* Am I doing Wiener processes? */
boolean reserved_for_future;
char *documentation;
/* An array of integration_error_messages */
integration_error_message error_descriptions[MAX_ERRORMESSAGES];
};
/* Data structure for user variable to be stored */
class store_guy {
public:
/* FILE variable for this variable (should possibly go away?) */
FILE *file;
/* File name for this variable (go away?) */
char *filename;
/* The Gnans name of the varible */
char *name;
/* Pointer to the value */
double *ptr;
/* Pointer to its trajectory (= large array) */
double *trajectory;
};
class child_process;
/* Data structure for command to child processes */
class slave_command {
public:
child_process *slave; /* Pointer to slave */
char command[MAXSTRINGSIZE]; /* Command to send */
Widget widget; /* Scratch */
};
/* Data structure for child processes */
class child_process {
public:
/* File descriptors, to and from slave */
int to_slave_fd, from_slave_fd;
/* Process id of slave */
int pid;
/* Pointer to following slave */
child_process *next;
/* Current array of commands */
slave_command *commands[CHILDCOMMANDS];
};
#endif /* ! IS_GNANS_SYSTEM */
class gnans_system
{
public:
/*
* The following guys contain the number of states (etc) in the currently
* active system
*/
unsigned int number_of_states;
unsigned int number_of_parameters;
unsigned int number_of_functions;
unsigned int number_of_randoms;
unsigned int number_of_uniforms;
unsigned int number_of_normals;
unsigned int number_of_wieners;
/* The type of the currently active system */
system_types system_type;
boolean commutativity_condition;
/* The name of the currently active system */
char *system_name;
/* State vector for the integration */
// vect state_vector;
// vect wiener_coeffs[MAXSTATES];
/*
* Pointers to functions declared in the system
* gnans_init_ptr is a pointer to gnans_init etc.
*/
boolean (*init_ptr)(double y[], continuation_t continuation,
boolean stochastic);
void (*finish_ptr)(void);
boolean (*setup_ptr)(double **x, double *t);
void (*f_ptr)(double *t, double *x, double *dx);
void (*discrete_f_ptr)(void);
//void (*jacobian_ptr)(double *t, double *x, double *Jx);
//void (*g_jacobian_ptr)(double *t, double *x, double *g_jac);
//void (*hairy_f_ptr)(int *n, double *t, double *x, double *dx);
//void (*riccati_f_ptr)(???);
void (*f_accepted_ptr)(void);
void (*f_store_ptr)(void);
void (*destroy_ptr)(void);
/* Arrays of states etc. */
user_parameter *gnans_states[MAXSTATES];
user_parameter *gnans_parameters[MAXSTATES];
user_parameter *gnans_functions[MAXSTATES];
user_parameter *gnans_randoms[MAXSTATES];
user_parameter *gnans_wieners[MAXSTATES];
};
/***************** globals.cc *****************/
#ifndef IS_GNANS_SYSTEM
extern Widget toplevel;
extern int gnansdebug;
extern int store_format;
extern boolean X;
extern boolean ram_store;
extern boolean free_trajectories;
extern boolean append_trajectories;
extern boolean store_first_value;
extern boolean expert_mode;
extern boolean do_logging;
extern boolean log_script_commands;
extern gnans_switch *switches_table;
extern gnans_switch switches_table_standard[];
extern gnans_switch switches_table_development[];
extern store_guy store_us[MAXSTORES];
extern int yydebug;
extern int yy_flex_debug;
extern boolean malloc_debug;
extern boolean trace_workproc;
extern boolean trace_calls;
extern boolean trace_widgets;
extern boolean workprocs;
extern boolean debug_1;
extern boolean debug_2;
extern boolean debug_3;
extern boolean running_integration;
extern boolean running_script;
extern boolean abort_script;
extern boolean development;
extern boolean has_been_alarmed;
extern user_algorithm *current_algorithm;
extern user_algorithm algorithms[];
extern user_algorithm discrete_time_integrate;
extern store_format_type store_format_table[];
extern char default_childcommand[MAXSTRINGSIZE];
extern char scriptfilename[MAXSTRINGSIZE];
extern char system_filename[MAXSTRINGSIZE];
extern char floating_point_format[MAXSTRINGSIZE];
extern char default_algorithm[MAXSTRINGSIZE];
extern char default_stochastic_algorithm[MAXSTRINGSIZE];
extern double default_stochastic_timestep;
extern char cmd_prompt[MAXSTRINGSIZE];
extern child_process *first_child;
extern FILE *yyin;
extern boolean lex_virgin;
#endif /* ! IS_GNANS_SYSTEM */
/* The number of these is number_of_internals (= 8) */
extern user_parameter systemtime;
extern user_parameter starttime;
extern user_parameter stoptime;
extern user_parameter timestep;
extern user_parameter storeincrement;
extern user_parameter relerror;
extern user_parameter abserror;
extern user_parameter wienertick;
extern gnans_system current_system;
extern unsigned int number_of_stores;
extern user_parameter *gnans_internals[number_of_internals];
extern unsigned sample_no;
extern unsigned trajectories_current_size;
extern char progname[MAXSTRINGSIZE];
extern char gnans_lib_name[MAXSTRINGSIZE];
/**************** version.cc ****************/
extern char version_string[];
extern char compiled_string[];
extern char compilation_characteristics[];
/**************** misc.cc ****************/
extern void select_algorithm(char *name);
extern void select_format(char *name);
extern void set_default_algorithm(void);
extern void set_default_stochastic_algorithm(void);
extern char *getdate(void);
extern void die(char *message, int errorcode);
extern char *basename(char *fullname);
extern char *dirname(char *dir, char *fullname);
extern double gnans_NaN(void);
extern "C" void MAIN_(void);
/**************** error.cc ****************/
extern void gnans_error(severity s, char *fmt,...);
/**************** help.cc ****************/
extern void gnans_help(void);
/**************** log.cc ****************/
extern void open_log(void);
extern void close_log(void);
extern void update_log_status(void);
extern void gnans_log_event(char *str);
extern void display_in_logfile(void);
extern void gnans_va_log_event(char *fmt,...);
#ifndef IS_GNANS_SYSTEM
/**************** callbacks.cc ****************/
extern void Quit(Widget widget, XtPointer client_data, XtPointer call_data);
extern void Start(Widget widget, XtPointer client_data, XtPointer call_data);
extern void Continue(Widget widget, XtPointer client_data,
XtPointer call_data);
extern void Stop(Widget widget, XtPointer client_data, XtPointer call_data);
extern void System(Widget widget, XtPointer client_data, XtPointer call_data);
extern void Display_vars_callback(Widget widget, XtPointer client_data,
XtPointer call_data);
extern void States(Widget mother_widget, XtPointer client_data,
XtPointer call_data);
extern void Parameters(Widget mother_widget, XtPointer client_data,
XtPointer call_data);
extern void Times(Widget mother_widget, XtPointer client_data,
XtPointer call_data);
extern void Functions(Widget mother_widget, XtPointer client_data,
XtPointer call_data);
extern void Seeds(Widget mother_widget, XtPointer client_data,
XtPointer call_data);
extern void Settings(Widget mother_widget, XtPointer client_data,
XtPointer call_data);
extern void More(Widget mother_widget, XtPointer client_data,
XtPointer call_data);
extern void Script(Widget mother_widget, XtPointer client_data,
XtPointer call_data);
extern void About(Widget mother_widget, XtPointer client_data,
XtPointer call_data);
extern void popup_error_message(Widget mother_widget, XtPointer client_data,
XtPointer the_error_message,
XtPointer the_title, XtGrabKind grab_type);
extern void destroy_toplevel(void);
extern void destroy_inquiry_popup(Widget mother_widget, XtPointer client_data,
XtPointer call_data);
extern void popup_position(Widget popup, Widget parent,
XtGrabKind grab_type, boolean disable_parent);
extern void change_value_action(Widget widget, XEvent *event, String *params,
Cardinal *num_params);
extern void destroy_popup_action(Widget widget, XEvent *event, String *params,
Cardinal *num_params);
extern void change_childcommand_action(Widget widget, XEvent *event,
String *params, Cardinal *num_params);
extern char *make_popup_title(char *title, char *name);
extern void zap_popups(void);
extern void make_equal_width(Widget w1, Widget w2);
/**************** child.cc ****************/
extern void Children(Widget mother_widget, XtPointer client_data,
XtPointer call_data);
extern void kill_children(child_process *p);
/**************** fileselector.cc ****************/
extern void fileselector(char *title, char *name_of_label_widget, char *ending,
char *filename_ptr, void (*run_fcn)(char *str),
void (*message_fcn)(char *str),
boolean must_exist, boolean empty_ok);
extern void fileselector_open_action(Widget widget, XEvent *event,
String *params, Cardinal *num_params);
extern void fire_up_child_action(Widget widget, XEvent *event, String *params,
Cardinal *num_params);
/**************** debug.cc ****************/
extern void debug_setup(void);
extern void update_development_status(void);
/**************** main.cc ****************/
extern int main(int argc, char *argv[]);
extern void destroy_toplevel(void);
extern void register_work_proc(boolean (*proc)(boolean initialize),
boolean continuation);
extern void disable_some_buttons(void);
extern void enable_buttons_idle(void);
extern void enable_buttons_busy(void);
extern void set_toplevel_title(void);
extern void reset_cpu(void);
extern void indicate_progress(void);
/**************** integrate.cc ****************/
extern boolean integrate(continuation_t continuation);
extern boolean continue_integration(boolean continuation);
extern void integrate_finish(void);
extern void setup_system_static(void);
extern void write_trajectories(void);
extern void resize_trajectories(void);
#ifdef DYNAMIC_LOADING
extern void setup_system_dynamic(char *so_filename);
#endif
/**************** signals.cc ****************/
extern void signal_setup(void);
extern void set_alarm(void);
extern void cancel_alarm(void);
extern void update_workproc_status(void);
/**************** commands.cc ****************/
extern void do_prompt(void);
extern void decode_commands(char *scriptfilename);
extern void store(char *name, boolean stored);
extern void toggle_switch(char *name, boolean value);
extern void yyerror(char *s);
extern void update_symbol_table(void);
/**************** save_state.cc ****************/
extern int save_state(char *name);
extern int save_state_numbered(char *name, int index);
extern void restore_state(char *name, int index);
/**************** display.cc ****************/
extern void Display_vars(int code);
extern char *create_display_string(int code);
extern void emergency_dump(void);
/**************** yacc/lex stuff ****************/
extern int yyparse(void);
extern int yylex(void);
extern void yyrestart(FILE *yyin);
#endif /* ! IS_GNANS_SYSTEM */
/**************** f.cc ****************/
extern "C" boolean gnans_init(double y[], continuation_t continuation,
boolean stochastic);
extern "C" void gnans_finish(void);
extern "C" boolean gnans_setup(double **x, double *t);
extern "C" void gnans_f(double *t, double *x, double *dx);
extern "C" void gnans_discrete_f(void);
//extern "C" void gnans_hairy_f(long int *n, double *t, double *x, double *dx);
extern "C" void gnans_f_accepted(void);
extern "C" void gnans_f_store(void);
/**************** supportlib ****************/
#if 0
extern void savemat(FILE *fp,
int type,
char *pname,
int mrows,
int ncols,
int imagf,
double *preal,
double *pimag);
#endif
extern double
terminate(int term)
{
#if 0
if (term)
running_integration = false;
#endif
return (double) term;
}
Technical Details
Message-ID:
<9211121523.AA11547@zeus.mathematik.uni-Bremen.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!know!cass.ma02.bull.com!mips2!news.bbn.com!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!mathematik.uni-bremen.de!bengtShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!know!cass.ma02.bull.com!mips2!news.bbn.com!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!mathematik.uni-bremen.de!bengt From: bengt@mathematik.uni-bremen.de (Bengt Martensson) Newsgroups: gnu.g++.bug Subject: Bug report, fatal signal Message-ID: <9211121523.AA11547@zeus.mathematik.uni-Bremen.de> Date: 12 Nov 92 17:23:19 GMT Sender: gnulists@ai.mit.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 724 Approved: bug-g++@prep.ai.mit.edu