GithubHelp home page GithubHelp logo

Comments (14)

bradking avatar bradking commented on June 29, 2024 2

I can reproduce the problem with a simple .c source with deeply nested parentheses:

enum E { X = ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+
1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1) };

from castxml.

bradking avatar bradking commented on June 29, 2024 2

On Windows, running just castxml input.c, where input.c contains the deeply nested parentheses mentioned above, is enough to cause the problem.

On Linux, the same call fails with an error "fatal error: bracket nesting level exceeded maximum of 256", but it can be overcome with -fbracket-depth=500. Adding that option on Windows makes no difference.

from castxml.

bradking avatar bradking commented on June 29, 2024

Please strip xbd_win.h down to a minimal complete example input file that demonstrates the problem.

from castxml.

jciena avatar jciena commented on June 29, 2024

I do not see -fbracket-depth option in help. As you mentioned, in windows it makes no difference using it or not.
Should I report to llvm as asked in the error message below?

PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.      Program arguments: castxml.exe --castxml-gccxml -o output.xml --castxml-cc-msvc-c cl .\\input.c -fbracket-depth=1000
1.      .\input.c:1:194: current parser token '('

PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.      Program arguments: castxml.exe --castxml-gccxml -o output.xml --castxml-cc-msvc-c cl .\\input.c
1.      .\input.c:1:194: current parser token '('

from castxml.

bradking avatar bradking commented on June 29, 2024

We need to try building CastXML with the latest LLVM version before reporting it there.

from castxml.

jciena avatar jciena commented on June 29, 2024

I already raised it (link) there, and they suggested:

Could you please try 15 or main branch? https://godbolt.org/ should be helpful.

I will build using the main and test again.

from castxml.

bradking avatar bradking commented on June 29, 2024

Thanks. I think CastXML may need some updates to compile against LLVM/Clang 14 and/or 15. I'll look at that.

from castxml.

jciena avatar jciena commented on June 29, 2024

I appreciate your support.

from castxml.

bradking avatar bradking commented on June 29, 2024

CastXML builds cleanly against LLVM/Clang 14.0. However, the LLVM/Clang release/15.x branch currently has a regression that breaks CastXML. I've reported that as llvm/llvm-project#57483.

from castxml.

bradking avatar bradking commented on June 29, 2024

After hacking the LLVM/Clang 15.x install tree with this patch:

--- include/clang/Lex/Preprocessor.h.orig       2022-08-31 09:24:20.359922800 -0400
+++ include/clang/Lex/Preprocessor.h    2022-08-31 11:55:51.490578400 -0400
@@ -1353,6 +1353,8 @@
   StringRef getLastMacroWithSpelling(SourceLocation Loc,
                                      ArrayRef<TokenValue> Tokens) const;

+  const std::string &getPredefines() const { return Predefines; }
+
   /// Set the predefines for this Preprocessor.
   ///
   /// These predefines are automatically injected when parsing the main file.

then CastXML builds again and all tests pass.

However, the crash discussed here remains. I've got a Debug build, so I'll try to get a backtrace.

from castxml.

bradking avatar bradking commented on June 29, 2024

Clang's internal recursion overflows the stack before reaching the default -fbracket-depth=256 nesting level limit. I've posted more details in llvm/llvm-project#57456 (comment).

from castxml.

bradking avatar bradking commented on June 29, 2024

The problem doesn't occur in LLVM/Clang's own binaries because they are built with a larger stack: llvm/llvm-project#57456 (comment).

CastXML should be built with a larger stack too.

from castxml.

bradking avatar bradking commented on June 29, 2024

I've released CastXML 0.4.6 with this fix.

from castxml.

jciena avatar jciena commented on June 29, 2024

Thank you, I'll check it.
Much appreciated!

from castxml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.