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

Error due to unhandled {} type #16

Closed
yjh0502 opened this issue May 25, 2011 · 6 comments
Closed

Error due to unhandled {} type #16

yjh0502 opened this issue May 25, 2011 · 6 comments

Comments

@yjh0502
Copy link

yjh0502 commented May 25, 2011

Input:

#include <cstdio>
#include <list>
#include <string>

using namespace std;

int main(void) {
        list<string> string_list;
        string_list.push_back("hello");

        printf("%d\n", string_list.size());

        return 0;
}

Output:

intertyper.js:137: TypeError: Cannot read property 'text' of undefined
  while (tokens[openBrace].text != '{') openBrace --;
@kripken
Copy link
Member

kripken commented May 26, 2011

I don't get that error, with either clang or llvm_gcc. For me it compiles ok, but fails at runtime due to missing stdc++ stuff (__ZNSaIcEC1Ev).

Can you paste the .ll file that is generated for you?

@yjh0502
Copy link
Author

yjh0502 commented May 26, 2011

I uploaded it to my server because the .ll file is a little big.

http://desti.ruree.net/main.o.ll

@kripken
Copy link
Member

kripken commented May 27, 2011

It's failing on

define linkonce_odr {} @ZSt19__iterator_categoryISt20_List_const_iteratorISsEENSt15iterator_traitsIT_E17iterator_categoryERKS3(%"struct.std::_List_const_iterator<std::basic_string<char, std::char_traits, std::allocator > >"* %unnamed_arg) nounwind inlinehint {

because of that {}. I don't know what {} means - an anonymous empty structure? An opaque value perhaps? The LLVM language reference doesn't explain that, that I can see.

Would help to see the source that compiled into this. But it's probably buried in some libc++ header somewhere.

What platform are you building on? And what exact command did you use to generate the LLVM?

@yjh0502
Copy link
Author

yjh0502 commented May 27, 2011

llvm-g++ -emit-llvm main.cpp -c
llvm-dis -show-annotations main.o

I'm now on ubuntu 11.04, with llvm-g++ 4.2.1, llvm 2.8

@kripken
Copy link
Member

kripken commented May 30, 2011

Not sure why I am seeing different results, then.

In any case, this code can't work since it relies on libc++ stuff which emscripten doesn't have. One way to get it to work is to compile it together with libc++, then it would also be possible to understand why it fails here.

@kripken
Copy link
Member

kripken commented Jul 12, 2012

This works for me and should work the same everywhere using our bundled headers and other fixes since last year. Please comment if not.

@kripken kripken closed this as completed Jul 12, 2012
tlively pushed a commit to tlively/emscripten that referenced this issue Mar 23, 2022
Fix early syscall use by adding a Clang attribute.
steveisok pushed a commit to steveisok/emscripten that referenced this issue Sep 18, 2023
…817.3 (emscripten-core#16)

[dotnet/release/8.0] Update dependencies from dotnet/arcade
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