Opened 9 years ago
Last modified 9 years ago
#3911 accepted defect
Internal compiler error: Segmentation fault
Reported by: | Owned by: | Adrian Pop | |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Code Generation | Version: | |
Keywords: | Cc: |
Description
Below is the text I saw when the compiling failed. This is a fairly large model (took 5 minutes to translate, 3 more to get to this failure point). I cannot provide the model.
WebModel_06inz.c: In function 'WebModel_eqFunction_93667':
WebModel_06inz.c:1299806:1: internal compiler error: Segmentation fault
}
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://sourceforge.net/projects/msys2> for instructions.
<builtin>: recipe for target 'WebModel_06inz.o' failed
\tools\msys\mingw64\bin\mingw32-make: * [WebModel_06inz.o] Error 1
Compilation process failed. Exited with code 2.
Change History (16)
comment:1 by , 9 years ago
Component: | *unknown* → Code Generation |
---|---|
Owner: | changed from | to
comment:2 by , 9 years ago
I don't have a Linux machine to run it on. I should have plenty of memory available - It goes up to 4.2GB of RAM usage - I have much more than that available. I also told it to use just one core, both with the flag you mentioned and with the box on the General options tab.
comment:3 by , 9 years ago
I just tried to run it with command line, and I get:
internal compiler error: Segmentation fault
in addition to the previous errors mentioned above. I don't know if that helps.
comment:4 by , 9 years ago
Unfortunately it doesn't help. Any insight on how the C function where the GCC compiler has issues looks like? I know you cannot share your model but maybe you can send me the generated C code for the model privately so I can check where the problem is and then delete it.
Let me know if this is acceptable for you.
comment:5 by , 9 years ago
I appreciate you being willing to work with me that way, but unfortunately I cannot share even that way. I did, however end up building a Linux VM on my computer so I could run it that way, and it ran to a successful conclusion.
comment:6 by , 9 years ago
Yeah, the more recent GCC versions seem to have issues with OM-generated code. I had some luck reporting bugs on the GCC issue tracker and having things be better in subsequent patch releases, but GCC does have issues still, it seems. GCC 5.3.0 is more recent than when I reported bugs the last time (that time, I ran the pre-processor to create a C-file and started removing functions until I had just a few lines of code that caused GCC to crash).
follow-up: 11 comment:7 by , 9 years ago
Does that mean that the version of GCC on the Linux version of OM is older and more stable? That the Windows version uses a later version of GCC that creates problems? What can I do about it?
comment:8 by , 9 years ago
It could be that or the Windows version of gcc has issues.
Unfortunately I don't know how I can solve this as
one would need to compile OM and all its dependencies
with another version of gcc and that is not that easy.
It took quite a while to change from gcc 4.4.0 to gcc 5.3.0.
We use msys2 (https://msys2.github.io/) and we could
probably downgrade the compiler but we would need to
downgrade also all the dependencies or recompile them
with the downgraded compiler.
I think the easiest way to fix this is to change the
generated code to avoid the gcc bug but without more
info that is impossible.
comment:9 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
comment:10 by , 9 years ago
In the meantime you could try these:
- a nightly-build from tomorrow as some code generation has changed quite a bit:
https://github.com/OpenModelica/OMCompiler/pull/811
- try using the Cpp runtime for simulation code:
Tools->Options->Simulation->Target Language
- try using the C runtime with MSVC for simulation code compilation:
Tools->Options->Simulation->Target compiler
comment:11 by , 9 years ago
Replying to palmer.ap@…:
Does that mean that the version of GCC on the Linux version of OM is older and more stable? That the Windows version uses a later version of GCC that creates problems? What can I do about it?
The Linux version typically uses clang instead of gcc. You can try the getCompiler/setCompiler commands to see the compiler used and switch to gcc on Linux and see if your model fails with gcc on Linux as well.
comment:12 by , 9 years ago
using msvc15, I get the following error:
/usr/bin/sh: cl: command not found
WebModel.makefile:47: recipe for target 'WebModel.exe' failed
\tools\msys\mingw64\bin\mingw32-make: * [WebModel.exe] Error 127
Compilation process failed. Exited with code 2.
when I try using Cpp for the target language, it takes a much longer time and fails catastrophically with a large series of errors that look like:
C:/OpenModelica1.10.0-dev-64bit/include/omc/cpp/Core/Math/Array.h:1131:14: note: candidate expects 1 argument, 3 provided
C:/OpenModelica1.10.0-dev-64bit/include/omc/cpp/Core/Math/Array.h:1141:21: note: candidate: T& StatArrayDim2<T, size1, size2, external>::operator()(size_t, size_t) [with T = double; long long unsigned int size1 = 25ull; long long unsigned int size2 = 2ull; bool external = true; size_t = long long unsigned int]
inline virtual T& operator()(size_t i, size_t j)
comment:13 by , 9 years ago
Ok. It seems the MSVC compilation is a bit off. I'll have a look at it.
Did you tried it with the nightly-build from today with C runtime and gcc?:
https://build.openmodelica.org/omc/builds/windows/nightly-builds/64bit/
comment:14 by , 9 years ago
I just tried it, and it successfully completed the run. Thanks! Unfortunately, I couldn't view the results because of the following error:
[25] 11:41:07 Scripting Error
Failed to open simulation result WebModel_res.mat: Corrupt header: data_2 matrix
Seems like a different bug - should I submit a separate bug report?
comment:15 by , 9 years ago
It seems that the result file generated by the simulation is corrupted somehow. Are you sure the simulation works fine or it crashes before finishing?
It looks like GCC crashes while trying to compile the generated code for the initialization.
Can you test your model on a Linux machine, maybe using clang?
Do you have enough memory available?
We do the compilation of C files in parallel, that might also be a problem.
You can add
+n=1
to Tools->Options->Simulation->OMC Flags to tellOMC to use just one core (restart OMEdit before trying again).
Unfortunately without any additional information is complicated to debug this.