This is the mail archive of the 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: [RFA] Fix bit/byte unit thinko in is_aliasing_offset

Geoff Keating wrote:
> > The patch included here fixes a simple bit/byte unit thinko in
> > is_aligning_offset, which is part of what's necessary to fix the general
> > issue.

> This is OK, assuming you can add the Ada testcase into the FSF GCC
> testsuite; otherwise, please try to find a C testcase.

 Thanks for the review. I don't think we expect this kind of things to be
 working in C.

 The C version of the submitted testcase would be easy to write and would
 probably appear to work, although it would not test quite the same thing.

 What we are actually aiming at is something like:

     #include <stdio.h>

     #define ALIGNMENT 32

     typedef int aligned_int __attribute__ ((aligned (ALIGNMENT)));

     main (void)
       aligned_int x;

       if (((long) &x % ALIGNMENT) == 0)
	 printf ("PASS\n");
	 printf ("FAIL\n");

       return 0;

 In Ada/GNAT, this kind of constructs either emits an error message saying
 the requested alignment is too large, or issues some dynamic address
 computation to have it right. The admitted upper bound depends on the target.


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