Hi,

I am testing a cross-compiler targetting arm-wince-pe and based on
gcc-trunk revision r144975 and when
compiling a project I get the following error :

vinc...@vincent-pc:~/projects$ arm-mingw32ce-gcc -std=gnu99 -save-temps
-I/home/vincent/local/wince/include -DNDEBUG -O3 -c cegcc-errno-bug.c 
-DDLL_EXPORT -DPIC -o libeet_la-eet_lib.o
cegcc-errno-bug.c: In function 'eet_close':
cegcc-errno-bug.c:134: error: unrecognizable insn:
(insn 6 5 7 3 cegcc-errno-bug.c:114 (set (reg/f:SI 138)
        (symbol_ref:SI ("errno") [flags 0x4c0] <var_decl 0xb7db26e0
errno>)) -1 (nil))
cegcc-errno-bug.c:134: internal compiler error: in extract_insn, at
recog.c:2048

Of course I could report a bug but since original sources are patched the
bug might be due to one 
of the modifications.
Anyway if someone knows how I could fix this, the only thing I see is the
fact the problem seems to be
related to errno and on wince platform by default there is no errno.
So the project I am compiling declare it like this and is defined in a
library.

/home/vincent/local/wince/include/errno.h:

#ifndef __EVIL_ERRNO_H__
#define __EVIL_ERRNO_H__

#ifdef EAPI
# undef EAPI
#endif /* EAPI */

#ifdef _WIN32
# ifdef EFL_EVIL_BUILD
#  ifdef DLL_EXPORT
#   define EAPI __declspec(dllexport)
#  else
#   define EAPI
#  endif /* ! DLL_EXPORT */
# else
#  define EAPI __declspec(dllimport)
# endif /* ! EFL_EVIL_BUILD */
#endif /* _WIN32 */

#ifdef  __cplusplus
extern "C" {
#endif

extern EAPI int errno;

/* Fake values */
#define E2BIG           1
#define EACCES          2
...

#ifdef  __cplusplus
}
#endif

#endif /* __EVIL_ERRNO_H__ */
-----------------------------------------------------
And here is the testcase :

//#ifdef HAVE_CONFIG_H
//# include <config.h>
//#endif

#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#elif defined __GNUC__
# define alloca __builtin_alloca
#elif defined _AIX
# define alloca __alloca
#elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
#else
# include <stddef.h>
# ifdef  __cplusplus
extern "C"
# endif
void *alloca (size_t);
#endif

#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <time.h>
#include <string.h>
#include <fnmatch.h>
#include <fcntl.h>
#include <unistd.h>
#include <zlib.h>

#ifdef HAVE_OPENSSL
#include <openssl/err.h>
#endif

#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif

#if defined(_WIN32) && ! defined(__CEGCC__)
# include <winsock2.h>
#endif

//#ifdef HAVE_EVIL
//# include <Evil.h>
//#endif

#ifdef HAVE_GNUTLS
# include <gnutls/gnutls.h>
# include <gcrypt.h>
#endif

#ifdef HAVE_OPENSSL
# include <openssl/err.h>
# include <openssl/evp.h>
#endif

//#include <Eina.h>

//#include "Eet.h"
//#include "Eet_private.h"

#ifdef HAVE_REALPATH
#undef HAVE_REALPATH
#endif

#define EET_MAGIC_FILE                  0x1ee7ff00
#define EET_MAGIC_FILE_HEADER           0x1ee7ff01

#define EET_MAGIC_FILE2                 0x1ee70f42

 typedef enum _Eet_File_Mode
     {
        EET_FILE_MODE_INVALID = -1,
        EET_FILE_MODE_READ,
        EET_FILE_MODE_WRITE,
        EET_FILE_MODE_READ_WRITE
     } Eet_File_Mode;

   typedef enum _Eet_Error
     {
        EET_ERROR_NONE,
        EET_ERROR_BAD_OBJECT,
        EET_ERROR_EMPTY,
        EET_ERROR_NOT_WRITABLE,
        EET_ERROR_OUT_OF_MEMORY,
        EET_ERROR_WRITE_ERROR,
        EET_ERROR_WRITE_ERROR_FILE_TOO_BIG,
        EET_ERROR_WRITE_ERROR_IO_ERROR,
        EET_ERROR_WRITE_ERROR_OUT_OF_SPACE,
        EET_ERROR_WRITE_ERROR_FILE_CLOSED,
        EET_ERROR_MMAP_FAILED,
        EET_ERROR_X509_ENCODING_FAILED,
        EET_ERROR_SIGNATURE_FAILED,
        EET_ERROR_INVALID_SIGNATURE,
        EET_ERROR_NOT_SIGNED,
        EET_ERROR_NOT_IMPLEMENTED,
        EET_ERROR_PRNG_NOT_SEEDED,
        EET_ERROR_ENCRYPT_FAILED,
        EET_ERROR_DECRYPT_FAILED
     } Eet_Error;

/* prototypes of internal calls */
static Eet_Error        eet_flush2(int *ef);

/* flush out writes to a v2 eet file */
static Eet_Error
eet_flush2(int *ef)
{
    Eet_Error             error = EET_ERROR_NONE;
 
        switch (errno)
          {
           case EFBIG: error = EET_ERROR_WRITE_ERROR_FILE_TOO_BIG; break;
           case EIO: error = EET_ERROR_WRITE_ERROR_IO_ERROR; break;
           case ENOSPC: error = EET_ERROR_WRITE_ERROR_OUT_OF_SPACE; break;
           case EPIPE: error = EET_ERROR_WRITE_ERROR_FILE_CLOSED; break;
           default: error = EET_ERROR_WRITE_ERROR; break;
          }
    
   return error;
}

EAPI Eet_Error
eet_close(int *ef)
{
   Eet_Error err;

   err = eet_flush2(ef);
  
   return err;
} // L134 : where gcc crash


If I comment the errno variable inside the switch and replace it by 1 for
instance, it compiles fine.
Where should I start ?







Reply via email to