PATCH: Prevent crashes with bad -g options
Geoffrey Keating
geoffk@geoffk.org
Wed Sep 1 00:34:00 GMT 2004
Stan Shebs <shebs@apple.com> writes:
> If one passes an inappropriate debugging option, such as -gvms to
> darwin, the compiler will dutifully produce an error message, but
> then go on to dereference an uninitialized debug_hooks and crash.
> This patch just ensures that it's initialized no matter what the
> tangle of conditionals; almost obvious, but perhaps there's a
> better way to solve.
>
> OK for mainline?
>
> Stan
>
> * toplev.c (process_options): Ensure debug_hooks is initialized.
>
> Index: toplev.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
> retrieving revision 1.913
> diff -p -r1.913 toplev.c
> *** toplev.c 26 Aug 2004 16:42:39 -0000 1.913
> --- toplev.c 31 Aug 2004 23:06:08 -0000
> *************** process_options (void)
> *** 1806,1813 ****
> default_debug_hooks = &vmsdbg_debug_hooks;
> #endif
> if (write_symbols == NO_DEBUG)
> ! debug_hooks = &do_nothing_debug_hooks;
> #if defined(DBX_DEBUGGING_INFO)
> else if (write_symbols == DBX_DEBUG)
> debug_hooks = &dbx_debug_hooks;
> --- 1806,1814 ----
> default_debug_hooks = &vmsdbg_debug_hooks;
> #endif
> + debug_hooks = &do_nothing_debug_hooks;
> if (write_symbols == NO_DEBUG)
> ! ;
> #if defined(DBX_DEBUGGING_INFO)
> else if (write_symbols == DBX_DEBUG)
> debug_hooks = &dbx_debug_hooks;
This is OK.
More information about the Gcc-patches
mailing list