gcc-bugs: gcc-3.0 pre, problems with _Bool arguments on stack-up
John David Anglin
dave@hiauly1.hia.nrc.ca
Fri Jun 1 11:56:00 GMT 2001
> Dave, I put this in as PR 2782.
> < http://gcc.gnu.org/ml/gcc-bugs/2001-05/msg00230.html >
> Since I still haven't done the work to understand RTL though I think I've
> understood the assembler I was hoping you could have a look. Jeff seems
> to be off the air.
> Toon Moene in < http://gcc.gnu.org/ml/gcc/2001-05/msg01018.html >
> has put it up to a high priority and at least for Fortran it is a
> regression from 2.95.[23].
As you found, this is a C problem with respect to passing of _Bool
arguments on the stack on the PA. Although this was all in your
various reports, there was some impression that this was a Fortran
related bug. Here is a simpler testcase that demonstrates the problem:
#include <stdbool.h>
int f (int a, int b, int c, _Bool d, _Bool e, _Bool f, char g)
{
if (g != 1 || d != true || e != true || f != true) abort ();
return a + b + c;
}
main ()
{
exit (f (1, 2, -3, true, true, true, '\001'));
}
The char argument of f is there for comparison with the _Bool arguments.
Here is the assembler code showing the argument saves to the frame and
the `if':
stw %r26,-36(%r3)
stw %r25,-40(%r3)
stw %r24,-44(%r3)
stb %r23,-48(%r3)
ldw -60(%r3),%r19 <== argument `g'
stb %r19,8(%r3)
.stabn 68,0,5,L$M2-f
L$M2:
ldb 8(%r3),%r19
extrs %r19,31,8,%r19
comib,<>,n 1,%r19,L$0003
ldb -48(%r3),%r19
comib,<>,n 1,%r19,L$0003
ldb -52(%r3),%r19 <== argument `e'
comib,<>,n 1,%r19,L$0003 <== branches to abort
ldb -56(%r3),%r19
comib,<>,n 1,%r19,L$0003
b,n L$0002
L$0003
.CALL
bl abort,%r2
nop
L$0002
The PA defines PROMOTE_PROTOTYPES and PROMOTE_MODE. The arguments e, f
and g are placed on the stack as words as follows:
ldi 1,%r19
stw %r19,-52(%r30)
stw %r19,-56(%r30)
stw %r19,-60(%r30)
This seems ok to me. It looks like _Bool arguments are not being
demoted properly after being passed on the stack. I believe this is
what you had concluded.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
More information about the Gcc-bugs
mailing list