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: [RFA] Fix bit/byte unit thinko in is_aliasing_offset


> Date: Thu, 9 Oct 2003 09:07:10 +0200
> From: Olivier Hainque <hainque@ACT-Europe.FR>

> 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)));
> 
>      int
>      main (void)
>      {
>        aligned_int x;
> 
>        if (((long) &x % ALIGNMENT) == 0)
> 	 printf ("PASS\n");
>        else
> 	 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.

This is supposed to behave the same way in GNU C; so you should make
the testcase into a proper dejagnu testcase (by using abort() or
exit(0))...

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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