[PATCH] Check requested alignment in SET_{DECL,TYPE}_ALIGN is pow2_or_zerop before aligning on targets with partial int modes

Jozef Lawrynowicz jozef.l@mittosystems.com
Sun Dec 30 16:41:00 GMT 2018


There have been some ICEs in the past for msp430-elf with the large
memory model (20-bit pointers), caused by SET_{DECL,TYPE}_ALIGN being called
with an argument which resolves to 20 i.e. POINTER_SIZE,
or the default value of TARGET_VTABLE_ENTRY_ALIGN (which is POINTER_SIZE).

The attached patch adds an assertion that SET_{DECL,TYPE}_ALIGN is called with
a value which is a power of 2, or 0, for targets which support a partial int
mode. This should catch issues in the future with non-power of 2
alignments being set, which could propagate into serious problems later in the
compilation process.

If the filtering to only perform this check for targets supporting a partial
int mode is unnecessary, I can remove that so CHECK_POW2_OR_ZEROP always
expands to check_pow2_or_zerop.

Successfully bootstrapped and regtested on x86_64-pc-linux-gnu and
msp430-elf/-mlarge.

Ok for trunk, or does this have to wait for GCC10 Stage 1?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Check-requested-alignment-in-SET_-DECL-TYPE-_ALIGN-i.patch
Type: text/x-patch
Size: 2690 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20181230/e292d04e/attachment.bin>


More information about the Gcc-patches mailing list