#5749 closed defect (fixed)
Segmentation fault during omc compilation with gcc (v1.14.0)
Reported by: | Owned by: | Adrian Pop | |
---|---|---|---|
Priority: | high | Milestone: | 1.16.0 |
Component: | Build Environment | Version: | |
Keywords: | Cc: |
Description
Hello,
With gcc 8.3.1 and Fedora29 I get a segmentation while compiling omc v1.14.0:
make omc
...
<OM_PATH>/build/bin/omc -d=failtrace -g=MetaModelica OpenModelicaScriptingAPI.mos
Limited backtrace at point of segmentation fault
<OM_PATH>/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaRuntimeC.so(+0x17c54)[0x7f179b81bc54]
/lib64/libc.so.6(+0x38600)[0x7f179b93e600]
<OM_PATH>/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(omc_FGraphBuildEnv_mkProgramGraph+0x33)[0x7f179bfeed63]
<OM_PATH>/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(omc_Builtin_initialGraph+0x1a1)[0x7f179c2e0271]
<OM_PATH>/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(omc_Inst_makeEnvFromProgram+0x40)[0x7f179c1a1330]
<OM_PATH>/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(omc_SymbolTable_buildEnv+0x43)[0x7f179bf4bc43]
<OM_PATH>/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(omc_Interactive_evaluateExpr+0x108)[0x7f179bfb0868]
<OM_PATH>/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(omc_Interactive_evaluateExprToStr+0x1b3)[0x7f179bfb0c23]
<OM_PATH>/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(omc_Interactive_evaluate2+0x1c5)[0x7f179bfb2e05]
<OM_PATH>/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(omc_Interactive_evaluateToStdOut+0x9e)[0x7f179bfb380e]
<OM_PATH>/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(omc_Main_translateFile+0x5d3)[0x7f179bdc20d3]
<OM_PATH>/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(omc_Main_main2+0x468)[0x7f179bdc3bb8]
<OM_PATH>/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(omc_Main_main+0x414)[0x7f179bdc4294]
<OM_PATH>/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(omc_main+0x1e6)[0x7f179c30ab66]
/lib64/libc.so.6(libc_start_main+0xf3)[0x7f179b92a413]
make[5]: * [Makefile.common:4: OpenModelicaScriptingAPI.mo] Erreur de segmentation (core dump créé)
with clang it compiles properly.
Thank you and Regards
Change History (18)
comment:1 by , 4 years ago
comment:2 by , 4 years ago
@florentine, we are going to release 1.16.0-beta.01 next week. Could you try with the latest 1.16.0 nightly build and report if you still have this issue?
Thanks!
comment:3 by , 4 years ago
Hi,
I tried on the master yesterday and the issue was still there.
This is preventing us from using latest versions of OpenModelica.
Thank you for your response!
Regards,
Florentine
comment:4 by , 4 years ago
Can you try to configure with CFLAGS=-g
?
./configure CC=gcc CXX=g++ CFLAGS='-g'
and see if you don't get a crash?
You could also try to compile with Clang:
./configure CC=clang CXX=clang++
As far as I can see it dies while using the newly build omc to generate the Qt API for OMEdit.
I'll see if I can get my hand on a VM image with Fedora29 and gcc 8.3.1 to do proper testing.
comment:5 by , 4 years ago
Hi,
The compilation passes with the CFLAGS='-g' option.
It also passes with clang in all the cases, but we do need to compile with gcc as our servers does not support clang.
Thank you,
Regards,
Florentine
comment:6 by , 4 years ago
Component: | *unknown* → Installation program |
---|---|
Milestone: | Future → 1.16.0 |
Owner: | changed from | to
Status: | new → assigned |
comment:7 by , 4 years ago
Component: | Installation program → Build Environment |
---|---|
Status: | assigned → accepted |
comment:10 by , 4 years ago
Hi,
this is Fedora 29 Workstation Edition 64 bit.
We are currently trying to compile the master with a more recent gcc version, we'll let you know if it passes asap.
Thank you,
Regards,
Florentine
comment:11 by , 4 years ago
The error can be reproduced with the following steps:
docker run -it fedora:29
dnf install -y git gcc gcc-c++ gcc-gfortran autoconf automake make libtool cmake hwloc java-1.8.0-openjdk-devel blas-devel lapack-devel lpsolve-devel expat-devel glibc-devel sqlite-devel xerces-c-devel libarchive-devel zlib-devel qt-devel gettext patch wget python-devel clang llvm-devel ncurses-devel readline-devel unzip perl-Digest-MD5 vim gcovr python-pip python-psutil boost-devel lcov gtest-devel gmock-devel xz rsync python-lxml graphviz clang-devel OpenSceneGraph-devel qtwebkit qtwebkit-devel qt5-qtwebkit qt5-qtwebkit-devel qwt python-sphinx qwt-devel OpenSceneGraph-qt-devel OpenSceneGraph-devel OpenSceneGraph-libs OpenSceneGraph-qt OpenSceneGraph-qt-devel qwt5-qt4-devel glibc-static libstdc++-static omniORB-devel poppler-devel flex bison maven curl-devel uuid-devel qt5-linguist qt5-qtsvg-devel qt5-qtxmlpatterns-devel
git clone https://github.com/OpenModelica/OpenModelica.git \
&& cd OpenModelica \
&& git submodule init \
&& git submodule update \
&& git submodule foreach --recursive 'git submodule init' \
&& git submodule foreach --recursive 'git submodule update'
autoconf \
&& ./configure CC=gcc CXX=g++ --disable-modelica3d --disable-omnotebook --disable-omshell-terminal --with-qwt=NO \
&& make omc
A similar procedure with an ubuntu:20.04 docker has been tested and worked, gcc version is 9.3.0.
comment:12 by , 4 years ago
I could reproduce it on my Fedora 29 Workstation VirtualBox VM. I'm debugging it now.
comment:13 by , 4 years ago
Slicing down through gcc -O2
flags to see which one is to blame is really fun. I started with the last one that is different from -O1
: -ftree-vrp
.
-
.txt"
diff --git a/O1-opts.txt b/O2-opts.txt index c872fb9..8f13d1c 100644
old new The following options control optimizations: 5 5 -Os 6 6 -faggressive-loop-optimizations [enabled] 7 7 -falign-functions [disabled] 8 -falign-functions= 1 8 -falign-functions= 16 9 9 -falign-jumps [disabled] 10 -falign-jumps= 1 11 -falign-labels [ disabled]12 -falign-labels= 110 -falign-jumps= 16 11 -falign-labels [enabled] 12 -falign-labels= 0 13 13 -falign-loops [disabled] 14 -falign-loops= 1 14 -falign-loops= 16 15 15 -fassociative-math [disabled] 16 16 -fasynchronous-unwind-tables [enabled] 17 17 -fauto-inc-dec [enabled] … … The following options control optimizations: 20 20 -fbranch-target-load-optimize [disabled] 21 21 -fbranch-target-load-optimize2 [disabled] 22 22 -fbtr-bb-exclusive [disabled] 23 -fcaller-saves [ disabled]24 -fcode-hoisting [ disabled]23 -fcaller-saves [enabled] 24 -fcode-hoisting [enabled] 25 25 -fcombine-stack-adjustments [enabled] 26 26 -fcompare-elim [enabled] 27 27 -fconserve-stack [disabled] 28 28 -fcprop-registers [enabled] 29 -fcrossjumping [ disabled]30 -fcse-follow-jumps [ disabled]29 -fcrossjumping [enabled] 30 -fcse-follow-jumps [enabled] 31 31 -fcx-fortran-rules [disabled] 32 32 -fcx-limited-range [disabled] 33 33 -fdce [enabled] … … The following options control optimizations: 35 35 -fdelayed-branch [disabled] 36 36 -fdelete-dead-exceptions [disabled] 37 37 -fdelete-null-pointer-checks [enabled] 38 -fdevirtualize [ disabled]39 -fdevirtualize-speculatively [ disabled]38 -fdevirtualize [enabled] 39 -fdevirtualize-speculatively [enabled] 40 40 -fdse [enabled] 41 41 -fearly-inlining [enabled] 42 42 -fexceptions [disabled] 43 -fexpensive-optimizations [ disabled]43 -fexpensive-optimizations [enabled] 44 44 -ffast-math 45 45 -ffinite-math-only [disabled] 46 46 -ffloat-store [disabled] … … The following options control optimizations: 48 48 -ffp-contract=[off|on|fast] fast 49 49 -ffp-int-builtin-inexact [enabled] 50 50 -ffunction-cse [enabled] 51 -fgcse [ disabled]51 -fgcse [enabled] 52 52 -fgcse-after-reload [disabled] 53 53 -fgcse-las [disabled] 54 54 -fgcse-lm [enabled] … … The following options control optimizations: 57 57 -fgraphite-identity [disabled] 58 58 -fguess-branch-probability [enabled] 59 59 -fhandle-exceptions 60 -fhoist-adjacent-loads [ disabled]60 -fhoist-adjacent-loads [enabled] 61 61 -fif-conversion [enabled] 62 62 -fif-conversion2 [enabled] 63 -findirect-inlining [ disabled]63 -findirect-inlining [enabled] 64 64 -finline [enabled] 65 65 -finline-atomics [enabled] 66 66 -finline-functions [disabled] 67 67 -finline-functions-called-once [enabled] 68 -finline-small-functions [ disabled]69 -fipa-bit-cp [ disabled]70 -fipa-cp [ disabled]68 -finline-small-functions [enabled] 69 -fipa-bit-cp [enabled] 70 -fipa-cp [enabled] 71 71 -fipa-cp-clone [disabled] 72 -fipa-icf [ disabled]73 -fipa-icf-functions [ disabled]74 -fipa-icf-variables [ disabled]72 -fipa-icf [enabled] 73 -fipa-icf-functions [enabled] 74 -fipa-icf-variables [enabled] 75 75 -fipa-profile [enabled] 76 76 -fipa-pta [disabled] 77 77 -fipa-pure-const [enabled] 78 -fipa-ra [ disabled]78 -fipa-ra [enabled] 79 79 -fipa-reference [enabled] 80 -fipa-sra [ disabled]81 -fipa-vrp [ disabled]80 -fipa-sra [enabled] 81 -fipa-vrp [enabled] 82 82 -fira-algorithm=[CB|priority] CB 83 83 -fira-hoist-pressure [enabled] 84 84 -fira-loop-pressure [disabled] … … The following options control optimizations: 86 86 -fira-share-save-slots [enabled] 87 87 -fira-share-spill-slots [enabled] 88 88 -fisolate-erroneous-paths-attribute [disabled] 89 -fisolate-erroneous-paths-dereference [ disabled]89 -fisolate-erroneous-paths-dereference [enabled] 90 90 -fivopts [enabled] 91 91 -fjump-tables [enabled] 92 92 -fkeep-gc-roots-live [disabled] … … The following options control optimizations: 98 98 -floop-nest-optimize [disabled] 99 99 -floop-parallelize-all [disabled] 100 100 -floop-unroll-and-jam [disabled] 101 -flra-remat [ disabled]101 -flra-remat [enabled] 102 102 -fmath-errno [enabled] 103 103 -fmodulo-sched [disabled] 104 104 -fmodulo-sched-allow-regmoves [disabled] … … The following options control optimizations: 107 107 -fnothrow-opt [disabled] 108 108 -fomit-frame-pointer [enabled] 109 109 -fopt-info [disabled] 110 -foptimize-sibling-calls [ disabled]111 -foptimize-strlen [ disabled]110 -foptimize-sibling-calls [enabled] 111 -foptimize-strlen [enabled] 112 112 -fpack-struct [disabled] 113 113 -fpack-struct=<number> 114 -fpartial-inlining [ disabled]114 -fpartial-inlining [enabled] 115 115 -fpatchable-function-entry= 116 116 -fpeel-loops [disabled] 117 117 -fpeephole [enabled] 118 -fpeephole2 [ disabled]118 -fpeephole2 [enabled] 119 119 -fplt [enabled] 120 120 -fpredictive-commoning [disabled] 121 121 -fprefetch-loop-arrays [enabled] … … The following options control optimizations: 124 124 -freg-struct-return [enabled] 125 125 -frename-registers [enabled] 126 126 -freorder-blocks [enabled] 127 -freorder-blocks-algorithm=[simple|stc] s imple128 -freorder-blocks-and-partition [ disabled]129 -freorder-functions [ disabled]130 -frerun-cse-after-loop [ disabled]127 -freorder-blocks-algorithm=[simple|stc] stc 128 -freorder-blocks-and-partition [enabled] 129 -freorder-functions [enabled] 130 -frerun-cse-after-loop [enabled] 131 131 -freschedule-modulo-scheduled-loops [disabled] 132 132 -frounding-math [disabled] 133 133 -frtti [enabled] … … The following options control optimizations: 149 149 -fsched2-use-superblocks [disabled] 150 150 -fschedule-fusion [enabled] 151 151 -fschedule-insns [disabled] 152 -fschedule-insns2 [ disabled]152 -fschedule-insns2 [enabled] 153 153 -fsection-anchors [disabled] 154 154 -fsel-sched-pipelining [disabled] 155 155 -fsel-sched-pipelining-outer-loops [disabled] … … The following options control optimizations: 178 178 -fstack-protector-strong [disabled] 179 179 -fstack-reuse=[all|named_vars|none] all 180 180 -fstdarg-opt [enabled] 181 -fstore-merging [ disabled]182 -fstrict-aliasing [ disabled]181 -fstore-merging [enabled] 182 -fstrict-aliasing [enabled] 183 183 -fstrict-enums [disabled] 184 184 -fstrict-volatile-bitfields [enabled] 185 -fthread-jumps [ disabled]185 -fthread-jumps [enabled] 186 186 -fno-threadsafe-statics [enabled] 187 187 -ftracer [disabled] 188 188 -ftrapping-math [enabled] … … The following options control optimizations: 210 210 -ftree-parallelize-loops=<number> 1 211 211 -ftree-partial-pre [disabled] 212 212 -ftree-phiprop [enabled] 213 -ftree-pre [ disabled]213 -ftree-pre [enabled] 214 214 -ftree-pta [enabled] 215 215 -ftree-reassoc [enabled] 216 216 -ftree-scev-cprop [enabled] … … The following options control optimizations: 218 218 -ftree-slp-vectorize [disabled] 219 219 -ftree-slsr [enabled] 220 220 -ftree-sra [enabled] 221 -ftree-switch-conversion [ disabled]222 -ftree-tail-merge [ disabled]221 -ftree-switch-conversion [enabled] 222 -ftree-tail-merge [enabled] 223 223 -ftree-ter [enabled] 224 224 -ftree-vectorize 225 -ftree-vrp [ disabled]225 -ftree-vrp [enabled] 226 226 -funconstrained-commons [disabled] 227 227 -funroll-all-loops [disabled] 228 228 -funroll-loops [disabled] … … The following options control optimizations: 234 234 -fvar-tracking-assignments-toggle [disabled] 235 235 -fvar-tracking-uninit [disabled] 236 236 -fvariable-expansion-in-unroller [disabled] 237 Specifies the cost model for vectorization. -fvect-cost-model=[unlimited|dynamic|cheap] [default]237 Specifies the cost model for vectorization. -fvect-cost-model=[unlimited|dynamic|cheap] cheap 238 238 -fvpt [disabled] 239 239 -fweb [enabled] 240 240 -fwrapv [disabled]
It seems to work with gcc 8.3.1 using:
./configure CFLAGS='-g -O2 -fno-tree-vrp'
I will investigate more and if this is the case I will fix configure to disable optimization -ftree-vrp
after -O2
. We do similar stuff for gcc 5.3 as it has some bad optimizations as well.
comment:15 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
comment:16 by , 4 years ago
Milestone: | 1.16.0 → 1.17.0 |
---|
I guess this is fixed in 1.17.0 but not in 1.16.0, unless the commit is back-ported.
@sjoelund.se, would that be easy to do?
Hi,
This issue is still there in 1.14.2.
Regards