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

Null function body not handled #389

Open
mayagokhale opened this issue Feb 13, 2023 · 3 comments
Open

Null function body not handled #389

mayagokhale opened this issue Feb 13, 2023 · 3 comments

Comments

@mayagokhale
Copy link
Collaborator

https://github.com/intel/systemc-compiler/blob/main/designs/tests/method/test_fcall.cpp

globFunc1 has no function body, thus in the function definition hcode, the body is omitted. However, an empty body is not accepted by hcode parser. Should the hcode plugin generate a fake return stmt or should the hcode parser accept a null body?

@zhuanhao-wu
Copy link
Collaborator

I think it suffices to put an empty hcstmt node, specifically something like this:

hCStmt  NONAME NOLIST

mayagokhale added a commit that referenced this issue Feb 14, 2023
@mayagokhale
Copy link
Collaborator Author

fixed in 5c2c1fe

@zhuanhao-wu
Copy link
Collaborator

Currently, a hVardecl is generated within the function body, which should be outside:

      hFunction globFunc1_func_10 [
        hFunctionRetType  NONAME [
          hTypeinfo  NONAME [
            hType void NOLIST
          ]
        ]
        hCStmt  NONAME [
          hVardecl a__local_32 [
            hTypeinfo  NONAME [
              hType int NOLIST
            ]
          ]
          hCStmt  NONAME [
            hVarAssign  NONAME [
              hVarref a__local_32 NOLIST
              hLiteral 0 NOLIST
            ]
          ]
        ]
      ]

It should be

      hFunction globFunc1_func_10 [
        hFunctionRetType  NONAME [
          hTypeinfo  NONAME [
            hType void NOLIST
          ]
        ]
          hVardecl a__local_32 [
            hTypeinfo  NONAME [
              hType int NOLIST
            ]
          ]
        hCStmt  NONAME [

          hCStmt  NONAME [
            hVarAssign  NONAME [
              hVarref a__local_32 NOLIST
              hLiteral 0 NOLIST
            ]
          ]
        ]
      ]

@zhuanhao-wu zhuanhao-wu reopened this Feb 27, 2023
mayagokhale added a commit that referenced this issue Mar 2, 2023
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

2 participants