This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: __intN patch 2/5: Fix assumptions about mode precisions


> On 08/13/14 16:10, DJ Delorie wrote:
> > The purpose of this set of changes is to remove assumptions in GCC
> > about type sizes.  Previous to this patch, GCC assumed that all types
> > were powers-of-two in size, and used naive math accordingly.
> >
> > Old:
> > 	POINTER_SIZE / BITS_PER_UNIT
> > 	TYPE_SIZE
> > 	GET_MODE_BITSIZE
> >
> > New:
> > 	POINTER_SIZE_UNITS  (ceil, not floor)
> > 	TYPE_PRECISION
> > 	GET_MODE_PRECISION
> >
> > gcc/
> > 	* cppbuiltin.c (define_builtin_macros_for_type_sizes): Round
> > 	pointer size up to a power of two.
> > 	* defaults.h (DWARF2_ADDR_SIZE): Round up.
> > 	(POINTER_SIZE_UNITS): New, rounded up value.
> > 	* dwarf2asm.c (size_of_encoded_value): Use it.
> > 	(dw2_output_indirect_constant_1): Likewise.
> > 	* expmed.c (init_expmed_one_conv): We now know the sizes of
> > 	partial int modes.
> > 	* loop-iv.c (iv_number_of_iterations): Use precision, not size.
> > 	* optabs.c (expand_float): Use precision, not size.
> > 	(expand_fix): Likewise.
> > 	* simplify-rtx (simplify_unary_operation_1): Likewise.
> > 	* tree-dfa.c (get_ref_base_and_extent): Likewise.
> > 	* varasm.c (assemble_addr_to_section): Round up pointer sizes.
> > 	(default_assemble_integer) Likewise.
> > 	(dump_tm_clone_pairs): Likewise.
> > 	* dwarf2out.c (mem_loc_descriptor): Allow partial-int modes also.
> > 	* var-tracking.c (adjust_mems): Allow partial-int modes also.
> > 	(prepare_call_arguments): Likewise.
> > 	* stor-layout.c (finalize_type_size): Preserve precision.
> > 	(layout_type): Use precision, not size.

> Didn't see a note if this had been boostrapped/regression tested 
> independently or not, but it's still good to go in my mind.

I didn't test this one independently because it doesn't really *do*
anything if you don't have a non-power-of-two type.  I did test the
whole set of patches with full bootstrap-regression though, both on
x86_64 and msp430.

> I strongly suspect we'll find other places which need conversion
> and we can fault in those fixes if/when we find them.

I suspect that also, despite grepping and reviewing the whole source
tree.

> I wonder if this will fix a long standing h8 dwarf2out bug...  I guess 
> I'll have the chance to check relatively soon.

:-)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]