[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    Re: Possible bug in egcs-19990517 with IRIX/mips4.
From:       Wolfgang Glas <Wolfgang.Glas () hfm ! tu-graz ! ac ! at>
Date:       1999-05-31 6:20:19
[Download RAW message or body]

Martin Knoblauch wrote:
> 
> Wolfgang Glas wrote:
> >
> > Martin Knoblauch wrote:
> > >
> > > ---Jeffrey A Law <law@upchuck.cygnus.com> wrote:
> > > >
> > > >
> > > >   > Another thing that strikes me is, that obviously on my box
> > > >   > specifying -mips3 also activates -mlong64
> > > > Yes.
> > > >
> > > >
> > > >   > (Is this a feature or a bug ?)
> > > > It is correct behavior -mips3 and -mips4 will turn on -mlong64.
> > > >
> > >
> > >  Hmm. I do not think this is a good decision. There are
> > > Systems like the O2 (R10K and R5K) and the Indy (R5K), which
> > > are mips4 capable, but run IRIX6.5 in 32-bit mode.
> > >
> > >  Also, all R4400 based desktop machines can do mips3 (it is
> > > the default in IRIX6.5), but run IRIX in 32-bit mode.
> > >
> > >  Making 64-bit the default for mips3/mips4 limits the useability
> > > to the systems running IRIX64.
> >
> > In fact, the size of data types depend on the abi used and
> > not on the type of machine for which the code is generated.
> > And egcs only supports the -n32 abi, which expects
> > sizeof(long) and sizeof(void *) to be 4.
> >
> > ou can read your /usr/include/sgidefs.h file for a
> > definition of the data type sizes.
> >
> 
>   thats all fine, but apparently the message which I replied to
> implies that the usage of mips3/mips4 prompts egcs to
> generate -64 code (sizeof(long) == sizeof(void *) == 8).
> If this is true, it is a misbehaviour.

At my advice there is a misbehaviour of egcs concerning the
sizes of data types. First of all I can't create an object
file on a R10K hardware that's suitable for a R4K, because
-mips3 on a R10K does something different than gcc without
any submodel options on a R4K.
(It in fact changes the sizes of data types to somthing like
-64, but it does not use correct abi in ld/asm/cpp)

I sent a message to Jeffrey A Law <law@cygnus.com> on that
topic and didn't post it to egcs-bugs@egcs.cygnus.com, so I
put it here: 


Anyways, there is somehow a mess with the -mips3 -mips4 etc.
options:
Consider the following program:
-------------------test.c------------------
#include<stdio.h>

int main()
{
  printf("sizeof(short)      = %d\n",sizeof(short));
  printf("sizeof(int)        = %d\n",sizeof(int));
  printf("sizeof(long)       = %d\n",sizeof(long));
  printf("sizeof(long long)  = %d\n",sizeof(long long));
  printf("sizeof(float)      = %d\n",sizeof(float));
  printf("sizeof(double)     = %d\n",sizeof(double));
  printf("sizeof(long double)= %d\n",sizeof(long double));
  printf("sizeof(void *)     = %d\n",sizeof(void *));
  return 0;
}
-------------------------------------------

First I compile with out any options:

---------------------------------------------------------------------
/home/wglas/CC/this_and_that > gcc -v test.c -o test
Reading specs from
/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
 /usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/cpp
-lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=91 -Dunix
-Dmips -Dsgi -Dhost_mips -DMIPSEB -D_MIPSEB -DSYSTYPE_SVR4
-D_LONGLONG -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ -D__unix__
-D__mips__ -D__sgi__ -D__host_mips__ -D__MIPSEB__ -D_MIPSEB
-D__SYSTYPE_SVR4__ -D_LONGLONG -D_SVR4_SOURCE -D_MODERN_C
-D__DSO__ -D__unix -D__mips -D__sgi -D__host_mips -D__MIPSEB
-D__SYSTYPE_SVR4 -Asystem(unix) -Asystem(svr4) -Acpu(mips)
-Amachine(sgi) -D__CHAR_UNSIGNED__ -D__LANGUAGE_C
-D_LANGUAGE_C -DLANGUAGE_C -D__SIZE_TYPE__=unsigned int
-D__PTRDIFF_TYPE__=int -D__EXTENSIONS__ -D_SGI_SOURCE
-D_MIPS_FPSET=32 -D_MIPS_ISA=_MIPS_ISA_MIPS3 -D_ABIN32=2
-D_MIPS_SIM=_ABIN32 -D_MIPS_SZINT=32 -D_MIPS_SZLONG=32
-D_MIPS_SZPTR=32 -D_COMPILER_VERSION=601 -U__mips -D__mips=3
-D__mips64 test.c /var/tmp/ccj0P26Y.i
GNU CPP version egcs-2.91.66 19990314 (egcs-1.1.2 release)
[AL 1.1, MM 40] SGI running IRIX 6.x
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/mips-sgi-irix6.5/include

/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/cc1
/var/tmp/ccj0P26Y.i -quiet -dumpbase test.c -version -o
/var/tmp/cc6CGz1R.s
GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release)
(mips-sgi-irix6.5) compiled by GNU C version egcs-2.91.66
19990314 (egcs-1.1.2 release).
 /usr/bin/as -g0 -nocpp -show -G 0 -w -n32 -o
/var/tmp/ccXfuZsN.o /var/tmp/cc6CGz1R.s
/usr/bin/../lib32/cmplrs/as
-DEFAULT:abi=n32:isa=mips4:proc=r10k -g0 -nocpp -show -G 0
-w -n32 -o /var/tmp/ccXfuZsN.o /var/tmp/cc6CGz1R.s
/usr/lib32/cmplrs/asm -EB -pic2 -elf -g0 -G0 -w -mips4 -n32
-O0 -t5_ll_sc_bug /var/tmp/cc6CGz1R.s -o /var/tmp/ccXfuZsN.o 

/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/collect2
-call_shared -no_unresolved -init __do_global_ctors -fini
__do_global_dtors -_SYSTYPE_SVR4 -woff 131 -n32 -o test
/usr/lib32/mips3/crt1.o
/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/crtbegin.o
-L/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66
-L/usr/local/mips-sgi-irix6.5/lib -L/usr/bin
-L/usr/local/lib /var/tmp/ccXfuZsN.o -dont_warn_unused -lgcc
-warn_unused -L/usr/lib32/mips3 -L/usr/lib32
-dont_warn_unused -lc -warn_unused -dont_warn_unused -lgcc
-warn_unused
/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/crtend.o
/usr/lib32/mips3/crtn.o
/home/wglas/CC/this_and_that > ./test
sizeof(short)      = 2
sizeof(int)        = 4
sizeof(long)       = 4
sizeof(long long)  = 8
sizeof(float)      = 4
sizeof(double)     = 8
sizeof(long double)= 8
sizeof(void *)     = 4
/home/wglas/CC/this_and_that > 
---------------------------------------------------------------------
 The linker and assembler are called with -mips4, but the
preprocessor tells SGI' headers
-D_MIPS_ISA=_MIPS_ISA_MIPS3
, which is mess in my eyes, because it should use
-D_MIPS_ISA=_MIPS_ISA_MIPS4

sizeof(long)=4 and sizeof(void *)=4 
and the SGI headers know this, because of -D_MIPS_SZLONG=32
and -D_MIPS_SZPTR=32

Now I use -mips4, which I thought is the same as no option
at my hardware, but it isn't
---------------------------------------------------------------------
/home/wglas/CC/this_and_that > gcc -mips4 -v test.c -o test
Reading specs from
/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
 /usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/cpp
-lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=91 -Dunix
-Dmips -Dsgi -Dhost_mips -DMIPSEB -D_MIPSEB -DSYSTYPE_SVR4
-D_LONGLONG -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ -D__unix__
-D__mips__ -D__sgi__ -D__host_mips__ -D__MIPSEB__ -D_MIPSEB
-D__SYSTYPE_SVR4__ -D_LONGLONG -D_SVR4_SOURCE -D_MODERN_C
-D__DSO__ -D__unix -D__mips -D__sgi -D__host_mips -D__MIPSEB
-D__SYSTYPE_SVR4 -Asystem(unix) -Asystem(svr4) -Acpu(mips)
-Amachine(sgi) -D__CHAR_UNSIGNED__ -D__LANGUAGE_C
-D_LANGUAGE_C -DLANGUAGE_C -D__SIZE_TYPE__=unsigned int
-D__PTRDIFF_TYPE__=int -U__mips -D__mips=4 -D__mips64
-D__EXTENSIONS__ -D_SGI_SOURCE -D_MIPS_FPSET=32
-D_MIPS_ISA=_MIPS_ISA_MIPS4 -D_ABIN32=2 -D_MIPS_SIM=_ABIN32
-D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32
-D_COMPILER_VERSION=601 -D__mips64 test.c
/var/tmp/ccSqUUeo.i
GNU CPP version egcs-2.91.66 19990314 (egcs-1.1.2 release)
[AL 1.1, MM 40] SGI running IRIX 6.x
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/mips-sgi-irix6.5/include

/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/cc1
/var/tmp/ccSqUUeo.i -mfp64 -mgp64 -quiet -dumpbase test.c
-mips4 -version -o /var/tmp/ccSQqetG.s
GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release)
(mips-sgi-irix6.5) compiled by GNU C version egcs-2.91.66
19990314 (egcs-1.1.2 release).
 /usr/bin/as -mips4 -g0 -nocpp -show -G 0 -w -n32 -o
/var/tmp/ccGaXHK1.o /var/tmp/ccSQqetG.s
/usr/bin/../lib32/cmplrs/as
-DEFAULT:abi=n32:isa=mips4:proc=r10k -mips4 -g0 -nocpp -show
-G 0 -w -n32 -o /var/tmp/ccGaXHK1.o /var/tmp/ccSQqetG.s
/usr/lib32/cmplrs/asm -EB -pic2 -elf -mips4 -n32 -g0 -G0 -w
-O0 -t5_ll_sc_bug /var/tmp/ccSQqetG.s -o /var/tmp/ccGaXHK1.o 

/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/collect2
-mips4 -call_shared -no_unresolved -init __do_global_ctors
-fini __do_global_dtors -_SYSTYPE_SVR4 -woff 131 -n32 -o
test /usr/lib32/mips4/crt1.o
/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/crtbegin.o
-L/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66
-L/usr/local/mips-sgi-irix6.5/lib -L/usr/bin
-L/usr/local/lib /var/tmp/ccGaXHK1.o -dont_warn_unused -lgcc
-warn_unused -L/usr/lib32/mips4 -L/usr/lib32
-dont_warn_unused -lc -warn_unused -dont_warn_unused -lgcc
-warn_unused
/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/crtend.o
/usr/lib32/mips4/crtn.o
/home/wglas/CC/this_and_that > ./test
sizeof(short)      = 2
sizeof(int)        = 4
sizeof(long)       = 8
sizeof(long long)  = 8
sizeof(float)      = 4
sizeof(double)     = 8
sizeof(long double)= 8
sizeof(void *)     = 8
/home/wglas/CC/this_and_that > 
---------------------------------------------------------------------
Here -D_MIPS_ISA=_MIPS_ISA_MIPS4 is right.
Data type sizes have changed, but are not reported through
cpp, because there:
-D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32
despite the results above:
sizeof(long)       = 8
sizeof(void *)     = 8

Now, I try to generate a mips3 executable:
---------------------------------------------------------------------
/home/wglas/CC/this_and_that > gcc -mips3 -v test.c -o test
Reading specs from
/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
 /usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/cpp
-lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=91 -Dunix
-Dmips -Dsgi -Dhost_mips -DMIPSEB -D_MIPSEB -DSYSTYPE_SVR4
-D_LONGLONG -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ -D__unix__
-D__mips__ -D__sgi__ -D__host_mips__ -D__MIPSEB__ -D_MIPSEB
-D__SYSTYPE_SVR4__ -D_LONGLONG -D_SVR4_SOURCE -D_MODERN_C
-D__DSO__ -D__unix -D__mips -D__sgi -D__host_mips -D__MIPSEB
-D__SYSTYPE_SVR4 -Asystem(unix) -Asystem(svr4) -Acpu(mips)
-Amachine(sgi) -D__CHAR_UNSIGNED__ -D__LANGUAGE_C
-D_LANGUAGE_C -DLANGUAGE_C -D__SIZE_TYPE__=unsigned int
-D__PTRDIFF_TYPE__=int -U__mips -D__mips=3 -D__mips64
-D__EXTENSIONS__ -D_SGI_SOURCE -D_MIPS_FPSET=32
-D_MIPS_ISA=_MIPS_ISA_MIPS3 -D_ABIN32=2 -D_MIPS_SIM=_ABIN32
-D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32
-D_COMPILER_VERSION=601 -D__mips64 test.c
/var/tmp/cc5uJDHc.i
GNU CPP version egcs-2.91.66 19990314 (egcs-1.1.2 release)
[AL 1.1, MM 40] SGI running IRIX 6.x
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/mips-sgi-irix6.5/include

/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/cc1
/var/tmp/cc5uJDHc.i -mfp64 -mgp64 -quiet -dumpbase test.c
-mips3 -version -o /var/tmp/cc434wNj.s
GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release)
(mips-sgi-irix6.5) compiled by GNU C version egcs-2.91.66
19990314 (egcs-1.1.2 release).
 /usr/bin/as -mips3 -g0 -nocpp -show -G 0 -w -n32 -o
/var/tmp/ccGSXG2j.o /var/tmp/cc434wNj.s
/usr/bin/../lib32/cmplrs/as
-DEFAULT:abi=n32:isa=mips4:proc=r10k -mips3 -g0 -nocpp -show
-G 0 -w -n32 -o /var/tmp/ccGSXG2j.o /var/tmp/cc434wNj.s
/usr/lib32/cmplrs/asm -EB -pic2 -elf -mips3 -n32 -g0 -G0 -w
-O0 -t5_ll_sc_bug /var/tmp/cc434wNj.s -o /var/tmp/ccGSXG2j.o 

/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/collect2
-mips3 -call_shared -no_unresolved -init __do_global_ctors
-fini __do_global_dtors -_SYSTYPE_SVR4 -woff 131 -n32 -o
test /usr/lib32/mips3/crt1.o
/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/crtbegin.o
-L/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66
-L/usr/local/mips-sgi-irix6.5/lib -L/usr/bin
-L/usr/local/lib /var/tmp/ccGSXG2j.o -dont_warn_unused -lgcc
-warn_unused -L/usr/lib32/mips3 -L/usr/lib32
-dont_warn_unused -lc -warn_unused -dont_warn_unused -lgcc
-warn_unused
/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/crtend.o
/usr/lib32/mips3/crtn.o
ld32: WARNING 158: Expecting MIPS3 objects:
/usr/local/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/crtbegin.o
is MIPS4.
/home/wglas/CC/this_and_that > ./test
sizeof(short)      = 2
sizeof(int)        = 4
sizeof(long)       = 8
sizeof(long long)  = 8
sizeof(float)      = 4
sizeof(double)     = 8
sizeof(long double)= 8
sizeof(void *)     = 8
/home/wglas/CC/this_and_that > 
---------------------------------------------------------------------
-D_MIPS_ISA=_MIPS_ISA_MIPS3 is right
-D_MIPS_SZLONG=32 and -D_MIPS_SZPTR=32 are a mess again.

--
Mag. Wolfgang Glas
Institut fuer hydraulische Stroemungsmaschinen
Kopernikusgasse 24                             
Phone:++43/316/873/7578
A-8010 Graz                                     Fax: 
++43/316/873/7577

mailto:Wolfgang.Glas@hfm.tu-graz.ac.at   
http://fhysmsg01.tu-graz.ac.at/Wolfgang.Glas/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic