GNU Pascal Homepage - gpc - gpc-announce - gpc-de - gpc-doc
This page in English

Mail #13282

Zurück zur Archiv-Hauptseite

Vorige Mail   Nächste Mail   Unformatiert/Volle Header
Übersicht  10 Tage   Betreff   Datum   Thread   Autor  

Von: Mirsad Todorovac
Betreff: Question Re: predef.h
Datum: 20.2.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$




Vorige Mail   Nächste Mail   Unformatiert/Volle Header
Übersicht  10 Tage   Betreff   Datum   Thread   Autor  


Antworten auf diese Mail

Autor Betreff Datum
Frank Heckenbach Question Re: predef.h 21.2.2006, 03:58:16

Antwort auf

Autor Betreff Datum
Mirsad Todorovac Question Re: predef.h 20.2.2006, 14:29:56
Frank Heckenbach Question Re: predef.h 20.2.2006, 14:49:26

Zurück zur Archiv-Hauptseite


Hinweis: Diese Seite enthält Informationen, die nicht vom Betreiber dieser Website, sondern von den Autoren der archivierten Mails stammen. Der Betreiber dieser Website ist nicht für den Inhalt dieser Informationen verantwortlich. Die weitere Verwendung dieser Informationen bedarf des Einverständnisses des jeweiligen Autors.

Sofern WWW-Adressen (URLs) in den archivierten Mails als Hyperlinks hervorgehoben werden, so geschieht dies ausschließlich zur Annehmlichkeit für den Leser. Der Inhalt der auf diese Weise angelinkten Webseiten spiegelt nicht notwendigerweise die Meinung des Betreibers dieser Webseite oder der Autoren der archivierten Mails wider. Der Betreiber dieser Webseite ist nicht für den Inhalt solcher Webseiten verantwortlich. Diese Seiten sind ausdrücklich nicht als Teil des Inhalts dieser Seite zu betrachten, sondern lediglich als Referenzen.


Diese Seite wurde erzeugt von Crystal 0.999 (Linux 2.4.27/i686).