Previous mail
Next mail
Unformatted/full headers
Overview 10 days
Subject
Date
Thread
Author
From: Mirsad Todorovac
Subject: Question Re: predef.h
Date: 20 Feb 2006, 15:38:37
Thanks, Frank,
On Mon, 20 Feb 2006, Frank Heckenbach wrote:
> Mirsad Todorovac wrote:
>
>> NOW; I was asked from GCC team whether the RotateLeft/RotateRight bug is
>> still present in their middle-end/back-end, and I am unable to tell
>> without trying to recompile implementation attempt in PASCAL with newest
>> backend (3.4.5, as it seem that GPC still does not support 4.0.2 :-(
>
> No, it doesn't yet. That's kind of a FAQ here ...
Yes, I realize there must be problems here, but I ma certain the Team is
more than able to keep up with the task :-)
>> I am not sure if the mechanism of definition of primitives is the same as
>> the previous one in predef.h, so I am asking because you of course know
>> more.
>
> Yes, it's the same. The file was just renamed because it really
> isn't a C header file (similar to other files such as tree.def in
> the backend).
Now, I was digging into it, and the new version keep complaining about the
invalid operands to RotateLeft/RotateRight when argument is even a ''Byte''
The predef.def lines look like (inherited from Pred/Succ, and worked
before, in 2003 versions):
PREDEF_ROUTINE (RotateLeft, "xv,r|", ER_CONST, GNU_PASCAL)
PREDEF_ROUTINE (RotateRight, "xv,r|", ER_CONST, GNU_PASCAL)
In fact, I was going through the source quite a bit before and now, and I
still can't seem to catch all the tricks of this "signature" string ...
Essentially, the implementation is simple as LROTATE_EXPR and RROTATE_EXPR
are supported by the backend already:
I see that now build_binary_op is depracated and abandoned in favor of
build_pascal_binary_op. Is that the problem (also build_binary_op has
misteriously lost last (default 0) argument).
Any help with this? Thank you!
Mirsad
P.S: Here is the implementation attempt:
-----
case p_RotateLeft:
case p_RotateRight:
{
int left = (r_num == p_RotateLeft);
int precision = TYPE_PRECISION (type);
tree precision_node = build_int_2 (precision, 0);
if (code == REAL_TYPE)
error ("argument 1 of `%s' must be of integer type", r_name);
else if (code2 == REAL_TYPE)
error ("argument 2 of `%s' must be of integer type", r_name);
if (argcount == 1)
val2 = integer_one_node;
else
val2 = build_binary_op (TRUNC_MOD_EXPR, val2, precision_node);
retval = convert (type, build_binary_op (left ? LROTATE_EXPR : RROTATE_EXPR, val, val2));
}
break;
And the demo breaks:
mtodorov@domac:~/rotltest$ cat rotl_bb.pas
program rotlnnn (output);
var i0, i: Byte;
j: Byte;
begin
i0 := 1;
j := BitSizeof (i0) + 1;
i := RotateLeft (i0, j);
if i <> RotateLeft (i0, 1) then
WriteLn ('failed : i: Byte = 1; j: Byte = ', j, '; RotateLeft(i, j) = ', i)
else
WriteLn ('OK')
end.
mtodorov@domac:~/rotltest$ gpc rotl_bb.pas
rotl_bb.pas: In main program:
rotl_bb.pas:13: error: invalid operands to `RotateLeft'
rotl_bb.pas:14: error: invalid operands to `RotateLeft'
mtodorov@domac:~/rotltest$
Previous mail
Next mail
Unformatted/full headers
Overview 10 days
Subject
Date
Thread
Author
| Author | Subject | Date |
|---|---|---|
| Frank Heckenbach | Question Re: predef.h | 21 Feb 2006, 03:58:16 |
| Author | Subject | Date |
|---|---|---|
| Mirsad Todorovac | Question Re: predef.h | 20 Feb 2006, 14:29:56 |
| Frank Heckenbach | Question Re: predef.h | 20 Feb 2006, 14:49:26 |
Note: This page contains information that does not originate from the owner of this web site, but from the authors of the mails archived. The owner of this web site is not responsible for the content of such information. Any use of that infomation requires the consent of the respective author.
Where WWW addresses (URLs) in the mails archived are marked as hyperlinks, this is only for the comfort of the reader. The content of the web pages linked to like this does not necessarily reflect the opinion of the owner of this web site or of the authors of the mails archived. The owner of this web site is not responsible for the content of such web pages. Those pages are explicitly not to be considered as part of the content of this page, but merely as references.
This page was created by Crystal 0.999 (Linux 2.4.27/i686).