This is the mail archive of the gcc@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: Type based aliasing


Nathan Sidwell wrote:

Do C's type based aliasing rules mean the following?
    void foo (int *ip, float *fp)
    {
        if (ip == fp)
            this_is_unreachable ()
    }

I vaguely remember some discussion about this, but can't remember the
conclusion. Presumably IP & FP could point to members of the same union.

(f77 has code like the above, where the condition may or may not be false.)
Fortran rules don't allow arguments (which are references in g77) to overlap at all, so in this case, g77 would just assume (without checking) that *ip and *fp wouldn't overlap.

--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)


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