Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#3837 closed defect (invalid)

GCC 4.x - simulation issues

Reported by: Adrian Pop Owned by: Martin Sjölund
Priority: high Milestone:
Component: Build Environment Version:
Keywords: Cc:

Description (last modified by Adrian Pop)

I have a model (unfortunately non-public) that simulates differently (correctly) with gcc 4.8 but fails with division by zero with: gcc 4.9, gcc 5.x and clang.

Change History (8)

comment:1 by Adrian Pop, 10 years ago

I tried adding -fno-ipa-pure-const that we have for the compiler but it didn't help as anyway the simulation code is compiled with -O0.

comment:2 by Adrian Pop, 10 years ago

This is the OneWind model that we have in the MODRIO project.

comment:3 by Adrian Pop, 10 years ago

clang (v 3.8.0) also has the same issues as gcc 5.3.1 butw ith gcc 4.8 it works.

Version 0, edited 10 years ago by Adrian Pop (next)

comment:4 by Adrian Pop, 10 years ago

Description: modified (diff)
Summary: GCC 5.x vs GCC 4.x - simulation issuesGCC 4.x - simulation issues

comment:5 by Adrian Pop, 10 years ago

Time for valgrind :)

comment:6 by Adrian Pop, 10 years ago

valgrind gave more info:

==2408== Memcheck, a memory error detector
==2408== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==2408== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==2408== Command: ./OneWind.Components.Rotor.Test.TestRigidRotor_OM
==2408== 
==2408== brk segment overflow in thread #1: can't grow to 0x4c83000
==2408== Conditional jump or move depends on uninitialised value(s)
==2408==    at 0x98EC4E: omc_OneWind_Components_Rotor_Blade_Loadelement_Utilities_linearizeC (OneWind.Components.Rotor.Test.TestRigidRotor_OM_functions.c:227)
==2408==    by 0xA427B4: OneWind_Components_Rotor_Test_TestRigidRotor_OM_eqFunction_3296 (OneWind.Components.Rotor.Test.TestRigidRotor_OM_06inz.c:41711)
==2408==    by 0xCDE36B: OneWind_Components_Rotor_Test_TestRigidRotor_OM_functionInitialEquations (OneWind.Components.Rotor.Test.TestRigidRotor_OM_06inz.c:213368)
==2408==    by 0x4EA34DD: symbolic_initialization (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EA451F: initialization (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4E968F3: initializeModel (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4E97A58: solver_main (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EB835C: callSolver (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EB88A7: startNonInteractiveSimulation (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EBAA65: _main_SimulationRuntime (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x98D92A: main (OneWind.Components.Rotor.Test.TestRigidRotor_OM.c:148960)
==2408== 
==2408== Conditional jump or move depends on uninitialised value(s)
==2408==    at 0xA42F65: OneWind_Components_Rotor_Test_TestRigidRotor_OM_eqFunction_3296 (OneWind.Components.Rotor.Test.TestRigidRotor_OM_06inz.c:41776)
==2408==    by 0xCDE36B: OneWind_Components_Rotor_Test_TestRigidRotor_OM_functionInitialEquations (OneWind.Components.Rotor.Test.TestRigidRotor_OM_06inz.c:213368)
==2408==    by 0x4EA34DD: symbolic_initialization (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EA451F: initialization (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4E968F3: initializeModel (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4E97A58: solver_main (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EB835C: callSolver (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EB88A7: startNonInteractiveSimulation (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EBAA65: _main_SimulationRuntime (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x98D92A: main (OneWind.Components.Rotor.Test.TestRigidRotor_OM.c:148960)
==2408== 
==2408== Conditional jump or move depends on uninitialised value(s)
==2408==    at 0xA4383E: OneWind_Components_Rotor_Test_TestRigidRotor_OM_eqFunction_3296 (OneWind.Components.Rotor.Test.TestRigidRotor_OM_06inz.c:41842)
==2408==    by 0xCDE36B: OneWind_Components_Rotor_Test_TestRigidRotor_OM_functionInitialEquations (OneWind.Components.Rotor.Test.TestRigidRotor_OM_06inz.c:213368)
==2408==    by 0x4EA34DD: symbolic_initialization (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EA451F: initialization (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4E968F3: initializeModel (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4E97A58: solver_main (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EB835C: callSolver (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EB88A7: startNonInteractiveSimulation (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EBAA65: _main_SimulationRuntime (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x98D92A: main (OneWind.Components.Rotor.Test.TestRigidRotor_OM.c:148960)
==2408== 
==2408== Conditional jump or move depends on uninitialised value(s)
==2408==    at 0xA4384C: OneWind_Components_Rotor_Test_TestRigidRotor_OM_eqFunction_3296 (OneWind.Components.Rotor.Test.TestRigidRotor_OM_06inz.c:41842)
==2408==    by 0xCDE36B: OneWind_Components_Rotor_Test_TestRigidRotor_OM_functionInitialEquations (OneWind.Components.Rotor.Test.TestRigidRotor_OM_06inz.c:213368)
==2408==    by 0x4EA34DD: symbolic_initialization (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EA451F: initialization (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4E968F3: initializeModel (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4E97A58: solver_main (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EB835C: callSolver (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EB88A7: startNonInteractiveSimulation (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x4EBAA65: _main_SimulationRuntime (in /home/adrpo/om/build/lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so)
==2408==    by 0x98D92A: main (OneWind.Components.Rotor.Test.TestRigidRotor_OM.c:148960)
==2408== 
assert            | debug   | Division by zero rotor.blade[1].loadElement[17].bem.cosAeroAlpha / (rotor.blade[1].loadElement[17].bem.ct * rotor.blade[1].loadElement[17].bem.sigma)
assert            | info    | simulation terminated by an assertion at initialization
==2408== 
==2408== HEAP SUMMARY:
==2408==     in use at exit: 301,784,613 bytes in 7,584,997 blocks
==2408==   total heap usage: 7,953,846 allocs, 368,849 frees, 354,547,062 bytes allocated
==2408== 
==2408== LEAK SUMMARY:
==2408==    definitely lost: 1,149,770 bytes in 46,780 blocks
==2408==    indirectly lost: 300,513,253 bytes in 7,537,584 blocks
==2408==      possibly lost: 26,632 bytes in 606 blocks
==2408==    still reachable: 94,958 bytes in 27 blocks
==2408==         suppressed: 0 bytes in 0 blocks
==2408== Rerun with --leak-check=full to see details of leaked memory
==2408== 
==2408== For counts of detected and suppressed errors, rerun with: -v
==2408== Use --track-origins=yes to see where uninitialised values come from
==2408== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 2244 from 25)

so it seems something is fishy with the code we generate, I'll look into it more.

comment:7 by Adrian Pop, 10 years ago

Resolution: invalid
Status: newclosed

The problem is elsewhere in the compiler I'm trying to make a small public model with the error.

comment:8 by Martin Sjölund, 8 years ago

Milestone: 1.10.0

Milestone deleted

Note: See TracTickets for help on using tickets.