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

Internal compiler error #86

Closed
raoulh opened this issue Mar 3, 2017 · 21 comments
Closed

Internal compiler error #86

raoulh opened this issue Mar 3, 2017 · 21 comments

Comments

@raoulh
Copy link
Contributor

raoulh commented Mar 3, 2017

Hi,

When build on a fresh ubuntu 16.04 that uses gcc 5.4.0, compiler crashes with the following:

uvw/src/uvw/process.hpp:235:49: internal compiler error: in tsubst_copy, at cp/pt.c:13217
         container.data.stream = get<uv_stream_t>(stream);
                                                 ^
Please submit a full bug report,
with preprocessed source if appropriate.

Any ideas on this one?

@skypjack
Copy link
Owner

skypjack commented Mar 3, 2017

I think it doesn't fully support C++14 features (as requested by uvw), so unlikely you'll be able to use it with the library. That being said, an ICE is something you should report to the bugzilla of the compiler. :-)

@skypjack
Copy link
Owner

skypjack commented Mar 7, 2017

@raoulh I would close the issue, unfortunately I cannot do that much against an ICE of GCC.
Is it fine for you? Do you have any update? Thank you.

@skypjack
Copy link
Owner

skypjack commented Mar 9, 2017

Tested with GCC5 on Debian:

gcc version 5.4.1 20170304 (Debian 5.4.1-8)

It works just fine. The ICE is an issue of the compiler and it has been fixed with the next patch release.

I'm closing the issue, for I don't know how to solve such kind of problems of another software by modifying uvw. Feel free to submit a PR if you want to suggest a workaround.

@skypjack skypjack closed this as completed Mar 9, 2017
@raoulh
Copy link
Contributor Author

raoulh commented Mar 10, 2017

Ok, i did some more trial, and you are true, with gcc 5.4.1 it woks.
Also clang3.8 from ubuntu 16.04 is working too.
Too bad that ubuntu is keeping gcc 5.4.0 ..... :-/

@skypjack
Copy link
Owner

Isn't possible to update it from the repository? It's quite an old version indeed. GCC7 is almost ready nowadays.
Otherwise, even if it takes a while, you can still recompile it (or cross-compile it if needed).
I'm sorry it doesn't work and you know I'm doing my best to accommodate any request, but it's hard to deal with an ICE of a compiler, for I don't know really what's wrong with it internally.

@raoulh
Copy link
Contributor Author

raoulh commented Mar 10, 2017

Don't worry, it was only a question to see if you had any ideas :)
For me it's not a real problem as gcc5.4.0 is too old (and i'm not using ubuntu anyways). It was a question from one of our users. I will tell him to update and that's it. The next LTS from ubuntu will probably be out in april anyway.
Thanks a lot for all your answers!

@skypjack
Copy link
Owner

You're welcome, as usual. ;-)

@raoulh
Copy link
Contributor Author

raoulh commented Aug 17, 2017

Hi,
About this issue, I just found out that a workaround for that ICE could be to write this:
container.data.stream = this->template get<uv_stream_t>(stream);

The code is now building fine. Also I checked in the code and this is also written like that at other places in uvw.
What do you think?

@skypjack
Copy link
Owner

It isn't a dependent name, so it's not required. Anyway, if it works both with GCC 5.4.0 and all the other supported compilers, that's not a big problem to use it.
I'm on vacation right now, I cannot test it. Did you try the whole test suite with GCC 5.4.0 after the change? Was that the sole problem?
We could add it to Travis if we want to fully support that version.

@raoulh
Copy link
Contributor Author

raoulh commented Aug 17, 2017

Actually I tried with gcc 5.4.0, 5.4.1 and it ICE (on ubuntu). The test suite does not report any error or problem though, because the test for Process is not implemented. But I found a test case where it appears:

#include <gtest/gtest.h>
#include <uvw.hpp>

TEST(Process, TODO) {
    auto loop = uvw::Loop::getDefault();
    auto handle = uvw::ProcessHandle::create(loop);
    auto pipe = loop->resource<uvw::PipeHandle>();

    uv_stdio_flags f = (uv_stdio_flags)(UV_CREATE_PIPE | UV_READABLE_PIPE);
    uvw::Flags<uvw::ProcessHandle::StdIO> flags(f);
    handle->stdio(*pipe, flags);

    handle = nullptr;

    // TODO
}

@skypjack
Copy link
Owner

Well, as we already agreed on, that version is too old and it doesn't worth it to adapt the code for it. C++17 is coming out, we cannot imagine to fully support compilers that doesn't even support C++14 nowadays.
I'm at your disposal if you find a dirty and working way to make it running anyway.

@raoulh
Copy link
Contributor Author

raoulh commented Aug 18, 2017

I think it's not only a problem with old GCC...

I did some more testing using my small test case. This is with gcc 7.1.1 20170516 from archlinux:

[ 69%] Built target file_req
In file included from /home/raoul/work/uvw/src/uvw.hpp:13:0,
                 from /home/raoul/work/uvw/test/uvw/process.cpp:2:
/home/raoul/work/uvw/src/uvw/process.hpp: In instantiation of ‘uvw::ProcessHandle& uvw::ProcessHandle::stdio(uvw::StreamHandle<T, U>&, uvw::Flags<uvw::details::UVStdIOFlags>) [with T = uvw::PipeHandle; U = uv_pipe_s]’:
/home/raoul/work/uvw/test/uvw/process.cpp:13:31:   required from here
/home/raoul/work/uvw/src/uvw/process.hpp:238:33: internal compiler error: in tsubst_copy, at cp/pt.c:14634
         container.data.stream = get<uv_stream_t>(stream);
                                 ^~~~~~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.

I also tried using another gcc (and newer) 7.1.1 20170630 also from archlinux:

Scanning dependencies of target process
[ 64%] Building CXX object test/CMakeFiles/process.dir/uvw/process.cpp.o
In file included from /home/raoul/work/uvw/src/uvw.hpp:13:0,
                 from /home/raoul/work/uvw/test/uvw/process.cpp:2:
/home/raoul/work/uvw/src/uvw/process.hpp: In instantiation of ‘uvw::ProcessHandle& uvw::ProcessHandle::stdio(uvw::StreamHandle<T, U>&, uvw::Flags<uvw::details::UVStdIOFlags>) [with T = uvw::PipeHandle; U = uv_pipe_s]’:
/home/raoul/work/uvw/test/uvw/process.cpp:13:31:   required from here
/home/raoul/work/uvw/src/uvw/process.hpp:238:31: error: no matching function for call to ‘uvw::ProcessHandle::get<uv_stream_t>(uvw::StreamHandle<uvw::PipeHandle, uv_pipe_s>&)’
         container.data.stream = get<uv_stream_t>(stream);
In file included from /home/raoul/work/uvw/src/uvw/resource.hpp:7:0,
                 from /home/raoul/work/uvw/src/uvw/handle.hpp:8,
                 from /home/raoul/work/uvw/src/uvw/async.hpp:7,
                 from /home/raoul/work/uvw/src/uvw.hpp:1,
                 from /home/raoul/work/uvw/test/uvw/process.cpp:2:
/home/raoul/work/uvw/src/uvw/underlying_type.hpp:32:10: note: candidate: template<class R> auto uvw::UnderlyingType<T, U>::get() [with R = R; T = uvw::ProcessHandle; U = uv_process_s]
     auto get() noexcept {
          ^~~
/home/raoul/work/uvw/src/uvw/underlying_type.hpp:32:10: note:   template argument deduction/substitution failed:
In file included from /home/raoul/work/uvw/src/uvw.hpp:13:0,
                 from /home/raoul/work/uvw/test/uvw/process.cpp:2:
/home/raoul/work/uvw/src/uvw/process.hpp:238:31: note:   candidate expects 0 arguments, 1 provided
         container.data.stream = get<uv_stream_t>(stream);
In file included from /home/raoul/work/uvw/src/uvw/resource.hpp:7:0,
                 from /home/raoul/work/uvw/src/uvw/handle.hpp:8,
                 from /home/raoul/work/uvw/src/uvw/async.hpp:7,
                 from /home/raoul/work/uvw/src/uvw.hpp:1,
                 from /home/raoul/work/uvw/test/uvw/process.cpp:2:
/home/raoul/work/uvw/src/uvw/underlying_type.hpp:38:10: note: candidate: template<class R> auto uvw::UnderlyingType<T, U>::get() const [with R = R; T = uvw::ProcessHandle; U = uv_process_s]
     auto get() const noexcept {
          ^~~
/home/raoul/work/uvw/src/uvw/underlying_type.hpp:38:10: note:   template argument deduction/substitution failed:
In file included from /home/raoul/work/uvw/src/uvw.hpp:13:0,
                 from /home/raoul/work/uvw/test/uvw/process.cpp:2:
/home/raoul/work/uvw/src/uvw/process.hpp:238:31: note:   candidate expects 0 arguments, 1 provided
         container.data.stream = get<uv_stream_t>(stream);

It clearly shows that there is an issue somewhere...
I also suggest that you add my small test case in your test suite.

@raoulh
Copy link
Contributor Author

raoulh commented Aug 18, 2017

Actually there is 2 issues here:

  • get() does not take a parameter so this line is wrong:
    container.data.stream = get<uv_stream_t>(stream);
  • the ICE from different compilers can be avoided by using
    container.data.stream = this->template get<uv_stream_t>()

@skypjack
Copy link
Owner

Found the problem.
That's because of PR #94 that accidentally removed friend declaration and get member functions.
Probably the first point just disappears by putting back in the UnderlyingType class those stuff.

Can you have a try? I'm on vacation, I can't test it until today evening.
Otherwise feel free to open an issue and mention this comment. I'll fix it as soon as possible.
Meanwhile I'll ping the user that made the PR. We must pay more attention. My fault.

@skypjack
Copy link
Owner

See #98 to track the issue. We can continue the discussion there.
Feel free to propose the test you mentioned as a comment to the issue, so that I can add it to the test suite and be sure everything is fixed.
Thank you.

@skypjack
Copy link
Owner

skypjack commented Aug 18, 2017

@raoulh Ok, fixed UnderlyingType and now get<uv_stream_t>(stream) works just fine.
I added your test to the test suite and I plan to add more tests for ProcessHandle as soon as possible.
The only issue probably still open regards the following line:

container.data.stream = this->template get<uv_stream_t>()

I didn't put it in my commit for I'm not sure that's the sole problem with GCC 5.4.1.
If you can test everything with it and confirm that it works now (well, at least run the current test suite), feel free to open a PR with that change and I'll accept it.

Also thank you for the lines missed after #94 have been emerged because of your help. Really appreciated.

@evanlabs
Copy link

@raoulh @skypjack

I have the same problem with GCC5.4.0 on CentOS 6.10

Use the method you discussed to temporarily solve it.

container.data.stream = this->template get<uv_stream_t>()

Thank you.

@evanlabs
Copy link

@skypjack
We have a lot of projects using GCC 5.4.0, and upgrading to GCC 7 is a very difficult process, at least for now.

Thank you for this great project.

@ZgblKylin
Copy link

@evanlabs Maybe you cound try this cpp11 branch, it works well even in gcc 4.8.2, and up-to-date with master branch.

@evanlabs
Copy link

@ZgblKylin

I am going to try it, thank you very much.

@skypjack
Copy link
Owner

@evanlabs master branch is kept up-to-date only with the latest revision of the standard (almost at least, I'm still working on the C++17 version because of a lack in time). This is mainly because I'm the sole developer here and the project isn't backed by any company at the moment. Therefore I do everything in my free time and you cannot expect support to reach back C++98/11. Consider also that I'm no longer actively using this library and I put it in a sort of maintenance mode for a while.
That being said, people here are quite willing to help each other, so feel free either to ask or to join the gitter room if you have any question.

We have a lot of projects using GCC 5.4.0, and upgrading to GCC 7 is a very difficult process, at least for now.

I'm glad to know you're using uvw on your projects. Consider supporting the development if possible, it would be really appreciated. 👍

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

4 participants