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

Build failure on PPC: parser_stype.h: error: static assertion failed: the comparison reduces to '(16 == 12)' #2460

Closed
barracuda156 opened this issue Jan 10, 2024 · 4 comments · Fixed by #2463

Comments

@barracuda156
Copy link
Contributor

This is likely due to 32-bitness of the arch or possibly something specific to ppc. I have no i386 set-up at hand to compare.

In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_lpython/lpython/work/lpython-0.20.0/src/lpython/parser/tokenizer.h:6,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_lpython/lpython/work/lpython-0.20.0/src/lpython/parser/parser.h:6,
                 from parser.yy:24,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_lpython/lpython/work/lpython-0.20.0/src/lpython/parser/parser.tab.cc:91:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_lpython/lpython/work/lpython-0.20.0/src/lpython/parser/parser_stype.h:115:31: error: static assertion failed
  115 | static_assert(sizeof(YYSTYPE) == sizeof(Vec<LPython::AST::ast_t*>));
      |               ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_lpython/lpython/work/lpython-0.20.0/src/lpython/parser/parser_stype.h:115:31: note: the comparison reduces to '(16 == 12)'
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_lpython/lpython/work/lpython-0.20.0/src/lpython/parser/tokenizer.h:6,
                 from tokenizer.re:4:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_lpython/lpython/work/lpython-0.20.0/src/lpython/parser/parser_stype.h:115:31: error: static assertion failed
  115 | static_assert(sizeof(YYSTYPE) == sizeof(Vec<LPython::AST::ast_t*>));
      |               ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_lpython/lpython/work/lpython-0.20.0/src/lpython/parser/parser_stype.h:115:31: note: the comparison reduces to '(16 == 12)'
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_lpython/lpython/work/lpython-0.20.0/src/lpython/parser/tokenizer.h:6,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_lpython/lpython/work/lpython-0.20.0/src/lpython/parser/parser.h:6,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_lpython/lpython/work/lpython-0.20.0/src/lpython/parser/parser.cpp:7:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_lpython/lpython/work/lpython-0.20.0/src/lpython/parser/parser_stype.h:115:31: error: static assertion failed
  115 | static_assert(sizeof(YYSTYPE) == sizeof(Vec<LPython::AST::ast_t*>));
      |               ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_lpython/lpython/work/lpython-0.20.0/src/lpython/parser/parser_stype.h:115:31: note: the comparison reduces to '(16 == 12)'
@barracuda156
Copy link
Contributor Author

@certik Not sure if this is a problem or an arch specifics, but with this static assert commented out plus two minor fixes – #2459 and #2461lpython builds fine for me on ppc.

There is no support for powerpc assembler in the code, so I do not know to what extent it will be usable, but it builds :)

@barracuda156
Copy link
Contributor Author

If this is of little concern (i.e. the code still gonna work, just slower), then something like this allows it to build: barracuda156@8ad2ce3

@certik
Copy link
Contributor

certik commented Jan 10, 2024

The fix at barracuda156@8ad2ce3 is fine. This is just a performance problem in parsing --- when the node is bigger than necessary (the AST node, 12 bytes in this case), we are wasting memory and copying too much, but there are no functional issues, just slightly slower performance of parsing.

@barracuda156
Copy link
Contributor Author

@certik Great, then I can make a PR for this.

barracuda156 added a commit to barracuda156/lpython that referenced this issue Jan 11, 2024
Agent-Hellboy pushed a commit to Agent-Hellboy/lpython that referenced this issue Mar 5, 2024
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

Successfully merging a pull request may close this issue.

2 participants