This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFC handle crashes during output of user 'asm' more gracefully
- From: Richard Earnshaw <rearnsha at gcc dot gnu dot org>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 25 Aug 2004 19:01:45 +0100
- Subject: RFC handle crashes during output of user 'asm' more gracefully
- Organization: GNU
This idea came to me after I'd closed PR 13506 as a WONTFIX. Currently,
if the user writes a completely bogus output pattern in an ASM statement
the compiler can get confused in a whole host of places and may end up
segfaulting or otherwise.
It occurs to me that we don't really have to report this as an internal
error, instead we can at least give the poor user some idea that it's
most likely their fault.
Does anybody think the following is wrong approach?
R.
2004-08-25 Richard Earnshaw <rearnsha@arm.com>
* toplev.c (crash_signal): If we crashed while emitting
a user asm, then die more gracefully.
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.912
diff -p -r1.912 toplev.c
*** toplev.c 18 Aug 2004 16:21:57 -0000 1.912
--- toplev.c 25 Aug 2004 17:58:53 -0000
*************** static void
*** 598,603 ****
--- 598,612 ----
crash_signal (int signo)
{
signal (signo, SIG_DFL);
+
+ /* If we crashed while processing an ASM statement, then be a little more
+ graceful. It's most likely the user's fault. */
+ if (this_is_asm_operands)
+ {
+ output_operand_lossage ("unrecoverable error");
+ exit (FATAL_EXIT_CODE);
+ }
+
internal_error ("%s", strsignal (signo));
}