This is the mail archive of the gcc-bugs@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]

Re: An alias bug



  In message <m0yv93A-000266C@ocean.lucon.org>you write:

  > Here is a C testcase from Richard. The binary aborts when compiled with
  > -O2. I have another 500 line C++ testcase which results in an infinite
  > loop when compiled with -O2. The problems with loop and alias are
I believe this testcase is bogus.

  > H.J.
  > -- 
  > H.J. Lu (hjl@gnu.org)
  > ----
  > long A [2] = {0};
  > long B [2] = {2, 0};
  > 
  > typedef union
  > {
  >   long long ll;
  >   long l[2];
  > } long_long_type;
  > 
  > main ()
  > {
  >   unsigned int i;
  >   long long u = -1;
  >   for (i = 0; i < 2; i+=2)
  >   {
  >     u = A [i] + B [i];
  >     u = ((long_long_type *) &u)->l [1] + A [i+1] + B [i+1];
"u" is a "long long", I don't think casting it to "long_long_type"
is valid C or C++.

jeff


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