This is the mail archive of the gcc-bugs@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]

gcc problem?


Hello,

I have recently been trying to compile LAS (Land Analysis System) on
a Linux laptop.  In compiling a particular function for a library I am
getting a strange error.  Below is the pertinent information, and
I have attached the source code for the offending function, c_fhdrrd.c.
Please let me know if you need anything else, and what ideas you may
have.

Thank you!

Julie Mitchell
Email: jmitch@kryos.colorado.edu
------------------------------------------


GCC version  2.95.2

System:  SuSE Linux 6.4 (i386) - Kernel 2.2.14 (2)

Compiler command:

gcc -O -funsigned-char -fwritable-strings -Wall
 -I/usr/local/las73/build/las/include
 -I/usr/local/las73/tae/include -c c_fhdrrd.c

Error generated:

c_fhdrrd.c: In function `c_fhdrrd':
c_fhdrrd.c:209: Unable to generate reloads for:
(insn 795 793 797 (parallel[
            (set (reg:SI 0 %eax)
                (fix:SI (fix:DF (subreg:DF (reg:DI 0 %eax) 0))))
            (clobber (mem:HI (plus:SI (reg:SI 6 %ebp)
                        (const_int -386 [0xfffffe7e])) 0))
            (clobber (mem:HI (plus:SI (reg:SI 6 %ebp)
                        (const_int -388 [0xfffffe7c])) 0))
            (clobber (mem:SI (plus:SI (reg:SI 6 %ebp)
                        (const_int -392 [0xfffffe78])) 0))
            (clobber (scratch:HI))
        ] ) 149 {fix_truncdfsi2+1} (insn_list 793 (nil))
    (expr_list:REG_EQUIV (mem:SI (reg/v:SI 4 %esi) 0)
        (expr_list:REG_DEAD (reg:DI 0 %eax)
            (expr_list:REG_UNUSED (scratch:HI)
                (nil)))))
make[1]: *** [c_fhdrrd.o] Error 1
make[1]: Leaving directory `/usr/local/las73/src/las/base/support/header'
make: *** [las] Error 2
--------------------------------------------
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "tae.h"
#include "worgen.h"
#include "fhdr.h"
#include "header.h"

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

NAME: c_fhdrrd

PURPOSE: Read a particular field in a Fast Format Header.

PROGRAM HISTORY:
  Version	Date       Author	       Request
  -------	----	   ------              -------
   1.0        11/92        K Sheffield    initial developement

COMPUTER HARDWARE AND/OR SOFTWARE LIMITATIONS:	

PROJECT: Landsat Pathfinder

ALGORITHM DESCRIPTION:
   Determine the field to read.
   Check to see if the data pointer is valid.
   Recast the data pointer to the appropriate data type.
   Reformat the data if needed into a temporary string.
   Copy the data or temporary string into the supplied data address.
   If no data is available, return HUGE_VAL (infinity) for numerical values, 
   and a NULL string for ascii values.

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


int c_fhdrrd
(
    char *header,             /* the pointer to the fast fmt header       */
    long field,               /* the field to be read                     */
    char *data                /* address to place the data read           */
)
{
   char *cptr;                  /* pointer to character data                */
   char tmp[361];               /* temporary string                         */
   double *dptr;                /* pointer to double data                   */
   long flen;                   /* length of the field format               */
   long fieldinfo[5];           /* array containing field information       */
   long i;
   long *lptr;                  /* pointer to integer data                  */
   long status;                 /* function return status                   */

   long one = 1;
   

   memset(tmp,' ',360);
   tmp[360] = '\0';
   
   if(E_FAIL == c_fhdfld(field,fieldinfo))
   {
      c_errmsg("Error returned from fhdfld","fhdfld-call",&one);
      return(E_FAIL);
   }
   
     
   switch (fieldinfo[FDTYPE]) 
   {
/* return the ascii fields */
/* the first set are just labels */
    case 'C':
/* these fields are ascii text with parameters/values in them */
    case 'A':
      if(data != NULL)
      {
	 flen = fieldinfo[FLEN1];
	 strncpy(data,&header[fieldinfo[FSBYTE]],flen);
	 data[flen] = 0;
	 if(strspn(data," ") == flen)
	   *data = 0;
      }
      else
      {
	 c_errmsg("Illegal data address","fhdrrd-addr",&one);
	 return(E_FAIL);
      }
      
      break;
      
/* these fields contain simple integer values */

    case 'I':
      if( data != NULL )
      {
	 lptr = (long *) data;
	 flen = fieldinfo[FLEN1];
	 strncpy(tmp, &header[fieldinfo[FSBYTE]],flen);
	 status = sscanf(tmp,"%ld",lptr);
	 if(status != 1)
	   *lptr = (long)HUGE_VAL;
      }
      else
      {
	 c_errmsg("Illegal data address","fhdrrd-addr",&one);
	 return(E_FAIL);
      }

      break;
      
/* these fields contain simple floating point values */
    case 'D':
      if( data != NULL )
      {
	 flen = fieldinfo[FLEN1];
	 dptr = (double *) data;
	 
	 strncpy(tmp, &header[fieldinfo[FSBYTE]],flen);
	 status = sscanf(tmp,"%lf",dptr);
	 if(status != 1)
	   *dptr = HUGE_VAL;
      }
      else
      {
	 c_errmsg("Illegal data address","fhdrrd-addr",&one);
	 return(E_FAIL);
      }
      break;
      
/* These fields are assumed to be latitudes 
   The format of these numbers are in the form ddmmss.ssssN or ddmmss.ssssS 
   the value passed in is to be in decimal degrees */

    case 'l':
      if ( data != NULL )
      {
	 flen = fieldinfo[FLEN1];
	 dptr = (double *) data;

	 strncpy(tmp, &header[fieldinfo[FSBYTE]],flen);
	 status = dms2deg(tmp,dptr,0);
	 if(status)
	   *dptr = HUGE_VAL;
      }
      else
      {
	 c_errmsg("Illegal data address","fhdrrd-addr",&one);
	 return(E_FAIL);
      }
      
      break;
      
      
/* These fields are assumed to be longitudes 
   The format of these numbers are in the form dddmmss.ssssE or dddmmss.ssssW 
   the value passed in is to be in decimal degrees */

    case 'L':
      if ( data != NULL )
      {
	 flen = fieldinfo[FLEN1];
	 dptr = (double *) data;
	 strncpy(tmp, &header[fieldinfo[FSBYTE]],flen);
	 status = dms2deg(tmp,dptr,1);
	 if(status)
	   *dptr = HUGE_VAL;
      }
      else
      {
	 c_errmsg("Illegal data address","fhdrrd-addr",&one);
	 return(E_FAIL);
      }

      break;

/* this field is for the USGS projection parameters.  These are a special
   case since the formatting has to be changed to FORTRAN specs */

    case 'G':
      if (data != NULL)
      {
	 flen = fieldinfo[FLEN1];
	 dptr = (double *) data;
	 
	 cptr = header + fieldinfo[FSBYTE];/* keep track of current location*/

	 
	 for(i=0;i<15;i++, cptr += 24)
	 {
	    strncpy(tmp,cptr,flen);
	    status = fstr2cdbl(tmp,dptr);
	    if(status)
	      *dptr = HUGE_VAL;
	    dptr++;
	 }
      }
      else
      {
	 c_errmsg("Illegal data address","fhdrrd-addr",&one);
	 return(E_FAIL);
      }

      break;
      

    default:
      c_errmsg("Illegal field data type","fhdrrd-field",&one);
      return(E_FAIL);
   }
   
   return(E_SUCC);
}

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