public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Segmentation Fault on 64-bit gcc Compiled Pro*C Program on HPUX 1 1.00
@ 2002-12-17 10:52 Choiniere, Jacques C, PERSCOM
  0 siblings, 0 replies; only message in thread
From: Choiniere, Jacques C, PERSCOM @ 2002-12-17 10:52 UTC (permalink / raw)
  To: 'help-gcc@gnu.org'
  Cc: Choiniere, Jacques C, PERSCOM, Jerman, Richard W, PERSCOM


NOTE:  THIS IS A RETRANSMISSION:
To Whom it may concern,

I am getting the following Segmentation Fault during runtime.  The fault is
occurring in an fgets statement that contains no Pro*C constructs.

MY GENERAL ENVIRONMENT:
"I am in the process of upgrading from an Oracle 7.3.4 environment using
Pro*C and an HP 32-bit C Compiler  (version A.10.32) to an Oracle 8.1.7
64-bit environment using 64-bit Pro*C and a GNU (gcc) 64-bit C Compiler. All
software is on an HP UNIX version 11.00 box.

Specifically, during runtime I am experiencing a SEGMENTATION Fault on the
/usr/lib/libc.2 library when the program executes a fgets() C-statement. " 


MY COMPILE STATEMENTS:

        proc  code=ANSI_C iname=promotion_history_report.pc

        gcc  -c -v -ansi -Wall -ggdb
-I/oracle/app/oracle/product/8.1.7.4/precom
p/public promotion_history_report.c

        proc  code=ANSI_C iname=../../../aee_common/source/update_status.pc

        gcc  -c -v -ansi -Wall -ggdb
-I/oracle/app/oracle/product/8.1.7.4/precom
p/public ../../../aee_common/source/update_status.c

        gcc  -o ../../bin/promotion_history_report
promotion_history_report.o up date_status.o
/oracle/app/oracle/product/8.1.7.4/lib/libclntsh.sl.8.0 -lgcc -L/u sr/lib rm
*.o #rm *.c


MY C FUNCTION WITH THE PROBLEM:

/**********************************************************************

 *          read_MOS_conversions()

 *          Read the MOS conversions for MOS-Grade pairs and

 *          store them for each pair. Input the given array pointer and

 *          use to change the holding arrays.  Uses the dates to exclude

 *          conversions effective outside of the report dates.

 **********************************************************************

*/

 

int  read_MOS_conversions(

                     struct conversion_rec conversion_record[MOS_GRADE_MAX],

                     char *prom_month,

                     char *prom_start)

{

 

   int loop_counter = 0;

   char line[83];

 

   track_me("9E");

 

   fprintf(fp_perhist,

         " Starting read of MOS conversions       - Run Date: %s",

           asctime(date_time_ptr));

   fflush(fp_perhist);

 

   line[82] = '\0';

 

   /*  WHILE LOOP to read MOS conversions file and store the conversions in

       a working area for comparisons.  */

   while (fgets(line, 83, infileptr) != NULL)       /*  ERROR OCCURS HERE
*/                           
   {

      /*  If ensures that the MOS conversion is dated before the current
date   
          and that the new MOS date is effective before or on the conversion

          date.  */

      if((strncmp(line+7, prom_month, 6) <= 0) &&

         (strncmp(line+7, prom_start, 6) >= 0))

      {

         /*  Store critical conversion data.  */

         strncpy(conversion_record[loop_counter].MOS_field, line, 3);

         strncpy(conversion_record[loop_counter].RANK_field, line+4, 2);

         strncpy(conversion_record[loop_counter].NEW_MOS_field, line+14, 3);

         /*  Print the sorted conversion record for the end user to review.
*/ 
         fprintf(fp_err, "%s : %s : %s\n",

                 conversion_record[loop_counter].MOS_field,

                 conversion_record[loop_counter].RANK_field,

                 conversion_record[loop_counter].NEW_MOS_field);

         fflush(fp_err);

         loop_counter++;

      }

   }  /*  end WHILE LOOP */

 

   return(0);

 

}  /* end function read_MOS_conversions  */

/* Added 12 October 2001 JCC to do MOS conversions of historical data. */


MY GCC COMPILIER OUTPUT:

Pro*C/C++: Release 8.1.7.0.0 - Production on Mon Dec 16 17:18:21 2002

 

(c) Copyright 2000 Oracle Corporation.  All rights reserved.

 

System default option values taken from:
/oracle/app/oracle/product/8.1.7.4/prec
omp/admin/pcscfg.cfg

 

Reading specs from /usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.1/specs

Configured with: ./configure  : (reconfigured) ./configure  : (reconfigured)
./c
onfigure

Thread model: posix

gcc version 3.1

 /usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.1/cc1 -lang-c -std=c89 -v
-I/ora cle/app/oracle/product/8.1.7.4/precomp/public -D__GNUC__=3
-D__GNUC_MINOR__=1 -D __GNUC_PATCHLEVEL__=0 -D__hppa__ -D__hp9000s800__
-D__hp9000s800 -D__hp9k8__ -D_ _PWB__ -D__hpux__ -D__unix__ -D__hppa
-D__hp9000s800 -D__hp9k8 -D__PWB -D__hpux 
-D__unix -Asystem=unix -Asystem=hpux -Acpu=hppa -Amachine=hppa
-D__NO_INLINE__ - D__STDC_HOSTED__=1 -D_PA_RISC1_1 -D__hp9000s700
promotion_history_report.c -quie t -dumpbase promotion_history_report.c
-ansi -ggdb -Wall -ansi -version -o /var/
tmp//ccqM2qec.s

GNU CPP version 3.1 (cpplib) (hppa)

GNU C version 3.1 (hppa2.0n-hp-hpux11.00)

        compiled by GNU C version 3.1.

ignoring nonexistent directory "/usr/local/hppa2.0n-hp-hpux11.00/include"

#include "..." search starts here:

#include <...> search starts here:

 /oracle/app/oracle/product/8.1.7.4/precomp/public

 /usr/local/include

 /usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.1/include

 /usr/include

End of search list.

promotion_history_report.c: In function `main':

promotion_history_report.c:676: warning: unused variable `SCCS_ID'

promotion_history_report.c: At top level:

promotion_history_report.c:106: warning: `sqlstm' defined but not used

../../../aee_common/header_files/enlisted_promotion_model.h:31: warning:
`SCCS_I
D_H' defined but not used

 
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.1/../../../../hppa2.0n-hp-hpu
x11
.00/bin/as --traditional-format -o promotion_history_report.o
/var/tmp//ccqM2qec
.s

 

Pro*C/C++: Release 8.1.7.0.0 - Production on Mon Dec 16 17:18:23 2002

 

(c) Copyright 2000 Oracle Corporation.  All rights reserved.


System default option values taken from:
/oracle/app/oracle/product/8.1.7.4/prec
omp/admin/pcscfg.cfg

 

Reading specs from /usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.1/specs

Configured with: ./configure  : (reconfigured) ./configure  : (reconfigured)
./c
onfigure

Thread model: posix

gcc version 3.1

 /usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.1/cc1 -lang-c -std=c89 -v
-I/ora cle/app/oracle/product/8.1.7.4/precomp/public -D__GNUC__=3
-D__GNUC_MINOR__=1 -D __GNUC_PATCHLEVEL__=0 -D__hppa__ -D__hp9000s800__
-D__hp9000s800 -D__hp9k8__ -D_ _PWB__ -D__hpux__ -D__unix__ -D__hppa
-D__hp9000s800 -D__hp9k8 -D__PWB -D__hpux 
-D__unix -Asystem=unix -Asystem=hpux -Acpu=hppa -Amachine=hppa
-D__NO_INLINE__ - D__STDC_HOSTED__=1 -D_PA_RISC1_1 -D__hp9000s700
../../../aee_common/source/updat e_status.c -quiet -dumpbase update_status.c
-ansi -ggdb -Wall -ansi -version -o 
/var/tmp//ccqCszfb.s

GNU CPP version 3.1 (cpplib) (hppa)

GNU C version 3.1 (hppa2.0n-hp-hpux11.00)

        compiled by GNU C version 3.1.

ignoring nonexistent directory "/usr/local/hppa2.0n-hp-hpux11.00/include"

#include "..." search starts here:

#include <...> search starts here:

 /oracle/app/oracle/product/8.1.7.4/precomp/public

 /usr/local/include

 /usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.1/include

 /usr/include

End of search list.

../../../aee_common/source/update_status.c: In function `update_status':

../../../aee_common/source/update_status.c:289: warning: implicit
declaration of
 function `strcpy'

../../../aee_common/source/update_status.c: At top level:

../../../aee_common/source/update_status.c:106: warning: `sqlstm' defined
but no
t used

../../../aee_common/source/update_status.c:174: warning: `SCCS_ID' defined
but n
ot used

 
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.1/../../../../hppa2.0n-hp-hpu
x11
.00/bin/as --traditional-format -o update_status.o /var/tmp//ccqCszfb.s


MY GDB ACTIVITY:

:/usr/local/development/aee_epm_dev3/source/promotion_history_report$ gdb

GNU gdb 5.2.1

Copyright 2002 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are

welcome to change it and/or distribute copies of it under certain
conditions.   
Type "show copying" to see the conditions.

There is absolutely no warranty for GDB.  Type "show warranty" for details.

This GDB was configured as "hppa2.0n-hp-hpux11.00".

(gdb) file ../../bin/promotion_history_report

Reading symbols from ../../bin/promotion_history_report...done.

(gdb) break read_MOS_conversions

Breakpoint 1 at 0x8f9c: file promotion_history_report.c, line 2868.

6155224et args choiniej/andrae36 200211 ../../data_files/epm_conv_hist.txt
0510 
(gdb) r

Starting program:
/usr/local/development/aee_epm_dev3/bin/promotion_history_rep4
Program started with max array size 18000 MOS-Grade 1500.

[New process 15090]

Detaching after fork from process 15090

Promotion History Report program started

initializing Input File with MOS Conversions.

Successful Input File Open.

initializing Report Files

Determining the date range for the report

initializing MOS Conversion Array

initializing input arrays    1

initializing output arrays

The MOS Conversions read from the input file

 

Breakpoint 1, read_MOS_conversions (conversion_record=0x4006f7a0,

    prom_month=0x400011ac "200211", prom_start=0x400011b4 "200112")

    at promotion_history_report.c:2868

2868       int loop_counter = 0;

(gdb) n

2871       track_me("9E");

(gdb) n

2873       fprintf(fp_perhist,

(gdb) n

2876       fflush(fp_perhist);

(gdb) n

2882       while (fgets(line, 83, infileptr) != NULL)

(gdb) n

 

Program received signal SIGSEGV, Segmentation fault.

0x77f41b04 in mallinfo () from /usr/lib/libc.2

(gdb) bt

#0  0x77f41b04 in mallinfo () from /usr/lib/libc.2

#1  0x77f3f3e0 in __thread_mutex_unlock () from /usr/lib/libc.2

#2  0x77f44c24 in malloc () from /usr/lib/libc.2

#3  0x77fa3e54 in _findbuf () from /usr/lib/libc.2

#4  0x77fa28ec in _filbuf () from /usr/lib/libc.2

#5  0x77fa2500 in __fgets_unlocked () from /usr/lib/libc.2

#6  0x77fa2700 in fgets () from /usr/lib/libc.2

#7  0x0000901c in read_MOS_conversions (conversion_record=0x4006f7a0,

    prom_month=0x400011ac "200211", prom_start=0x400011b4 "200112")

    at promotion_history_report.c:2882

#8  0x000035f0 in main (c=5, v=0x77ff125c) at promotion_history_report.c:770



Any and all help would be greatly appreciated.  If you need any more
information, please contact me.

Jacques C. Choiniere
jacques.choiniere@hoffman.army.mil
Northrop Grumman IT





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-17 18:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-17 10:52 Segmentation Fault on 64-bit gcc Compiled Pro*C Program on HPUX 1 1.00 Choiniere, Jacques C, PERSCOM

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).