On Sun, Dec 30, 2018 at 12:51 PM Jozef Lawrynowicz <joze...@mittosystems.com> wrote: > > 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?
I think the use of ffs_hwi suggests that the current behavior was intended (or kept exactly because of calls with bougs values). If that's not wanted why not simply use exact_log2 instead of ffs_hwi in the SET_ macros? Btw, I'd simply make SET_{TYPE,DECL}_ALIGN inline functions and then gcc_checking_assert that exact_log2 didn't return -1. Richard.