This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

More real.c fall out - XFmode real_format_for_mode[] entry not initialisedbefore use.


Richard,

More real.c change fall out.

Attempting to build x86-x-m68k-elf cross compiler fails due to a SIGSEG
in builtin_define_float_constants compiling any code. For example building
toolchain fails building crtstuff.c.

The problem is the entry for XFmode in real_format_for_mode[] is NULL.

The backtrace is

#0  0x0808642f in builtin_define_float_constants (name_prefix=0x84b1840 "R_BIT__", fp_suffix=0x84bc0c3 " 199901L", type=0x40024a80)
    at /usr/local/src/uberbaum/gcc/c-common.c:4744
#1  0x08086aee in cb_register_builtins (pfile=0x85539d8) at /usr/local/src/uberbaum/gcc/c-common.c:4932
#2  0x080a12ae in init_builtins (pfile=0x85539d8) at /usr/local/src/uberbaum/gcc/cppinit.c:739
#3  0x080a1a48 in cpp_finish_options (pfile=0x84bbb60) at /usr/local/src/uberbaum/gcc/cppinit.c:1055
#4  0x08055664 in c_common_parse_file (set_yydebug=17) at /usr/local/src/uberbaum/gcc/c-lex.c:157
#5  0x0838a21d in compile_file () at /usr/local/src/uberbaum/gcc/toplev.c:2122
#6  0x0838f6a5 in do_compile () at /usr/local/src/uberbaum/gcc/toplev.c:5337
#7  0x0838f74d in toplev_main (argc=17, argv=0xbfffc600) at /usr/local/src/uberbaum/gcc/toplev.c:5367

The problem is OVERRIDE_OPTIONS has not yet been called so the entry XFmode entry contains NULL
resulting in SIGSEG in builtin_define_float_constants. The SIGSEG happens in m68k but not on other
ports because on m68k long_double_type_node has XFmode so builtin_define_float_constants uses the
XFmode entry in real_format_for_mode[] when setting LDBL define.

This means that OVERRIDE_OPTIONS gets invoked too late for the backends to correctly setup the
real_format_for_mode[] array because the array gets used during the (*lang_hooks.post_options) ();
call in do_compile and occurs before the process_options is called which invokes OVERRIDE_OPTIONS.

It looks like we need to provide yet another backend hook for use by the backends so they can
setup the real_format_for_mode[] array early enough so it's correctly setup before (*lang_hooks.post_options)()
gets called.

So it looks like any backend which overrides any of the real_format_for_mode entries is doing
so too late, because the default values have already been used to setup the FLT, DBL and LDBL
preprocessor defines.

The correct initialisation order for the various bits of the compiler are a twisty maze   :-)

Cheers
Graham



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]