Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2002:
[Freeciv-Dev] Re: CMA attributes - gcc optimization problem with Tru64 U
Home

[Freeciv-Dev] Re: CMA attributes - gcc optimization problem with Tru64 U

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Davide Pagnin <nightmare@xxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: CMA attributes - gcc optimization problem with Tru64 Unix
From: Raimar Falke <rf13@xxxxxxxxxxxxxxxxx>
Date: Fri, 7 Jun 2002 23:12:55 +0200

On Fri, Jun 07, 2002 at 10:05:00PM +0200, Davide Pagnin wrote:
> > > > Can you please send me the good and the bad attribute.s (build from a
> > > > clean attribute.c). You can do this using:
> > > > $ cd client
> > > > $ gcc -DHAVE_CONFIG_H -I. -I.. -I./include -I../common -I../intl 
> > > > -I./agents -S -c attribute.c
> > > 
> > > Done
> > > > 
> > > > and the same with -O2.
> > > Done 
> > > > Can you also please apply the attached patch and send me the bad output?
> > > > 
> > > Done.
> > 
> > And another one. Just send me the two output files.
> > 
> >         Raimar
> 
> The outputs are here. They look interesting...

Got it. Now who hands me the brown paper bag?

Problem:

size_t attribute_get(int key, int id, int x, int y, size_t max_data_length,
                  void *data)
{

  struct attr_key pkey;

  ...

  pkey.key = key;
  pkey.id = id;
  pkey.x = x;
  pkey.y = y;

  pvalue = hash_lookup_data(attribute_hash, &key);

In the last line the "&key" should really be a "&pkey". So you may ask
why had this worked till now? It has worked since the memory layout
and the values of the struct attr_key and the 4 parameters are the
same. At least for i386 and 64 bit systems without optimization.

Nevertheless this was a nice bug ;)

Davide: please confirm that it works now.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "#!/usr/bin/perl -w
  if ( `date +%w` != 1 ) {
    die "This script only works on Mondays." ;
  }"
    -- from chkars.pl by Cornelius Krasel in de.comp.os.linux.misc

Attachment: attr_fix1.diff
Description: Text document


[Prev in Thread] Current Thread [Next in Thread]