https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79430
--- Comment #23 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Thu, Feb 09, 2017 at 10:42:08AM +0000, bijan at chokoufe dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79430 > > --- Comment #19 from Bijan Chokoufe <bijan at chokoufe dot com> --- > So in the build with '-O2 -g' (default), valgrind tells us > > ==8214== Conditional jump or move depends on uninitialised value(s) > ==8214== at 0x5300201: __shower_core_MOD_shower_generate_next_isr_branching > (shower_core.f90:3089) > ==8214== by 0x5306A90: __shower_core_MOD_shower_generate_emissions > (shower_core.f90:316) > ==8214== by 0x52D3CE6: __shower_MOD_evt_shower_generate_weighted.part.2 > (shower.f90:238) > ==8214== by 0x52B0BBF: __event_transforms_MOD_evt_generate_unweighted > (event_transforms.f90:203) > ==8214== by 0x52DCEA5: __events_MOD_event_evaluate_transforms > (events.f90:520) > ==8214== by 0x52DC247: __events_MOD_event_generate (events.f90:751) > ==8214== by 0x5260A2F: __simulations_MOD_simulation_generate > (simulations.f90:1639) > ==8214== by 0x5285A35: __commands_MOD_cmd_simulate_execute > (commands.f90:4501) > ==8214== by 0x5267A08: __commands_MOD_command_list_execute > (commands.f90:5835) > ==8214== by 0x52A84A5: __whizard_MOD_whizard_process_stream > (whizard.f90:348) > ==8214== by 0x52A7C25: __whizard_MOD_whizard_process_file (whizard.f90:323) > ==8214== by 0x4E3EF61: MAIN__ (main.f90:415) > ==8214== > > which is exactely the problematic point we also identified with print > debugging, mentioned in the description of this ticket. > If you change the declaration for 'final' to real(default), intent(in), volatile :: final do you still have a problem? Hopefully, this will suppress whatever is causing the optimizer to remove the if statement.