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]

Re: libio bugs


Mark Mitchell <mmitchell@usa.net> writes:

|>>>>>> "Jeffrey" == Jeffrey A Law <law@cygnus.com> writes:

|>     Jeffrey> (ostream::operator<<(double)) [_G_HAVE_PRINTF_FP]: Fix
|>     Jeffrey> order of initializers of struct printf_info to match
|>     Jeffrey> declaration order, to work around g++ bug.
|>     Jeffrey> (ostream::operator<<(long double)) [_G_HAVE_PRINTF_FP]:
|>     Jeffrey> Likewise.

|> Since the order of initializers isn't supposed to matter, there is 
|> definitely a bug here if this fix makes a difference.  Does anyone
|> have a simple test-case for this bug?

G++ simply ignores all initializer labels.  I have already send a bug
report, here it is again:

$ cat init.cc
struct X { int a, b; };

struct X f (int a, int b)
{
  struct X y = { b: b, a: a }; // labels ignored by g++
  return y;
}

int main ()
{
  struct X x = f (42, 0);
  if (x.a != 42 || x.b != 0)
    abort ();
  exit (0);
}
$ gcc init.cc
$ ./a.out
Aborted (core dumped)

-- 
Andreas Schwab                                      "And now for something
schwab@issan.informatik.uni-dortmund.de              completely different"
schwab@gnu.org


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