Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pointer to record broken #87

Open
norayr opened this issue May 11, 2020 · 0 comments
Open

pointer to record broken #87

norayr opened this issue May 11, 2020 · 0 comments

Comments

@norayr
Copy link
Member

norayr commented May 11, 2020

MODULE test;
TYPE
  something* = POINTER TO RECORD
    length-: LONGINT; (* current length of string excluding 0X *)
    bufferSize: LONGINT; (* {bufferSize >= InitialSize} *)
  END;

END test.
MODULE test2;
IMPORT test;
VAR
  s: test.something;
BEGIN
NEW(s);
END test2.

NEW generates wrong code here, so

 $ voc -s test.Mod test2.Mod -m
test.Mod  Compiling test.  New symbol file.  471 chars.
test2.Mod  Compiling test2.  Main program.  453 chars.
In file included from test2.c:8:
test2.c: In function ‘main’:
test2.c:29:17: error: ‘test2__1__typ’ undeclared (first use in this function); did you mean ‘test__1__typ’?
   29 |  __NEW(test2_s, test2__1);
      |                 ^~~~~~~~
/opt/voc/2/include/SYSTEM.h:280:51: note: in definition of macro ‘__NEW’
  280 | #define __NEW(p, t)      p = Heap_NEWREC((ADDRESS)t##__typ)
      |                                                   ^
test2.c:29:17: note: each undeclared identifier is reported only once for each function it appears in
   29 |  __NEW(test2_s, test2__1);
      |                 ^~~~~~~~
/opt/voc/2/include/SYSTEM.h:280:51: note: in definition of macro ‘__NEW’
  280 | #define __NEW(p, t)      p = Heap_NEWREC((ADDRESS)t##__typ)
      |                                                   ^
C compile and link: gcc -fPIC -g -I "/opt/voc/2/include"  test2.c  test.o -o test2 -L"/opt/voc/lib" -lvoc-O2
-- failed: status 0, exitcode 1.
Terminated by Halt(1).

the workaround is using POINTER TO somethingDesc and then having somethingDesc to be the same as POINTER TO RECORD now.

still, this is a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant