[Fortran, committed to trunk] Fixed powerpc "unsigned" printing of
Toon Moene
toon@moene.indiv.nluug.nl
Sat Apr 13 07:23:00 GMT 2002
[ Moved the gnats and patches mailing list out of the loop ]
I wrote:
>
> John David Anglin wrote:
> > I did a liitle more digging on the pa. It beginning to look like some
> > kind of aliasing problem. It important to note that the test passes
> > at -O0 but not at -O1. At -O0, there are insns that write the i*2
> > values of j and ja to virtual stack slots. However, at -O1, it appears
> > the write for ja is deleted and as a result ka is read from an unitialized
> > slot. I got as far as ffestd_stmt_pass_ in trying to locate the problem.
On the powerpc, it looks slightly different. Here's the smallest
program I could construct that still shows the problem:
integer*2 j
integer*1 k
j = -9
k = j
if (k .ne. j) call abort
print*,j
end
Note the necessity of `print*,j' - if you remove it the abort will not
happen.
Now for the rtl (c.f.00.rtl)
...
(insn 12 10 42 (set (reg:SI 121)
(const_int -9 [0xfffffffffffffff7])) -1 (nil)
(nil))
Wonder why we need a 64-bit constant to set a 32-bit reg
(insn 42 12 43 (set (reg:HI 122)
(subreg:HI (reg:SI 121) 2)) -1 (nil)
(nil))
So far, so good: constant -9 loaded into HI register (j)
(insn 43 42 14 (set (mem/f:HI (reg/f:SI 111 virtual-stack-vars) [0 S2
A8]
(reg:HI 122)) -1 (nil)
(nil))
Store j on stack ? Because of `print*,j' ?
...
(insn 46 15 17 (set (reg:QI 123)
(mem/f:QI (plus:SI (reg/f:SI 111 virtual-stack-vars)
(const_int 3 [0x3])) [0 S1 A8])) -1 (nil)
(nil))
So the byte k is offset 3 away from the memory address
where we stored the short j ? Howzdat ? Shouldn't this
be (const_int 1 ...) (that's what you get when compiling
without -O) ?
...
I get the feeling this isn't a Fortran frontend problem ...
Which optimisation passes run *before* 00.rtl is dumped ? I thought
this was the first thing done ...
Confusedly yours,
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)
More information about the Gcc-bugs
mailing list