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: [PATCH] Support for known unknown alignment


On Fri, Apr 20, 2012 at 8:41 PM, Jay Foad <jay.foad@gmail.com> wrote:
> On 20 April 2012 16:54, Martin Jambor <mjambor@suse.cz> wrote:
>> two days ago I talked to Richi on IRC about the functions to determine
>> the expected alignment of objects and pointers we have and he
>> suggested that get_object_alignment_1 and get_pointer_alignment_1
>> should return whether the alignment is actually known
>
> Can you explain how returning "unknown" is different from returning
> some minimal known alignment? Comments like:
>
>> ! /* Compute values M and N such that M divides (address of EXP - N) and
>> ! ? ?such that N < M. ?Store N in *BITPOSP and return M.
>
> suggest that M=1, N=0 is always a valid conservative thing to return.
>
> If there is a difference, the comment should explain what it means.

Well.  The difference is for 2nd level code such as get_object_or_type_alignment
which should not override explicitely known misalginment (the user typed
*(int *)( (char *)&intvar + 1)) with alignment derived from types (the
C standard
says that code invokes undefined behavior, but doing what the user means
is certainly what we can do and what people expect from a QOI point of view).

Richard.

> Thanks,
> Jay.


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