This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: document inconsistant?
- To: Joe Buck <jbuck at possibly dot synopsys dot com>
- Subject: Re: document inconsistant?
- From: Min Xu <mxu at cae dot wisc dot edu>
- Date: Thu, 30 Mar 2000 20:51:28 -0600
- CC: gcc at gcc dot gnu dot org
- References: <200003302342.PAA26902@possibly.synopsys.com>
- Reply-To: mxu at cae dot wisc dot edu
Joe Buck wrote:
> Perhaps my use of the word "random" confused you: the behavior will be
> fixed for any given compiler setting.
>
> You need to debug your program. If you're stuck, you'll need to send in
> the exact source so others can debug it.
After I remove all those code not related to the problem, I come up with
the following piece of code that cause problem on my system. Seems that
comparison of double in ind_table_parser::findLm is the source of the bus
error. if I remove it, the program works fine. (makefile , .h, .cc is attached.)
sys info:
sun-90% uname -a
SunOS sun-90 5.7 Generic_106541-08 sun4u sparc SUNW,Ultra-5_10
sun-90% gcc -v
Reading specs from
/afs/engr.wisc.edu/oss/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/specs
gcc version 2.95.2 19991024 (release)
sun-90% make
gcc -O2 -g -Wall -c -o ind_table_parser.o ind_table_parser.cc
gcc -O2 -g -Wall -lm -lstdc++ -o cpp_test cpp_test.cc ind_table_parser.o
sun-90% ./cpp_test
Begin the test program...
Bus error (core dumped)
Somebody can kindly have a look? Thanks!
-Owen
cpp_test
#include <iostream>
#include "ind_table_parser.h"
int main()
{
double Lm;
ind_table_parser ind_t;
cout << "Begin the test program...\n";
Lm = ind_t.findLm(200000, 200000, 800, 800, 1000, 1000, 3000, 0, 0, 1e10);
cout << "Lm: " << Lm << "\n";
return (0);
}
#include "ind_table_parser.h"
/*****************************************
* Implementation of the table calss *
*****************************************/
double ind_table_parser::findLm(int length1, int length2, int width1,
int width2, int thick1, int thick2,
int space, int v_distance,
int displace, double freq)
{
// if((freq > (1e11*10.0)) || (freq < (1e9/10.0))) {
if(freq > 1e10) {
return (1.0);
}
return (0.0);
}
#ifndef __ind_table_parser_h
#define __ind_table_parser_h
/******************************
* Define the table calss *
******************************/
class ind_table_parser {
public:
double findLm(int l1, int l2, int w1, int w2, int t1,
int t2, int s , int v , int d, double freq);
};
#endif
# Makefile for inductance calculation library
# author: Min Xu
# date: 2000-01-25
#
# build both the test program and the library
##
# for solaris
##
CC = gcc
CFLAGS = -O2 -g -Wall
#CFLAGS = -msupersparc -O2 -Wall
#.SUFFIXES:
all: cpp_test
ind_table_parser.o: ind_table_parser.cc ind_table_parser.h
$(CC) $(CFLAGS) -c -o ind_table_parser.o ind_table_parser.cc
cpp_test: cpp_test.cc ind_table_parser.o
$(CC) $(CFLAGS) -lm -lstdc++ -o cpp_test cpp_test.cc ind_table_parser.o
clean:
rm -f libRLC_calc.so c_test cpp_test matrix_test demo_test full_model *.class *.o out *.lib core