[Bug c/50646] New: configure detects big endian on little endian system.

fzvqedi at v dot mintemail.com gcc-bugzilla@gcc.gnu.org
Fri Oct 7 01:30:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50646

             Bug #: 50646
           Summary: configure detects big endian on little endian system.
    Classification: Unclassified
           Product: gcc
           Version: 4.5.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: fzvqedi@v.mintemail.com


checking whether byte ordering is bigendian... yes

| int                                                                           
| main ()                                                                       
| {                                                                             
|                                                                               
|            /* Are we little or big endian?  From Harbison&Steele.  */         
|            union                                                              
|            {                                                                  
|              long int l;                                                      
|              char c[sizeof (long int)];                                       
|            } u;                                                               
|            u.l = 1;                                                           
|            return u.c[sizeof (long int) - 1] == 1;                            
|                                                                               
|   ;                                                                           
|   return 0;                                                                   
| }                                
                                                                               
                                                     configure:8171: result:
yes

that test will return 0 on _little endian_
obviously the code was copypasted from a function isBigEndian(), but the author
forgot that returning 0 in main means success.

the reason it came so far is that configure dumbly added some stuff like
#define ssize_t int
to auto-host.h which caused all previous checks to err, because the libc just
typedef'd those types, resulting in:
 error: two or more data types in declaration specifiers
or
error: 'long long long' is too long for GCC



More information about the Gcc-bugs mailing list