This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: add an assert to gas/dw2gencfi.c
- From: Ben Elliston <bje at au1 dot ibm dot com>
- To: binutils at sourceware dot org
- Date: Tue, 24 Oct 2006 14:54:11 +1000
- Subject: PATCH: add an assert to gas/dw2gencfi.c
Another simple patch. From memory, I discovered a port that defined
DWARF2_CIE_DATA_ALIGNMENT to 0, so the expression selected the : case
and abs_data_align was set to 0. The subsequent modulo operation
aborted due to division by zero.
I think the assertion helps with fault-finding. OK to commit?
2006-10-24 Ben Elliston <bje@au.ibm.com>
* dw2gencfi.c (cfi_add_CFA_offset): Assert that abs_data_align is
greater than zero.
Index: dw2gencfi.c
===================================================================
RCS file: /cvs/src/src/gas/dw2gencfi.c,v
retrieving revision 1.28
diff -u -p -r1.28 dw2gencfi.c
--- dw2gencfi.c 27 Feb 2006 23:07:06 -0000 1.28
+++ dw2gencfi.c 24 Oct 2006 04:53:16 -0000
@@ -256,6 +256,8 @@ cfi_add_CFA_offset (unsigned regno, offs
abs_data_align = (DWARF2_CIE_DATA_ALIGNMENT < 0
? -DWARF2_CIE_DATA_ALIGNMENT : DWARF2_CIE_DATA_ALIGNMENT);
+
+ assert (abs_data_align > 0);
if (offset % abs_data_align)
as_bad (_("register save offset not a multiple of %u"), abs_data_align);
}