From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28886 invoked by alias); 10 Dec 2014 05:50:54 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 28850 invoked by uid 48); 10 Dec 2014 05:50:48 -0000 From: "Joost.VandeVondele at mat dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/64247] New: program result depends on environment ? Date: Wed, 10 Dec 2014 05:50:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: Joost.VandeVondele at mat dot ethz.ch X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-12/txt/msg01001.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64247 Bug ID: 64247 Summary: program result depends on environment ? Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: Joost.VandeVondele at mat dot ethz.ch This is a bit an odd bug report, as it so far is just a somewhat worrying observation: If I run our simulation package, the output appears to change if we pipe (|) an output to file via tee or if we direct the output (>) to file. This can be reproduced with setting the flag GFORTRAN_UNBUFFERED_ALL as in : > GFORTRAN_UNBUFFERED_ALL=0 ../../../exe/local/cp2k.sopt O_KG.inp POWELL| Number of function evaluations 3658 or > GFORTRAN_UNBUFFERED_ALL=1 ../../../exe/local/cp2k.sopt O_KG.inp POWELL| Number of function evaluations 10000 once the code converges (3658), once not. If I run the same code under valgrind, I get no warnings/errors, but the iteration count changes again to the old value. GFORTRAN_UNBUFFERED_ALL=1 valgrind ../../../exe/local/cp2k.sopt O_KG.inp POWELL| Number of function evaluations 3658 [..] ==453== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 5) This is all pretty reproducible on that particular machine. Only with gcc 4.9.2, not with earlier versions. In fact, if I pick up the old fortran runtime libs (4.8.X) (but same cp2k binary) the problem seems to disappear. However, I believe that this odd behavior with GFORTRAN_UNBUFFERED_ALL is maybe coincidental. Indeed, our nightly tester can change value 'randomly' and it looks like the result depends on the environment, in a surprising way. Any suggestions ? The only wild guess I have so far is that, maybe, code flow is influenced by the alignment of buffers returned by malloc, but I won't know how to prove that ?