swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Potential bug swarm v-1.2/gcc-2.8.1 (was Negative double wierdness)


From: Steve Emsley
Subject: Potential bug swarm v-1.2/gcc-2.8.1 (was Negative double wierdness)
Date: Sat, 4 Jul 1998 05:03:22 +0100

Just to close my account on this one ... I've isolated a code fragment
that reproduces the error. If anyone tries it and can confirm that
it's not isolated to my machine I'd be grateful for an email.

Anyhow, my funding has run out and my thesis is still way off so I
have to leave this to those more qualified, or with more time!

Cheers.
8< --- Makefile --- >8

SWARMHOME=/usr/local/share/swarm-bug
APPLICATION=bug
OBJECTS= Bug.o 

include ${SWARMHOME}/Makefile.appl

Bug.o: Bug.m

8< --- Bug.m --- >8

// Bug.m  Steve Emsley
// Time-stamp: <04-07-1998 04:31:13 BST address@hidden>

// This tests for a possible bug arising from Swarm v1.2 using
// -O2 optimization with gcc 2.8.0 and 2.8.1
// Note that the loop and the method call are both required.

// With gcc-2.8.1 and swarm v1.2 build with -O2 the output is:

//        This calculates 1.0*pow(4,0.5)*1.0
//        Test 1: 1.000000e+00

//        This should produce the same result
//        Test 2: 2.000000e+00

// With gcc-2.8.1 and swarm v-1.2 built WITHOUT -O2 or swarm v-1.1
// binary install.

//        This calculates 1.0*pow(4,0.5)*1.0
//        Test 1: 2.000000e+00

//        This should produce the same result
//        Test 2: 2.000000e+00

//#import "Bug.h"

#import <simtools.h>
#import <objectbase/SwarmObject.h>
#import <math.h>

@interface Bug : SwarmObject {}

-test1;
-test2;
-(double)method;

@end

@implementation Bug

-(double)method { return 1.0; }

-test1
{
  double a,b,c;
  int i;

  printf("\nThis calculates 1.0*pow(4,0.5)*1.0\n");
  a = 0.5;
  b = 4.0;
  for (i=0;i<=0;i++) {
    c = 1.0;
    c *= pow(b,a);
    c *= [self method];
    printf("Test 1: %e\n",c);
  }
  return self;
}

-test2
{
  double a,b,c;
  int i;

  printf("\nThis should produce the same result\n");
  a = 0.5;
  b = 4.0;
  for (i=0;i<=0;i++) {
    c = 1.0;
    c *= pow(b,a);
    c *= [self method];
    printf("Test 2: %e\n",c);
    if (c) printf("\n");
  }
  return self;
}

@end

int
main (int argc, const char **argv)
{
  id bug;

  initSwarm (argc, argv);

  bug = [Bug create: globalZone];
  [bug test1];
  [bug test2];

  return 0;
}
 
//---------------------------------------------------------------------
// Steve Emsley                 Ecosystems Analysis & Management Group
// address@hidden              University of Warwick, England
// http://www.oikos.warwick.ac.uk/~sme/           (+44) (0)1598 753648
//---------------------------------------------------------------------

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

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