This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: add an assert to gas/dw2gencfi.c
- From: "Jan Beulich" <jbeulich at novell dot com>
- To: "Ben Elliston" <bje at au1 dot ibm dot com>
- Cc: <binutils at sourceware dot org>
- Date: Tue, 24 Oct 2006 09:07:46 +0200
- Subject: Re: PATCH: add an assert to gas/dw2gencfi.c
- References: <20061024045411.GA14953@ozlabs.au.ibm.com>
>--- 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);
> }
I have to admit that I'd find it more obvious to put the assert before
the assignment, and have DWARF2_CIE_DATA_ALIGNMENT be its
subject; if there is no potential for this not being a compile-time
constant, then this could even become a build-time assertion rather
than a run-time one.
Jan