public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Re: Problem with unsigned long long on ultrasparc
@ 1998-08-21 11:04 Brad Lucier
0 siblings, 0 replies; 12+ messages in thread
From: Brad Lucier @ 1998-08-21 11:04 UTC (permalink / raw)
To: lucier, davem; +Cc: egcs-bugs, feeley, staff
> From davem@dm.cobaltmicro.com Thu Aug 20 18:55:42 1998
> Date: Thu, 20 Aug 1998 16:53:46 -0700
>
> From: Brad Lucier <lucier@math.purdue.edu>
> Date: Thu, 20 Aug 1998 18:51:17 -0500 (EST)
>
> It is important to me to use 32 double-precision floating-point registers
> for some of my codes; does -mtume=ultrasparc provide this?
>
> It should.
>
Well, actually, it doesn't---it only uses the first 16 double precision
registers.
How much 64bit support can egcs provide in Solaris 2.5.1 and 2.6?
Brad Lucier lucier@math.purdue.edu
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problem with unsigned long long on ultrasparc
1998-08-20 14:22 Brad Lucier
1998-08-20 16:17 ` David S. Miller
1998-08-20 18:26 ` David S. Miller
@ 1999-02-28 23:30 ` Jeffrey A Law
2 siblings, 0 replies; 12+ messages in thread
From: Jeffrey A Law @ 1999-02-28 23:30 UTC (permalink / raw)
To: Brad Lucier; +Cc: egcs-bugs, feeley, staff
In message <199808202122.QAA22453@polya.math.purdue.edu>you write:
> Here's a simple program:
>
> #include <stdlib.h>
> #include <stdio.h>
>
> int main() {
> unsigned long long a[10];
>
> #define BASE_DIV_2 (((unsigned long long) 1) << 63)
>
> a[0] = -1;
> printf("%ull\n", a[0]);
> printf("%ull\n", BASE_DIV_2);
> if (a[0] < BASE_DIV_2)
> printf("Problem\n");
> else
> printf("OK\n");
> }
>
> With this version of gcc:
>
> peano-30% gcc -v
> Reading specs from /opt/egcs-19980816/lib/gcc-lib/sparc-sun-solaris2.5.1/eg
> cs-2.91.54/specs
> gcc version egcs-2.91.54 19980816 (gcc2 ss-980609 experimental)
>
> I get:
>
> peano-31% gcc -O1 -o testlong testlong.c
> peano-32% testlong
> 4294967295ll
> 2147483648ll
> OK
>
> but
>
> peano-27% gcc -O1 -mcpu=ultrasparc -o testlong testlong.c
> peano-28% testlong
> 4294967295ll
> 2147483648ll
> Problem
>
> This is on Solaris 2.5.1.
I don't know if anyone ever responded to this bug report.
This problem has been corrected in the mainline egcs sources, but is not
expected to be fixed for the upcoming egcs-1.1.2 minor release.
jeff
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problem with unsigned long long on ultrasparc
1998-08-20 16:55 ` Brad Lucier
1998-08-20 16:55 ` David S. Miller
@ 1998-08-23 15:33 ` Todd Vierling
1 sibling, 0 replies; 12+ messages in thread
From: Todd Vierling @ 1998-08-23 15:33 UTC (permalink / raw)
To: Brad Lucier; +Cc: David S. Miller, egcs-bugs, feeley, staff
On Thu, 20 Aug 1998, Brad Lucier wrote:
: > Two things, -1 is an int not a long long (although does GCC promote it
: > to a long long in this case?),
:
: Yes, it does seem to promote it; I printed out the two values
: as unsigned long longs in order to check this.
IIRC, your test case used printf("%ull", ...) which is NOT printing "long
long". It's printing "unsigned int" followed by two "l" characters.
If you want to print "unsigned long long", use "%llu". For "long long",
"%lld". "%qu" and "%qd" may also work, but I do not have Slowlaris handy to
test. :)
--
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problem with unsigned long long on ultrasparc
1998-08-20 23:55 ` David S. Miller
@ 1998-08-21 3:05 ` Brad Lucier
1998-08-21 1:34 ` David S. Miller
0 siblings, 1 reply; 12+ messages in thread
From: Brad Lucier @ 1998-08-21 3:05 UTC (permalink / raw)
To: David S. Miller; +Cc: lucier, egcs-bugs, feeley, staff
OK, I have to admit, free software is great. Bugs are fixed before
they're even reported! As you suggested, the the current mainline branch
doesn't exhibit the bug I mentioned earlier.
But the 1.1 branch still has the bug. Can this be fixed? The mainline
is not stable enough for use. For example, there was another problem
installing the mainline branch:
cd ../../../libio; \
for FILE in *.h; do if [ $FILE != _G_config.h ]; then \
rm -f /opt/egcs-mainline/include/g++/$FILE ; \
/bin/sh /home/c/lucier/programs/egcs/install-sh -c -m 644 $FILE /opt/egcs-mainline/include/g++/$FILE ; \
chmod a-x /opt/egcs-mainline/include/g++/$FILE ; \
else true; fi; done ; \
else true; \
fi
install: _G_config.h does not exist
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/c/lucier/programs/egcs/objdir/sparc-sun-solaris2.5.1/libio'
make: *** [install-target-libio] Error 2
Then, when I tried to compile a longer file, I got:
peano-51% gcc -fPIC -mcpu=ultrasparc -O1 -c -D___DYNAMIC -D___SINGLE_HOST -o routines.c routines.c
../../gcc/emit-rtl.c:509: Internal compiler error in function gen_reg_rtx
peano-52% gcc -v
Reading specs from /opt/egcs-mainline/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.92.02/specs
gcc version egcs-2.92.02 19980820 (gcc2 ss-980609 experimental)
Brad Lucier lucier@math.purdue.edu
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problem with unsigned long long on ultrasparc
1998-08-21 3:05 ` Brad Lucier
@ 1998-08-21 1:34 ` David S. Miller
0 siblings, 0 replies; 12+ messages in thread
From: David S. Miller @ 1998-08-21 1:34 UTC (permalink / raw)
To: lucier; +Cc: lucier, egcs-bugs, feeley, staff
From: Brad Lucier <lucier@math.purdue.edu>
Date: Fri, 21 Aug 1998 03:31:52 -0500 (EST)
Then, when I tried to compile a longer file, I got:
peano-51% gcc -fPIC -mcpu=ultrasparc -O1 -c -D___DYNAMIC -D___SINGLE_HOST -o routines.c routines.c
../../gcc/emit-rtl.c:509: Internal compiler error in function gen_reg_rtx
peano-52% gcc -v
Reading specs from /opt/egcs-mainline/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.92.02/specs
gcc version egcs-2.92.02 19980820 (gcc2 ss-980609 experimental)
Send me the pre-processed source and I will fix the bug.
For the mainline issue try "-mno-v8plus"
Later,
David S. Miller
davem@dm.cobaltmicro.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problem with unsigned long long on ultrasparc
1998-08-20 18:26 ` David S. Miller
@ 1998-08-20 23:55 ` Brad Lucier
1998-08-20 23:55 ` David S. Miller
0 siblings, 1 reply; 12+ messages in thread
From: Brad Lucier @ 1998-08-20 23:55 UTC (permalink / raw)
To: David S. Miller; +Cc: lucier, egcs-bugs, feeley, staff
I used cvs to download the latest sources on the 1.1 branch and had the same
problem. I also downloaded the mainline branch, but part of it wouldn't link.
The error message is listed below.
I tried simpler programs but could not trigger the error.
Brad Lucier lucier@math.purdue.edu
...
stage1/xgcc -Bstage1/ -DIN_GCC -DSVR4 -W -Wall -O2 -g -O2 -o ../cc1plus \
call.o decl.o errfn.o expr.o pt.o sig.o typeck2.o class.o decl2.o error.o lex.o parse.o ptree.o rtti.o spew.o typeck.o cvt.o except.o friend.o init.o method.o search.o semantics.o tree.o xref.o repo.o `cat ../stamp-objlist` ../c-common.o ../c-pragma.o `if [ xobstack.o != x ]; then echo ../obstack.o; else true; fi` `case "stage1/xgcc -Bstage1/" in "cc") if [ xalloca.o != x ]; then echo ../alloca.o; else true; fi ;; esac` `if [ x != x ]; then echo ../; else true; fi`
Undefined first referenced
symbol in file
walk_tree tree.o
ld: fatal: Symbol referencing errors. No output written to ../cc1plus
collect2: ld returned 1 exit status
make[3]: *** [../cc1plus] Error 1
make[3]: Leaving directory `/home/c/lucier/programs/egcs/objdir/gcc/cp'
make[2]: *** [cc1plus] Error 2
make[2]: Leaving directory `/home/c/lucier/programs/egcs/objdir/gcc'
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory `/home/c/lucier/programs/egcs/objdir/gcc'
make: *** [bootstrap] Error 2
bessel-130%
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problem with unsigned long long on ultrasparc
1998-08-20 23:55 ` Brad Lucier
@ 1998-08-20 23:55 ` David S. Miller
1998-08-21 3:05 ` Brad Lucier
0 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 1998-08-20 23:55 UTC (permalink / raw)
To: lucier; +Cc: lucier, egcs-bugs, feeley, staff
From: Brad Lucier <lucier@math.purdue.edu>
Date: Fri, 21 Aug 1998 01:51:28 -0500 (EST)
Undefined first referenced
symbol in file
walk_tree tree.o
ld: fatal: Symbol referencing errors. No output written to ../cc1plus
Jason Merril just commited a fix to this.
Later,
David S. Miller
davem@dm.cobaltmicro.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problem with unsigned long long on ultrasparc
1998-08-20 14:22 Brad Lucier
1998-08-20 16:17 ` David S. Miller
@ 1998-08-20 18:26 ` David S. Miller
1998-08-20 23:55 ` Brad Lucier
1999-02-28 23:30 ` Jeffrey A Law
2 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 1998-08-20 18:26 UTC (permalink / raw)
To: lucier; +Cc: egcs-bugs, lucier, feeley, staff
Date: Thu, 20 Aug 1998 16:22:03 -0500 (EST)
From: Brad Lucier <lucier@math.purdue.edu>
With this version of gcc:
peano-30% gcc -v
Reading specs from /opt/egcs-19980816/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.54/specs
gcc version egcs-2.91.54 19980816 (gcc2 ss-980609 experimental)
...
peano-27% gcc -O1 -mcpu=ultrasparc -o testlong testlong.c
peano-28% testlong
4294967295ll
2147483648ll
Problem
This is on Solaris 2.5.1.
Please check the latest in CVS as I believe a change I made on the
17th cures this problem, I cannot make the compiler output the code
you are seeing.
Later,
David S. Miller
davem@dm.cobaltmicro.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problem with unsigned long long on ultrasparc
1998-08-20 16:17 ` David S. Miller
@ 1998-08-20 16:55 ` Brad Lucier
1998-08-20 16:55 ` David S. Miller
1998-08-23 15:33 ` Todd Vierling
0 siblings, 2 replies; 12+ messages in thread
From: Brad Lucier @ 1998-08-20 16:55 UTC (permalink / raw)
To: David S. Miller; +Cc: lucier, egcs-bugs, feeley, staff
> Two things, -1 is an int not a long long (although does GCC promote it
> to a long long in this case?),
Yes, it does seem to promote it; I printed out the two values
as unsigned long longs in order to check this.
> secondarily setting cpu type to
> ultrasparc is an error on Solaris-2.5, perhaps you meant
> "-mtune=ultrasparc". "-mcpu=ultrasparc" turns on the V9 instructions
> in the compiler which won't work correctly in all cases on Solaris-2.5
> since it is not providing a 64-bit userland environment for the cpu.
It is important to me to use 32 double-precision floating-point registers
for some of my codes; does -mtume=ultrasparc provide this?
>
> "-mtune=ultrasparc" on the other hand turns on scheduling and cost
> parameters independent of the instruction ISA being used.
>
> Later,
> David S. Miller
> davem@dm.cobaltmicro.com
>
The bottom line for me is that egcs-1.0.3a provides this functionality
and the current egcs-1.1 does not. I consider this a new problem, i.e.,
a bug, not a feature, or at least a change. I'd like somebody to
look at the assembly code that's generated to see if it's correct.
If it is, I'll crawl back into my hole and wait until Sun comes out
with a version of Solaris that's truly 64-bit..
For informational purposes, I'm including the assembly language output
for this routine from egcs-1.0.3a and the 19980816 snapshot of egcs.
I forgot to mention in my first message that I built egcs with
--haifa-enabled in both cases.
Brad Lucier lucier@math.purdue.edu
.file "testlong.c"
! GNU C version egcs-2.90.29 980515 (egcs-1.0.3 release) (sparc-sun-solaris2.5.1) compiled by GNU C version egcs-2.90.29 980515 (egcs-1.0.3 release).
! options passed: -mcpu=ultrasparc -O1
! options enabled: -fdefer-pop -fomit-frame-pointer -fthread-jumps
! -fpeephole -ffunction-cse -finline -fkeep-static-consts
! -fpcc-struct-return -fdelayed-branch -fsched-interblock -fsched-spec
! -fcommon -fverbose-asm -fgnu-linker -falias-check -fargument-alias
! -mepilogue -mapp-regs -mcpu=ultrasparc
gcc2_compiled.:
.section ".rodata"
.align 8
.LLC0:
.asciz "%ull\n"
.align 8
.LLC1:
.asciz "Problem\n"
.align 8
.LLC2:
.asciz "OK\n"
.section ".text"
.align 32
.global main
.type main,#function
.proc 04
main:
!#PROLOGUE# 0
save %sp,-192,%sp
!#PROLOGUE# 1
mov -1,%o0
mov -1,%o1
std %o0,[%fp-96]
sethi %hi(.LLC0),%l0
mov -1,%o1
mov -1,%o2
call printf,0
or %l0,%lo(.LLC0),%o0
or %l0,%lo(.LLC0),%o0
sethi %hi(0),%o2
sethi %hi(-2147483648),%o1
call printf,0
or %o2,%lo(0),%o2
ld [%fp-96],%o1
sethi %hi(2147483647),%o0
or %o0,%lo(2147483647),%o0
cmp %o1,%o0
bgu %icc,.LL2
sethi %hi(.LLC1),%o0
b .LL5
or %o0,%lo(.LLC1),%o0
.LL2:
sethi %hi(.LLC2),%o0
or %o0,%lo(.LLC2),%o0
.LL5:
call printf,0
nop
ret
restore
.LLfe1:
.size main,.LLfe1-main
.ident "GCC: (GNU) egcs-2.90.29 980515 (egcs-1.0.3 release)"
with the 19980816 egcs snapshot:
.file "testlong.c"
gcc2_compiled.:
.section ".rodata"
.align 8
.LLC0:
.asciz "%ull\n"
.align 8
.LLC1:
.asciz "Problem\n"
.align 8
.LLC2:
.asciz "OK\n"
.section ".text"
.align 32
.global main
.type main,#function
.proc 04
main:
!#PROLOGUE# 0
save %sp,-192,%sp
!#PROLOGUE# 1
mov -1,%o0
mov -1,%o1
st %o0,[%fp-96]
st %o1,[%fp-92]
sethi %hi(.LLC0),%l0
mov -1,%o1
mov -1,%o2
call printf,0
or %l0,%lo(.LLC0),%o0
sethi %hi(-2147483648),%o1
mov 0,%o2
call printf,0
or %l0,%lo(.LLC0),%o0
ld [%fp-96],%o2
ld [%fp-92],%o3
sethi %hi(2147483647),%o0
or %o0,%lo(2147483647),%o0
mov -1,%o1
sllx %o2,32,%o4
sllx %o0,32,%o5
or %o3,%o4,%o4
or %o1,%o5,%o5
cmp %o4,%o5
bgu %xcc,.LL2
sethi %hi(.LLC1),%o0
b .LL4
or %o0,%lo(.LLC1),%o0
.LL2:
sethi %hi(.LLC2),%o0
or %o0,%lo(.LLC2),%o0
.LL4:
call printf,0
nop
return %i7+8
nop
.LLfe1:
.size main,.LLfe1-main
.ident "GCC: (GNU) egcs-2.91.54 19980816 (gcc2 ss-980609 experimental)"
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problem with unsigned long long on ultrasparc
1998-08-20 16:55 ` Brad Lucier
@ 1998-08-20 16:55 ` David S. Miller
1998-08-23 15:33 ` Todd Vierling
1 sibling, 0 replies; 12+ messages in thread
From: David S. Miller @ 1998-08-20 16:55 UTC (permalink / raw)
To: lucier; +Cc: lucier, egcs-bugs, feeley, staff
From: Brad Lucier <lucier@math.purdue.edu>
Date: Thu, 20 Aug 1998 18:51:17 -0500 (EST)
It is important to me to use 32 double-precision floating-point registers
for some of my codes; does -mtume=ultrasparc provide this?
It should.
The bottom line for me is that egcs-1.0.3a provides this functionality
and the current egcs-1.1 does not.
Ok it does look like a bug, thanks for reporting it. I'll work on a
fix.
Later,
David S. Miller
davem@dm.cobaltmicro.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problem with unsigned long long on ultrasparc
1998-08-20 14:22 Brad Lucier
@ 1998-08-20 16:17 ` David S. Miller
1998-08-20 16:55 ` Brad Lucier
1998-08-20 18:26 ` David S. Miller
1999-02-28 23:30 ` Jeffrey A Law
2 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 1998-08-20 16:17 UTC (permalink / raw)
To: lucier; +Cc: egcs-bugs, lucier, feeley, staff
Date: Thu, 20 Aug 1998 16:22:03 -0500 (EST)
From: Brad Lucier <lucier@math.purdue.edu>
but
peano-27% gcc -O1 -mcpu=ultrasparc -o testlong testlong.c
peano-28% testlong
4294967295ll
2147483648ll
Problem
Two things, -1 is an int not a long long (although does GCC promote it
to a long long in this case?), secondarily setting cpu type to
ultrasparc is an error on Solaris-2.5, perhaps you meant
"-mtune=ultrasparc". "-mcpu=ultrasparc" turns on the V9 instructions
in the compiler which won't work correctly in all cases on Solaris-2.5
since it is not providing a 64-bit userland environment for the cpu.
"-mtune=ultrasparc" on the other hand turns on scheduling and cost
parameters independent of the instruction ISA being used.
Later,
David S. Miller
davem@dm.cobaltmicro.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* Problem with unsigned long long on ultrasparc
@ 1998-08-20 14:22 Brad Lucier
1998-08-20 16:17 ` David S. Miller
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Brad Lucier @ 1998-08-20 14:22 UTC (permalink / raw)
To: egcs-bugs; +Cc: lucier, feeley, staff
Here's a simple program:
#include <stdlib.h>
#include <stdio.h>
int main() {
unsigned long long a[10];
#define BASE_DIV_2 (((unsigned long long) 1) << 63)
a[0] = -1;
printf("%ull\n", a[0]);
printf("%ull\n", BASE_DIV_2);
if (a[0] < BASE_DIV_2)
printf("Problem\n");
else
printf("OK\n");
}
With this version of gcc:
peano-30% gcc -v
Reading specs from /opt/egcs-19980816/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.54/specs
gcc version egcs-2.91.54 19980816 (gcc2 ss-980609 experimental)
I get:
peano-31% gcc -O1 -o testlong testlong.c
peano-32% testlong
4294967295ll
2147483648ll
OK
but
peano-27% gcc -O1 -mcpu=ultrasparc -o testlong testlong.c
peano-28% testlong
4294967295ll
2147483648ll
Problem
This is on Solaris 2.5.1.
Brad Lucier lucier@math.purdue.edu
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~1999-02-28 23:30 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-21 11:04 Problem with unsigned long long on ultrasparc Brad Lucier
-- strict thread matches above, loose matches on Subject: below --
1998-08-20 14:22 Brad Lucier
1998-08-20 16:17 ` David S. Miller
1998-08-20 16:55 ` Brad Lucier
1998-08-20 16:55 ` David S. Miller
1998-08-23 15:33 ` Todd Vierling
1998-08-20 18:26 ` David S. Miller
1998-08-20 23:55 ` Brad Lucier
1998-08-20 23:55 ` David S. Miller
1998-08-21 3:05 ` Brad Lucier
1998-08-21 1:34 ` David S. Miller
1999-02-28 23:30 ` Jeffrey A Law
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).